Module: Yast::PartitioningLvmUiDialogsInclude

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) HandleRemoveLv(targetMap, id)



40
41
42
43
44
45
46
47
48
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
# File '../../src/include/partitioning/lvm_ui_dialogs.rb', line 40

def HandleRemoveLv(targetMap, id)
  targetMap = deep_copy(targetMap)
  ret = false
  disk = Storage.GetDisk(targetMap, id)
  _Lv = Storage.GetPartition(targetMap, id)
  if Builtins.size(_Lv) == 0 || _Lv == nil ||
      Ops.get_symbol(_Lv, "type", :primary) != :lvm
    # Popup text
    Popup.Error(_("You can only remove logical volumes."))
  elsif Builtins.find(Ops.get_list(disk, "partitions", [])) do |p|
      Ops.get_string(p, "origin", "") == Ops.get_string(_Lv, "name", "")
    end != nil
    # Popup text
    Popup.Error(
      _(
        "There is at least one snapshot active for this volume.\nRemove the snapshot first."
      )
    )
  elsif Builtins.find(Ops.get_list(disk, "partitions", [])) do |p|
      Ops.get_string(p, "used_pool", "") == Ops.get_string(_Lv, "name", "")
    end != nil
    # Popup text
    Popup.Error(
      _(
        "There is at least one thin volume using this pool.\nRemove the thin volume first."
      )
    )
  else
    # Popup text
    message = Builtins.sformat(_("Remove the logical volume %1?"), id)

    ret = Storage.DeleteDevice(id) if Popup.YesNo(message)
  end
  Builtins.y2milestone("HandleRemoveLv ret:%1", ret)
  ret
end

- (Object) initialize_partitioning_lvm_ui_dialogs(include_target)



28
29
30
31
32
33
34
35
36
37
38
# File '../../src/include/partitioning/lvm_ui_dialogs.rb', line 28

def initialize_partitioning_lvm_ui_dialogs(include_target)
  textdomain "storage"


  Yast.import "Storage"
  Yast.import "Popup"

  Yast.include include_target, "partitioning/custom_part_dialogs.rb"
  Yast.include include_target, "partitioning/custom_part_lib.rb"
  Yast.include include_target, "partitioning/lvm_lv_lib.rb"
end