Module: Yast::PartitioningEpBtrfsLibInclude
- Defined in:
- ../../src/include/partitioning/ep-btrfs-lib.rb
Instance Method Summary (collapse)
- - (Object) AddVols(device, devs)
- - (Object) EpDeleteBtrfsDevice(device)
- - (Object) EpEditBtrfsDevice(device)
- - (Object) EpResizeBtrfsDevice(device)
- - (Object) initialize_partitioning_ep_btrfs_lib(include_target)
- - (Object) RemoveVols(device, devs)
Instance Method Details
- (Object) AddVols(device, devs)
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File '../../src/include/partitioning/ep-btrfs-lib.rb', line 99 def AddVols(device, devs) ret = true tg = Storage.GetTargetMap Builtins.foreach(devs) do |dev| if dev!=device p = Storage.GetPartition(tg, dev) if( p.key?("fsid") && p["fsid"]!=Partitions.fsid_native ) Storage.SetPartitionId(dev, Partitions.fsid_native) end Storage.SetPartitionFormat(dev, false, :none) ret = false if !Storage.ExtendBtrfsVolume(device, dev) end end ret end |
- (Object) EpDeleteBtrfsDevice(device)
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File '../../src/include/partitioning/ep-btrfs-lib.rb', line 73 def EpDeleteBtrfsDevice(device) if device == nil # error popup Popup.Error(_("No Btrfs device selected.")) return end target_map = Storage.GetTargetMap data = Storage.GetPartition(target_map, device) Builtins.y2milestone("EpDeletBtrfsDevice device:%1 data:%2", device, data) if !Storage.CanDelete(data, Ops.get(target_map, "/dev/btrfs", {}), true) return end if EpDeleteDevice(device) new_focus = nil new_focus = :md if UI.QueryWidget(:tree, :CurrentItem) == device UpdateMainStatus() UpdateNavigationTree(new_focus) TreePanel.Create end nil end |
- (Object) EpEditBtrfsDevice(device)
32 33 34 35 36 37 38 39 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 |
# File '../../src/include/partitioning/ep-btrfs-lib.rb', line 32 def EpEditBtrfsDevice(device) if device == nil # error popup Popup.Error(_("No Btrfs device selected.")) return end target_map = Storage.GetTargetMap data = Storage.GetPartition(target_map, device) Builtins.y2milestone("EpEditBtrfsDevice device:%1 data:%2", device, data) if Storage.IsUsedBy(data) # error popup Popup.Error( Builtins.sformat( _( "The Btrfs %1 is in use. It cannot be\nedited. To edit %1, make sure it is not used." ), Ops.get_string(data, "uuid", "") ) ) return end if ( data_ref = arg_ref(data); _DlgEditBtrfsVolume_result = DlgEditBtrfsVolume(data_ref); data = data_ref.value; _DlgEditBtrfsVolume_result ) Storage.ChangeVolumeProperties(data) UpdateMainStatus() UpdateNavigationTree(nil) TreePanel.Create UpdateTableFocus(device) end nil end |
- (Object) EpResizeBtrfsDevice(device)
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File '../../src/include/partitioning/ep-btrfs-lib.rb', line 127 def EpResizeBtrfsDevice(device) if device == nil # error popup Popup.Error(_("No Btrfs device selected.")) return end target_map = Storage.GetTargetMap data = Storage.GetPartition(target_map, device) Builtins.y2milestone( "EpResizeBtrfsDevice device:%1 data:%2", device, data ) _Commit = lambda do |data| devices_old = MergeDevices(data) devices_new = Ops.get_list(data, "devices_new", []) devices_added = AddedToList(devices_old, devices_new) devices_removed = RemovedFromList(devices_old, devices_new) if Ops.greater_than(Builtins.size(devices_added), 0) Builtins.y2milestone( "EpResizeBtrfsDevice device_added:%1", devices_added ) end if Ops.greater_than(Builtins.size(devices_removed), 0) Builtins.y2milestone( "EpResizeBtrfsDevice device_removed:%1", devices_removed ) end if Ops.greater_than(Builtins.size(devices_added), 0) || Ops.greater_than(Builtins.size(devices_removed), 0) AddVols(device, devices_added) if !RemoveVols(device, devices_removed) # error popup Popup.Error(_("Failed to remove some physical devices.")) # TODO: update data return :back end end :finish end if ( data_ref = arg_ref(data); _DlgResizeBtrfsVolume_result = DlgResizeBtrfsVolume( data_ref, fun_ref(_Commit, "symbol (map)") ); data = data_ref.value; _DlgResizeBtrfsVolume_result ) UpdateMainStatus() UpdateNavigationTree(nil) TreePanel.Create end nil end |
- (Object) initialize_partitioning_ep_btrfs_lib(include_target)
28 29 30 |
# File '../../src/include/partitioning/ep-btrfs-lib.rb', line 28 def initialize_partitioning_ep_btrfs_lib(include_target) textdomain "storage" end |
- (Object) RemoveVols(device, devs)
117 118 119 120 121 122 123 124 125 |
# File '../../src/include/partitioning/ep-btrfs-lib.rb', line 117 def RemoveVols(device, devs) ret = true Builtins.foreach(devs) do |dev| Storage.UnchangePartitionId(dev) ret = false if !Storage.ReduceBtrfsVolume(device, dev) end ret end |