[PATCH 04/13] Correct handling of disks with hidden formats. (#866519)

David Lehman dlehman at redhat.com
Thu Nov 1 22:55:07 UTC 2012


We have to ignore disks with hidden formats for most purposes. Examples
of such disks are multipath member disks and fwraid member disks.
---
 pyanaconda/kickstart.py             |    5 +++--
 pyanaconda/ui/gui/spokes/storage.py |   18 ++++++++++++++----
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index 04578e9..2600c65 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -300,7 +300,8 @@ class Bootloader(commands.bootloader.F18_Bootloader):
             storage.bootloader.timeout = self.timeout
 
         # Throw out drives specified that don't exist.
-        disk_names = [d.name for d in storage.disks]
+        disk_names = [d.name for d in storage.disks
+                                if not d.format.hidden and not d.protected]
         for drive in self.driveorder[:]:
             if drive not in disk_names:
                 log.warning("requested drive %s in boot drive order doesn't exist" % drive)
@@ -1596,7 +1597,7 @@ def runTracebackScripts(scripts):
 def doKickstartStorage(storage, ksdata, instClass):
     """ Setup storage state from the kickstart data """
     ksdata.clearpart.execute(storage, ksdata, instClass)
-    if not storage.disks:
+    if not [d for d in storage.disks if not d.format.hidden]:
         return
     ksdata.bootloader.execute(storage, ksdata, instClass)
     ksdata.autopart.execute(storage, ksdata, instClass)
diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index 1eb62ef..421a0ee 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -330,9 +330,16 @@ class StorageSpoke(NormalSpoke, StorageChecker):
 
         self._previous_autopart = False
 
+    def _applyDiskSelection(self, use_names):
+        onlyuse = use_names[:]
+        for disk in [d for d in self.storage.disks if d.name in onlyuse]:
+            onlyuse.extend([d for d in disk.ancestors if d.name not in onlyuse])
+
+        self.data.ignoredisk.onlyuse = onlyuse
+        self.data.clearpart.drives = use_names[:]
+
     def apply(self):
-        self.data.ignoredisk.onlyuse = self.selected_disks[:]
-        self.data.clearpart.drives = self.selected_disks[:]
+        self._applyDiskSelection(self.selected_disks)
         self.data.autopart.autopart = self.autopart
         self.data.autopart.encrypted = self.encrypted
         self.data.autopart.passphrase = self.passphrase
@@ -442,7 +449,10 @@ class StorageSpoke(NormalSpoke, StorageChecker):
 
     def refresh(self):
         # synchronize our local data store with the global ksdata
-        self.selected_disks = self.data.ignoredisk.onlyuse[:]
+        disk_names = [d.name for d in self.disks]
+        # don't put disks with hidden formats in selected_disks
+        self.selected_disks = [d for d in self.data.ignoredisk.onlyuse
+                                    if d in disk_names]
         self.autopart = self.data.autopart.autopart
         self.encrypted = self.data.autopart.encrypted
         self.passphrase = self.data.autopart.passphrase
@@ -492,7 +502,7 @@ class StorageSpoke(NormalSpoke, StorageChecker):
 
         # if there's only one disk, select it by default
         if len(self.disks) == 1 and not self.selected_disks:
-            self.data.ignoredisk.onlyuse = [self.disks[0].name]
+            self._applyDiskSelection([self.disks[0].name])
 
         # properties: kind, description, capacity, os, popup-info
         for disk in self.disks:
-- 
1.7.7.6



More information about the anaconda-patches mailing list