[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[master 2/2] Do not auto-check all drives when creating a RAID partition (#641910).



The patch modifies parameter lists of createAllowedDrivesStore() and
createAllowedDrivesList() into what I think makes more sense (the old
selectDrives always ended up being True).
---
 pyanaconda/iw/partition_dialog_gui.py     |    7 ++++++-
 pyanaconda/iw/partition_ui_helpers_gui.py |   24 ++++++++++--------------
 2 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/pyanaconda/iw/partition_dialog_gui.py b/pyanaconda/iw/partition_dialog_gui.py
index 723fbee..26abd02 100644
--- a/pyanaconda/iw/partition_dialog_gui.py
+++ b/pyanaconda/iw/partition_dialog_gui.py
@@ -457,9 +457,14 @@ class PartitionEditor:
             maintable.attach(lbl, 0, 1, row, row + 1)
 
             req_disk_names = [d.name for d in self.origrequest.req_disks]
+            preselectAll = True
+            if restrictfs and 'mdmember' in restrictfs:
+                # do not preselect all available drives for new raid partitions
+                preselectAll = False
             self.driveview = createAllowedDrivesList(self.storage.partitioned,
                                                      req_disk_names,
-                                                     disallowDrives=[self.anaconda.updateSrc])
+                                                     disallowDrives=[self.anaconda.updateSrc],
+                                                     preselectAll=preselectAll)
             lbl.set_mnemonic_widget(self.driveview)
             sw = gtk.ScrolledWindow()
             sw.add(self.driveview)
diff --git a/pyanaconda/iw/partition_ui_helpers_gui.py b/pyanaconda/iw/partition_ui_helpers_gui.py
index 4b88347..fa8d20e 100644
--- a/pyanaconda/iw/partition_ui_helpers_gui.py
+++ b/pyanaconda/iw/partition_ui_helpers_gui.py
@@ -140,19 +140,17 @@ def fstypechangeCB(widget, mountCombo):
     fstype = widget.get_active_value()
     setMntPtComboStateFromType(fstype, mountCombo)
 
-def createAllowedDrivesStore(disks, reqdrives, drivelist, selectDrives=True,
-                             disallowDrives=[]):
+def createAllowedDrivesStore(disks, reqdrives, drivelist, disallowDrives,
+                             preselectAll):
     drivelist.clear()
     for disk in disks:
         selected = 0
 
-        if selectDrives:
-            if reqdrives:
-                if disk.name in reqdrives:
-                    selected = 1
-            else:
-                if disk.name not in disallowDrives:
-                    selected = 1
+        if reqdrives:
+            if disk.name in reqdrives:
+                selected = 1
+        elif preselectAll and (disk.name not in disallowDrives):
+                selected = 1
 
         sizestr = "%8.0f MB" % disk.size
         drivelist.append_row((disk.name,
@@ -165,7 +163,7 @@ def createAllowedDrivesStore(disks, reqdrives, drivelist, selectDrives=True,
     else:
         drivelist.set_sensitive(True)
 
-def createAllowedDrivesList(disks, reqdrives, selectDrives=True, disallowDrives=[]):
+def createAllowedDrivesList(disks, reqdrives, disallowDrives, preselectAll):
     store = gtk.TreeStore(gobject.TYPE_BOOLEAN,
                           gobject.TYPE_STRING,
                           gobject.TYPE_STRING,
@@ -174,12 +172,10 @@ def createAllowedDrivesList(disks, reqdrives, selectDrives=True, disallowDrives=
     columns = ['Drive', 'Size', 'Model']
     drivelist = WideCheckList(columns, store, sensitivity=True)
     drivelist.set_headers_visible(True)
-    createAllowedDrivesStore(disks, reqdrives, drivelist, selectDrives=selectDrives,
-                             disallowDrives=disallowDrives)
+    createAllowedDrivesStore(disks, reqdrives, drivelist, disallowDrives,
+                             preselectAll)
 
     return drivelist
-    
-    
 
 # pass in callback for when fs changes because of python scope issues
 def createFSTypeMenu(format, fstypechangeCB, mountCombo,
-- 
1.7.3.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]