All except for patch 5 are for f18-beta-branch as well as master.
Related: rhbz#873445 --- pyanaconda/storage/__init__.py | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/pyanaconda/storage/__init__.py b/pyanaconda/storage/__init__.py index d3b334c..6deff9f 100644 --- a/pyanaconda/storage/__init__.py +++ b/pyanaconda/storage/__init__.py @@ -3297,6 +3297,8 @@ class LVMFactory(DeviceFactory): new_container_attr = "newVG" new_device_attr = "newLV" container_list_attr = "vgs" + encrypt_members = True + encrypt_leaves = False
@property def device_size(self):
At some point we'll want the same support for managing encrytion of leaf devices, but for now that's handled by the custom spoke. --- pyanaconda/storage/__init__.py | 25 ++++++++++++++++++++++--- 1 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/pyanaconda/storage/__init__.py b/pyanaconda/storage/__init__.py index 6deff9f..59247de 100644 --- a/pyanaconda/storage/__init__.py +++ b/pyanaconda/storage/__init__.py @@ -1812,12 +1812,29 @@ class Storage(object): # prepare already-defined member partitions for reallocation for member in members[:]: if isinstance(member, LUKSDevice): - if member.slave.disk in remove_disks: + if member.slave.disk in remove_disks or not factory.encrypted: container.removeMember(member) self.destroyDevice(member) members.remove(member) + if not factory.encrypted: + # encryption was toggled for the member devices + self.formatDevice(member.slave, + getFormat(factory.member_format)) + members.append(member.slave) + container.addMember(member.slave)
member = member.slave + elif factory.encrypted: + # encryption was toggled for the member devices + container.removeMember(member) + members.remove(member) + self.formatDevice(member, getFormat("luks")) + member = LUKSDevice("luks-%s" % member.name, + parents=[member], + format=getFormat(factory.member_format)) + self.createDevice(member) + members.append(member) + container.addMember(member)
if member.disk in remove_disks: if member in container.parents: @@ -2066,8 +2083,10 @@ class Storage(object): # this will set the device's size if a device is passed in size = factory.set_device_size(container, device=device) if device: - # We are adjusting the size of a device. The StorageDevice instance - # exists, but the underlying device does not. + # We are adjusting a defined device: size, disk set, encryption, + # raid level, fstype. The StorageDevice instance exists, but the + # underlying device does not. + # TODO: handle toggling of encryption for leaf device e = None try: factory.post_create()
Don't even allow toggling of encryption for existing devices that have their encryption applied at some lower level (eg: what our autopart produces).
If the encryption is applied to container members (lvm, btrfs), let Storage.setContainerMembers handle the changes. If toggling encryption for an existing device or for any device for which we apply encryption to the leaves (md, partition), handle the change of state directly in _save_right_side. --- pyanaconda/ui/gui/spokes/custom.py | 70 ++++++++++++++++++++++-------------- 1 files changed, 43 insertions(+), 27 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py index 6f00864..d4bb0a4 100644 --- a/pyanaconda/ui/gui/spokes/custom.py +++ b/pyanaconda/ui/gui/spokes/custom.py @@ -965,6 +965,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): if encryption_checkbox.get_sensitive(): encrypted = encryption_checkbox.get_active()
+ changed_encryption = (prev_encrypted != encrypted) log.debug("new encryption setting: %s" % encrypted)
label_entry = self.builder.get_object("labelEntry") @@ -1160,7 +1161,9 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): ## # new size means resize for existing devices and adjust for new ones changed_size = (int(size) != int(device.size)) - if changed_size or changed_disk_set: + if changed_size or changed_disk_set or \ + (changed_encryption and factory.encrypt_members and + not device.exists): self.clear_errors() old_size = device.size if changed_size and device.exists and device.resizable: @@ -1190,6 +1193,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): self.__storage.newDevice(device_type, size, device=device, disks=self._device_disks[:], + encrypted=encrypted, raid_level=raid_level) except ErrorRecoveryFailure as e: self._error = e @@ -1221,34 +1225,39 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): ## ## ENCRYPTION ## + + # for existing devices, we always encrypt the leaf old_fs_type = device.format.type old_device = device - if prev_encrypted and not encrypted: - log.info("removing encryption from %s" % device.name) - with ui_storage_logger(): - self.__storage.destroyDevice(device) - self._devices.remove(device) - old_device = device - device = device.slave - selector._device = device - for s in self._accordion.allSelectors: - if s._device == old_device: - s._device = device - elif encrypted and not prev_encrypted: - log.info("applying encryption to %s" % device.name) - with ui_storage_logger(): - old_device = device - new_fmt = getFormat("luks", device=device.path) - self.__storage.formatDevice(device, new_fmt) - luks_dev = LUKSDevice("luks-" + device.name, - parents=[device]) - self.__storage.createDevice(luks_dev) - self._devices.append(luks_dev) - device = luks_dev - selector._device = device - for s in self._accordion.allSelectors: - if s._device == old_device: - s._device = device + + # if the encryption is on member devices it was handled above + if device.exists or factory.encrypt_leaves: + if prev_encrypted and not encrypted: + log.info("removing encryption from %s" % device.name) + with ui_storage_logger(): + self.__storage.destroyDevice(device) + self._devices.remove(device) + old_device = device + device = device.slave + selector._device = device + for s in self._accordion.allSelectors: + if s._device == old_device: + s._device = device + elif encrypted and not prev_encrypted: + log.info("applying encryption to %s" % device.name) + with ui_storage_logger(): + old_device = device + new_fmt = getFormat("luks", device=device.path) + self.__storage.formatDevice(device, new_fmt) + luks_dev = LUKSDevice("luks-" + device.name, + parents=[device]) + self.__storage.createDevice(luks_dev) + self._devices.append(luks_dev) + device = luks_dev + selector._device = device + for s in self._accordion.allSelectors: + if s._device == old_device: + s._device = device
## ## FORMATTING @@ -1298,9 +1307,11 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): new_selector.props.mountpoint = mountpoint or "" new_selector.props.name = (self._mountpointName(mountpoint) or device.format.name) + new_selector._device = device else: self.add_new_selector(device)
+ self._populate_right_side(selector) return
## @@ -1546,8 +1557,13 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
reformatCheckbox.set_active(not device.format.exists) reformatCheckbox.set_sensitive(use_dev.exists) + encryptCheckbox.set_active(device.encrypted) encryptCheckbox.set_sensitive(reformatCheckbox.get_active()) + if device.encrypted and device.exists: + # For existing devices, the encryption checkbutton should not be + # sensitive if the encryption is below the leaf layer. + encryptCheckbox.set_sensitive(use_dev.format.type == "luks")
## ## Set up the filesystem type combo.
--- pyanaconda/ui/gui/spokes/storage.py | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py index 23b97fc..b4fb1aa 100644 --- a/pyanaconda/ui/gui/spokes/storage.py +++ b/pyanaconda/ui/gui/spokes/storage.py @@ -347,7 +347,8 @@ class StorageSpoke(NormalSpoke, StorageChecker): 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]) + onlyuse.extend([d.name for d in disk.ancestors + if d.name not in onlyuse])
self.data.ignoredisk.onlyuse = onlyuse self.data.clearpart.drives = use_names[:]
Only include the swap request size in the case where we're about to tell them they can run autopart in the existing free space, since that's the main place it can be a surprise to find that you do not actually have space for the selected software.
For the bug referenced below we still need to redo the space check each time a new software selection is applied.
Related: rhbz#853636 --- pyanaconda/ui/gui/spokes/storage.py | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py index b4fb1aa..0296242 100644 --- a/pyanaconda/ui/gui/spokes/storage.py +++ b/pyanaconda/ui/gui/spokes/storage.py @@ -663,10 +663,14 @@ class StorageSpoke(NormalSpoke, StorageChecker): fs_free = sum([f[1] for f in free_space.itervalues()])
required_space = self.payload.spaceRequired - log.debug("disk free: %s fs free: %s sw needs: %s" % (disk_free, - fs_free, - required_space)) - if disk_free >= required_space: + auto_swap = Size(bytes=0) + for autoreq in self.storage.autoPartitionRequests: + if autoreq.fstype == "swap": + auto_swap += Size(spec="%d MB" % autoreq.size) + + log.debug("disk free: %s fs free: %s sw needs: %s auto swap: %s" + % (disk_free, fs_free, required_space, auto_swap)) + if disk_free >= required_space + auto_swap: dialog = InstallOptions1Dialog(self.data) elif disks_size >= required_space: dialog = InstallOptions2Dialog(self.data, payload=self.payload)
anaconda-patches@lists.fedorahosted.org