Module: Yast::PartitioningEpBtrfsDialogsInclude
- Defined in:
- ../../src/include/partitioning/ep-btrfs-dialogs.rb
Instance Method Summary (collapse)
- - (Object) CheckNumberOfDevicesForVolume(num)
- - (Object) DlgEditBtrfsVolume(data)
- - (Object) DlgResizeBtrfsVolume(data, _Commit)
-
- (Object) GetPossibleVols(targetMap)
/////////////////////////////////////////////////////////////// Get all volumes, we can probably use as volumes in an BTRFS Add needed information: disksize.
- - (Object) initialize_partitioning_ep_btrfs_dialogs(include_target)
- - (Object) MiniWorkflowStepResizeVolume(data)
- - (Object) MiniWorkflowStepResizeVolumeHelptext
Instance Method Details
- (Object) CheckNumberOfDevicesForVolume(num)
160 161 162 163 164 165 166 167 168 169 |
# File '../../src/include/partitioning/ep-btrfs-dialogs.rb', line 160 def CheckNumberOfDevicesForVolume(num) if Ops.less_than(num, 1) # error popup Popup.Error(Builtins.sformat(_("Select at least one device."))) UI.SetFocus(Id(:unselected)) return false else return true end end |
- (Object) DlgEditBtrfsVolume(data)
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 72 73 74 75 |
# File '../../src/include/partitioning/ep-btrfs-dialogs.rb', line 32 def DlgEditBtrfsVolume(data) Builtins.y2milestone("DlgEditBtrfsVolume %1", data.value) device = Ops.get_string(data.value, "device", "error") aliases = { "FormatMount" => lambda do ( data_ref = arg_ref(data.value); _MiniWorkflowStepFormatMount_result = MiniWorkflowStepFormatMount( data_ref ); data.value = data_ref.value; _MiniWorkflowStepFormatMount_result ) end, "Password" => lambda( ) do ( data_ref = arg_ref(data.value); _MiniWorkflowStepPassword_result = MiniWorkflowStepPassword(data_ref); data.value = data_ref.value; _MiniWorkflowStepPassword_result ) end } sequence = { "FormatMount" => { :next => "Password", :finish => :finish }, "Password" => { :finish => :finish } } # dialog title title = Builtins.sformat( _("Edit Btrfs %1"), Ops.get_string(data.value, "uuid", "") ) = MiniWorkflow.Run( title, StorageIcons.lvm_lv_icon, aliases, sequence, "FormatMount" ) == :finish end |
- (Object) DlgResizeBtrfsVolume(data, _Commit)
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
# File '../../src/include/partitioning/ep-btrfs-dialogs.rb', line 264 def DlgResizeBtrfsVolume(data, _Commit) _Commit = deep_copy(_Commit) aliases = { "TheOne" => lambda do ( data_ref = arg_ref(data.value); _MiniWorkflowStepResizeVolume_result = MiniWorkflowStepResizeVolume( data_ref ); data.value = data_ref.value; _MiniWorkflowStepResizeVolume_result ) end, "Commit" => lambda { _Commit.call(data.value) } } sequence = { "TheOne" => { :finish => "Commit" }, "Commit" => { :finish => :finish } } Builtins.y2milestone("data:%1", data.value) # dialog title title = Builtins.sformat( _("Resize Btrfs Volume %1"), Ops.get_string(data.value, "uuid", "error") ) = MiniWorkflow.Run( title, StorageIcons.lvm_icon, aliases, sequence, "TheOne" ) == :finish end |
- (Object) GetPossibleVols(targetMap)
/////////////////////////////////////////////////////////////// Get all volumes, we can probably use as volumes in an BTRFS Add needed information: disksize
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 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 |
# File '../../src/include/partitioning/ep-btrfs-dialogs.rb', line 80 def GetPossibleVols(targetMap) targetMap = deep_copy(targetMap) ret = [] #//////////////////////////////////////////////////////////////////// # add the devicename i.e /dev/hda1 or /dev/system/usr to partition list targetMap = Builtins.mapmap(targetMap) do |dev, devmap| partitions = Builtins.maplist(Ops.get_list(devmap, "partitions", [])) do |part| Ops.set(part, "maindev", dev) deep_copy(part) end { dev => Builtins.add(devmap, "partitions", partitions) } end #////////////////////////////////////////////////////////// # Look for all partitions: # no mountpoint # id 0x83 types_no = [:btrfs, :extended] types_ok = [:sw_raid, :dm, :lvm] fsids = [ Partitions.fsid_native, Partitions.fsid_lvm, Partitions.fsid_raid ] allowed_enc_types = [:none] Builtins.foreach(targetMap) do |dev, devmap| Builtins.y2milestone( "GetPossibleVols parts:%1", Ops.get_list(devmap, "partitions", []) ) parts = Builtins.filter(Ops.get_list(devmap, "partitions", [])) do |part| (Builtins.size(Ops.get_string(part, "mount", "")) == 0 || Ops.get_symbol(part, "used_by_type", :UB_NONE) == :UB_BTRFS) && !Builtins.contains(types_no, Ops.get_symbol(part, "type", :primary)) && Builtins.contains( allowed_enc_types, Ops.get_symbol(part, "enc_type", :none) ) && (!Storage.IsUsedBy(part) || Ops.get_symbol(part, "used_by_type", :UB_NONE) == :UB_BTRFS) && (Builtins.contains(types_ok, Ops.get_symbol(part, "type", :primary)) || Builtins.contains(fsids, Ops.get_integer(part, "fsid", 0))) end Builtins.y2milestone("GetPossibleVols filter:%1", parts) if Ops.get_symbol(devmap, "used_by_type", :UB_NONE) != :UB_NONE parts = [] Builtins.y2milestone( "GetPossibleVols no parts, disk used by %1 %2", Ops.get_symbol(devmap, "used_by_type", :UB_NONE), Ops.get_string(devmap, "used_by_device", "") ) end # currently disallow usage of whole disk devices as parts of BTRFS volumes # if( size(devmap["partitions"]:[])==0 && # Storage::IsPartType(devmap["type"]:`CT_UNKNOWN) && # (!Storage::IsUsedBy(devmap) || devmap["used_by_type"]:`UB_NONE==`UB_LVM)) # { # map p = $[ "device":dev, "maindev":dev, # "size_k":devmap["size_k"]:0 ]; # if( devmap["used_by_type"]:`UB_NONE != `UB_NONE ) # { # p["used_by_type"] = devmap["used_by_type"]:`UB_NONE; # p["used_by_device"] = devmap["used_by_device"]:""; # } # parts = [ p ]; # } ret = Convert.convert( Builtins.merge(ret, parts), :from => "list", :to => "list <map>" ) end Builtins.y2milestone("GetPossibleVols ret %1", ret) deep_copy(ret) end |
- (Object) initialize_partitioning_ep_btrfs_dialogs(include_target)
28 29 30 |
# File '../../src/include/partitioning/ep-btrfs-dialogs.rb', line 28 def initialize_partitioning_ep_btrfs_dialogs(include_target) textdomain "storage" end |
- (Object) MiniWorkflowStepResizeVolume(data)
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 |
# File '../../src/include/partitioning/ep-btrfs-dialogs.rb', line 181 def MiniWorkflowStepResizeVolume(data) Builtins.y2milestone("MiniWorkflowStepResizeVolume data:%1", data.value) pvs_new = [] fields = StorageSettings.FilterTable( [:device, :udev_path, :udev_id, :size, :encrypted, :type] ) poss_pvs = GetPossibleVols(Storage.GetTargetMap) Builtins.y2milestone( "MiniWorkflowStepResizeVolume poss:%1", Builtins.maplist(poss_pvs) do |pv| [ Ops.get_string(pv, "device", ""), Ops.get_string(pv, "used_by_device", "") ] end ) unused_pvs = Builtins.filter(poss_pvs) do |pv| Ops.get_symbol(pv, "used_by_type", :UB_NONE) == :UB_NONE end used_pvs = Builtins.filter(poss_pvs) do |pv| Ops.get_string(pv, "used_by_device", "") == Ops.get_string(data.value, "uuid", "") end contents = VBox() contents = Builtins.add( contents, DevicesSelectionBox.Create( unused_pvs, used_pvs, fields, nil, _("Unused Devices:"), _("Selected Devices:"), false ) ) MiniWorkflow.SetContents( Greasemonkey.Transform(contents), MiniWorkflowStepResizeVolumeHelptext() ) MiniWorkflow.SetLastStep(true) = nil begin = MiniWorkflow.UserInput DevicesSelectionBox.Handle() case when :next pvs_new = Builtins.maplist(DevicesSelectionBox.GetSelectedDevices) do |pv| Ops.get_string(pv, "device", "") end if !CheckNumberOfDevicesForVolume(Builtins.size(pvs_new)) = :again end # TODO: overall size check end end until == :abort || == :back || == :next if == :next Ops.set(data.value, "devices_new", pvs_new) = :finish end Builtins.y2milestone( "MiniWorkflowStepResizeVg data:%1 ret:%2", data.value, ) end |
- (Object) MiniWorkflowStepResizeVolumeHelptext
171 172 173 174 175 176 177 178 |
# File '../../src/include/partitioning/ep-btrfs-dialogs.rb', line 171 def MiniWorkflowStepResizeVolumeHelptext # helptext helptext = _( "<p>Change the devices that are used by the Btrfs volume.</p>" ) helptext end |