From: Vratislav Podzimek vpodzime@redhat.com
We need that information in order to do checks when adding more LVs and users need this information to decide about where to place their LVs.
Let's not bother with existing LVs allocations for now. We can just ignore those and only care about newly added (non-existing) LVs which we need to place somewhere. --- blivet/devices/lvm.py | 7 ++++--- blivet/populator.py | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/blivet/devices/lvm.py b/blivet/devices/lvm.py index 4cc39e2..9a75635 100644 --- a/blivet/devices/lvm.py +++ b/blivet/devices/lvm.py @@ -312,7 +312,7 @@ def _add_log_vol(self, lv):
# PV space accounting pv_sizes = lv.pv_space_used - if pv_sizes: + if not lv.exists and pv_sizes: for size_spec in pv_sizes: # check that we have enough space in the PVs for the LV and # account for it @@ -335,7 +335,7 @@ def _remove_log_vol(self, lv):
# PV space accounting pv_sizes = lv.pv_space_used - if pv_sizes: + if not lv.exists and pv_sizes: for size_spec in pv_sizes: size_spec.pv.format.free += size_spec.size
@@ -348,7 +348,8 @@ def _add_parent(self, member):
# this PV object is just being added so it has all its space available # (adding LVs will eat that space later) - member.format.free = self._get_pv_usable_space(member) + if not member.format.exists: + member.format.free = self._get_pv_usable_space(member)
def _remove_parent(self, member): # XXX It would be nice to raise an exception if removing this member diff --git a/blivet/populator.py b/blivet/populator.py index 7d28a10..0adc0e6 100644 --- a/blivet/populator.py +++ b/blivet/populator.py @@ -1427,6 +1427,8 @@ def handle_udev_device_format(self, info, device): kwargs["pe_start"] = Size(pv_info.pe_start) else: log.warning("PV %s has no pe_start", name) + if pv_info.pv_free: + kwargs["free"] = Size(pv_info.pv_free) elif format_type == "vfat": # efi magic if isinstance(device, PartitionDevice) and device.bootable:
anaconda-patches@lists.fedorahosted.org