See https://bugzilla.redhat.com/show_bug.cgi?id=1212841
Currently is not possible to add new partitions to disk with an existing LVM VG. 'findActiveDevicesOnActionDisks' should disallow only actions involving changes on the disklabel not adding new partitions.
From: Vojtech Trefny vtrefny@redhat.com
LVMPhysicalVolume format should be True (active) if exists and if has an existing VG.
Signed-off-by: Vojtech Trefny vtrefny@redhat.com --- blivet/formats/lvmpv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/blivet/formats/lvmpv.py b/blivet/formats/lvmpv.py index 3c9e5c0..346083c 100644 --- a/blivet/formats/lvmpv.py +++ b/blivet/formats/lvmpv.py @@ -125,7 +125,7 @@ def _destroy(self, **kwargs): def status(self): # XXX hack return (self.exists and self.vgName and - os.path.isdir("/dev/mapper/%s" % self.vgName)) + os.path.isdir("/dev/%s" % self.vgName))
register_device_format(LVMPhysicalVolume)
From: Vojtech Trefny vtrefny@redhat.com
Parted doesn't allow changing disklabel when there is an active partition on the disk. Current implementation of findActiveDevicesOnActionDisks doesn't allow adding new partitions when there is an existing active (child) device other than another partition (eg. VG). New version checks only actions that actually changes the disklabel and checks status of formats of (child) devices on the disk with changes.
Signed-off-by: Vojtech Trefny vtrefny@redhat.com --- blivet/actionlist.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/blivet/actionlist.py b/blivet/actionlist.py index be182c8..8613f44 100644 --- a/blivet/actionlist.py +++ b/blivet/actionlist.py @@ -247,18 +247,21 @@ def _findActiveDevicesOnActionDisks(self, devices=None): disks = [] for action in self._actions: disk = None - if action.isDevice and isinstance(action.device, PartitionDevice): - disk = action.device.disk - elif action.isFormat and action.format.type == "disklabel": + if action.isFormat and action.format.type == "disklabel": disk = action.device
if disk is not None and disk not in disks: disks.append(disk)
- active = (dev for dev in devices - if (dev.status and - (not dev.isDisk and - not isinstance(dev, PartitionDevice)))) + active = [] + for dev in devices: + if dev.status and not dev.isDisk and \ + not isinstance(dev, PartitionDevice): + active.append(dev) + + if dev.format.status and not dev.isDisk: + active.append(dev) + devices = [a.name for a in active if any(d in disks for d in a.disks)] return devices
In reply to line 262 of blivet/actionlist.py:
Looks good to me if you just make this last 'if' into an 'elif'. (We don't want duplicates in the list.)
New version. I've changed the check to include both active formats (except disks) and active devices (except partitions and disks). Unfortunately dwlehman's comment on this seems to be lost after force pushing the change.
Looks good to me too with the same comment about the ``if`` as @dwlehman has above.
Added label: ACK.
anaconda-patches@lists.fedorahosted.org