Module: Yast::PartitioningLvmLvLibInclude

Defined in:
../../src/include/partitioning/lvm_lv_lib.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) addLogicalVolume(_Lv, current_vg)



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File '../../src/include/partitioning/lvm_lv_lib.rb', line 49

def addLogicalVolume(_Lv, current_vg)
  _Lv = deep_copy(_Lv)
  ret = true
  if Ops.get_boolean(_Lv, "pool", false)
    ret = Storage.CreateLvmPool(
      current_vg,
      Ops.get_string(_Lv, "name", ""),
      Ops.get_integer(_Lv, "size_k", 0),
      Ops.get_integer(_Lv, "stripes", 1)
    )
  elsif !Builtins.isempty(Ops.get_string(_Lv, "used_pool", ""))
    ret = Storage.CreateLvmThin(
      current_vg,
      Ops.get_string(_Lv, "name", ""),
      Ops.get_string(_Lv, "used_pool", ""),
      Ops.get_integer(_Lv, "size_k", 0)
    )
  else
    ret = Storage.CreateLvmLv(
      current_vg,
      Ops.get_string(_Lv, "name", ""),
      Ops.get_integer(_Lv, "size_k", 0),
      Ops.get_integer(_Lv, "stripes", 1)
    )
  end
  if !ret
    popupText(Ops.get_integer(_Lv, "stripes", 1))
  else
    ret = Storage.ChangeVolumeProperties(_Lv)
    if Ops.greater_than(Ops.get_integer(_Lv, "stripes", 1), 1) &&
        Ops.greater_than(Ops.get_integer(_Lv, "stripesize", 0), 0)
      ret = Storage.ChangeLvStripeSize(
        current_vg,
        Ops.get_string(_Lv, "name", ""),
        Ops.get_integer(_Lv, "stripesize", 0)
      ) && ret
    end
  end
  ret
end

- (Object) get_lv_names(target_map, vg_name)

////////////////////////////////////////////////////////////////////////////// Get all existing lv names of a volume group



94
95
96
97
98
99
100
101
102
103
# File '../../src/include/partitioning/lvm_lv_lib.rb', line 94

def get_lv_names(target_map, vg_name)
  target_map = deep_copy(target_map)
  parts = Ops.get_list(
    target_map,
    [Ops.add("/dev/", vg_name), "partitions"],
    []
  )
  ret = Builtins.maplist(parts) { |part| Ops.get_string(part, "name", "") }
  deep_copy(ret)
end

- (Object) initialize_partitioning_lvm_lv_lib(include_target)



28
29
30
31
32
33
34
35
# File '../../src/include/partitioning/lvm_lv_lib.rb', line 28

def initialize_partitioning_lvm_lv_lib(include_target)
  textdomain "storage"
  Yast.import "Storage"
  Yast.import "Popup"

  Yast.include include_target, "partitioning/lvm_lib.rb"
  Yast.include include_target, "partitioning/lvm_pv_lib.rb"
end

- (Object) popupText(stripe)



37
38
39
40
41
42
43
44
45
46
47
# File '../../src/include/partitioning/lvm_lv_lib.rb', line 37

def popupText(stripe)
  txt = _(
    "A logical volume with the requested size could \nnot be created.\n"
  )
  if Ops.greater_than(stripe, 1)
    txt = Ops.add(txt, _("Try reducing the stripe count of the volume."))
  end
  Popup.Error(txt)

  nil
end