[rhel7-branch 1/1] Include LUKSDevice information in kickstart data (#1139222)

mulkieran installerbot-noreply at redhat.com
Thu Apr 16 17:14:11 UTC 2015


From: mulhern <amulhern at redhat.com>

Resolves: rhbz#1139222

Previously, if a device had a child that was a LUKS device that child was
ignored when generating ksdata. What this meant was that that device's
format, which was luks, was used in generating the kickstart data.

Now, the LUKSDevice, which contains the format that should appear in the ks
output is used. This means that the LUKS format is used to set some ks data,
but the mountpoint and so forth are overwritten with the correct values
when the format on the LUKSDevice is used to populate those values.

The --passphrase option with passphrase continues to not appear in the output
anaconda-ks.cfg file.

Signed-off-by: mulhern <amulhern at redhat.com>
---
 blivet/__init__.py | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/blivet/__init__.py b/blivet/__init__.py
index 42a37f6..f5ddf31 100644
--- a/blivet/__init__.py
+++ b/blivet/__init__.py
@@ -72,7 +72,7 @@ def cb(self, exn):
 
 from .storage_log import log_exception_info, log_method_call
 from .errors import DeviceError, DirtyFSError, FSResizeError, FSTabTypeMismatchError, LUKSDeviceWithoutKeyError, UnknownSourceDeviceError, SanityError, SanityWarning, StorageError, UnrecognizedFSTabEntryError
-from .devices import BTRFSDevice, BTRFSSubVolumeDevice, BTRFSVolumeDevice, DirectoryDevice, FileDevice, LVMLogicalVolumeDevice, LVMThinLogicalVolumeDevice, LVMThinPoolDevice, LVMVolumeGroupDevice, MDRaidArrayDevice, NetworkStorageDevice, NFSDevice, NoDevice, OpticalDevice, PartitionDevice, TmpFSDevice, devicePathToName
+from .devices import BTRFSDevice, BTRFSSubVolumeDevice, BTRFSVolumeDevice, DirectoryDevice, FileDevice, LUKSDevice, LVMLogicalVolumeDevice, LVMThinLogicalVolumeDevice, LVMThinPoolDevice, LVMVolumeGroupDevice, MDRaidArrayDevice, NetworkStorageDevice, NFSDevice, NoDevice, OpticalDevice, PartitionDevice, TmpFSDevice, devicePathToName
 from .devicetree import DeviceTree
 from .deviceaction import ActionCreateDevice, ActionCreateFormat, ActionDestroyDevice, ActionDestroyFormat, ActionResizeDevice, ActionResizeFormat
 from .formats import getFormat
@@ -2147,6 +2147,11 @@ def updateKSData(self):
         if self.doAutoPart:
             return
 
+        self._updateCustomStorageKSData()
+
+    def _updateCustomStorageKSData(self):
+        """ Update KSData for custom storage. """
+
         # custom storage
         ksMap = {PartitionDevice: ("PartData", "partition"),
                  TmpFSDevice: ("PartData", "partition"),
@@ -2158,6 +2163,9 @@ def updateKSData(self):
         # make a list of ancestors of all used devices
         devices = list(set(a for d in list(self.mountpoints.values()) + self.swaps
                                 for a in d.ancestors))
+
+        luks_devices = [d for d in devices if isinstance(d, LUKSDevice)]
+
         devices.sort(key=lambda d: len(d.ancestors))
         for device in devices:
             cls = next((c for c in ksMap if isinstance(device, c)), None)
@@ -2170,6 +2178,10 @@ def updateKSData(self):
             cls = getattr(self.ksdata, class_attr)
             data = cls()    # all defaults
 
+            # if this is the child of a LUKSDevice, use that device instead
+            device = \
+               next((d for d in luks_devices if d.slave is device), device)
+
             device.populateKSData(data)
 
             parent = getattr(self.ksdata, list_attr)


-- 
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/aece9b8a53b9bdc25abbc1c5c0280eb29ee0e830


More information about the anaconda-patches mailing list