[rhel7 1/2] Block leaf device encryption if container is encrypted consistently

Brian C. Lane bcl at redhat.com
Thu Aug 14 00:03:13 UTC 2014


From: Vratislav Podzimek <vpodzime at redhat.com>

After every change to the container, we should change and block leaf device
encryption based on the current container's encryption state.

Cherry-picked and squshed commits df4f4d46cf and 9faf3b5112)

Related: rhbz#1076171

Signed-off-by: Brian C. Lane <bcl at redhat.com>
---
 pyanaconda/ui/gui/spokes/custom.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index 21dce4b..6b149d3 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -2394,6 +2394,15 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
         self._device_disks = disks
         self._populate_raid(self._get_raid_level())
 
+    def _container_encryption_change(self, old_encrypted, new_encrypted):
+        if not old_encrypted and new_encrypted:
+            # container set to be encrypted, we should make sure the leaf device
+            # is not encrypted and make the encryption checkbox insensitive
+            self._encryptCheckbox.set_active(False)
+            fancy_set_sensitive(self._encryptCheckbox, False)
+        elif old_encrypted and not new_encrypted:
+            fancy_set_sensitive(self._encryptCheckbox, True)
+
     def run_container_editor(self, container=None, name=None):
         size = 0
         size_policy = self._device_container_size
@@ -2454,6 +2463,9 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
         log.debug("new container encrypted: %s", dialog.encrypted)
         log.debug("new container size: %s", dialog.size_policy)
 
+        if dialog.encrypted:
+            self._container_encryption_change(self._device_container_encrypted,
+                                              dialog.encrypted)
         self._device_disks = disks
         self._device_container_name = name
         self._device_container_raid_level = dialog.raid_level
-- 
1.9.3



More information about the anaconda-patches mailing list