These were turned up in the course of writing unit tests for `DeviceFactory` (PR forthcoming).
From: David Lehman dlehman@redhat.com
We adjusted the amount of disk space needed, but we didn't alter the planned device size. --- blivet/devicefactory.py | 7 ------- 1 file changed, 7 deletions(-)
diff --git a/blivet/devicefactory.py b/blivet/devicefactory.py index 2096800..cd87194 100644 --- a/blivet/devicefactory.py +++ b/blivet/devicefactory.py @@ -1306,13 +1306,6 @@ def _get_child_factory_kwargs(self):
def _get_new_device(self, *args, **kwargs): """ Create and return the factory device as a StorageDevice. """ - - if self.container_raid_level and self.container_size in [SIZE_POLICY_AUTO, - SIZE_POLICY_MAX]: - # container pushed to the limit, but we need some extra space for - # metadata, so we need to make the LV smaller - extra_md_space = lvm.LVM_PE_SIZE * len(self.disks) * 5 - kwargs["size"] -= extra_md_space return self.storage.newLV(*args, **kwargs)
def _set_name(self):
From: David Lehman dlehman@redhat.com
We need the member we're removing to be a leaf device before we can destroy it, so we have to remove it from the container first. --- blivet/devicefactory.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/blivet/devicefactory.py b/blivet/devicefactory.py index cd87194..d522def 100644 --- a/blivet/devicefactory.py +++ b/blivet/devicefactory.py @@ -735,11 +735,13 @@ def _set_encryption(self): orig_device = self.device raw_device = self.raw_device leaf_format = self.device.format + if parent_container: + parent_container.parents.remove(orig_device) self.storage.destroyDevice(self.device) self.storage.formatDevice(self.raw_device, leaf_format) self.device = raw_device if parent_container: - parent_container.parents.replace(orig_device, self.device) + parent_container.parents.append(self.device) elif self.encrypted and not isinstance(self.device, LUKSDevice): orig_device = self.device leaf_format = self.device.format
From: David Lehman dlehman@redhat.com
--- blivet/devicefactory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/blivet/devicefactory.py b/blivet/devicefactory.py index d522def..2be78da 100644 --- a/blivet/devicefactory.py +++ b/blivet/devicefactory.py @@ -1630,7 +1630,7 @@ def _get_total_space(self):
def _set_raid_level(self): # set the new level - self.device.level = self.raid_level + self.raw_device.level = self.raid_level
# adjust the bitmap setting
From: David Lehman dlehman@redhat.com
--- blivet/devices/lib.py | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/blivet/devices/lib.py b/blivet/devices/lib.py index 5faada5..f760c89 100644 --- a/blivet/devices/lib.py +++ b/blivet/devices/lib.py @@ -169,12 +169,19 @@ def replace(self, x, y):
.. note::
+ This method does update the child counts for the two devices. + + .. note:: + It is usually a bad idea to bypass the callbacks. This is intended for specific circumstances like toggling encryption of container member devices in the devicefactory classes. + """ if x not in self.items: raise ValueError("item to be replaced is not in the list")
idx = self.items.index(x) self.items[idx] = y + x.removeChild() + y.addChild()
Looks good to me now.
Added label: ACK.
Closed.
anaconda-patches@lists.fedorahosted.org