Skip to content

Commit

Permalink
Allow adding new partitions to disks with active devices
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
vojtechtrefny committed May 29, 2015
1 parent b9094ad commit 51f6ba9
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions blivet/devicetree.py
Expand Up @@ -329,18 +329,21 @@ def findActiveDevicesOnActionDisks(self):
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 self.devices
if (dev.status and
(not dev.isDisk and
not isinstance(dev, PartitionDevice))))
active = []
for dev in self.devices:
if dev.status and not dev.isDisk and \
not isinstance(dev, PartitionDevice):
active.append(dev)

elif 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

Expand Down

0 comments on commit 51f6ba9

Please sign in to comment.