[PATCH] Remove all dependent devices of san device becoming multipath (#1058939)
Vratislav Podzimek
vpodzime at redhat.com
Thu Jan 30 11:01:05 UTC 2014
On Thu, 2014-01-30 at 11:27 +0100, Radek Vykydal wrote:
> Also change the format to multipath after the devices are removed,
> not before.
> This should fix also bug #1058681.
>
> I am starting to wonder whether we can really manage populate after adding
> new san device (iSCSI, FCoE, zFCP) in GUI making a device already in tree
> multipath member - without resetting storage.
>
> Resolves: rhbz#1058939
> ---
> blivet/devicetree.py | 15 +++++++++++++--
> 1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/blivet/devicetree.py b/blivet/devicetree.py
> index 5f7832b..8a79f14 100644
> --- a/blivet/devicetree.py
> +++ b/blivet/devicetree.py
> @@ -332,6 +332,17 @@ class DeviceTree(object):
> # Do we care about garbage collection? At all?
> parent.removeChild()
>
> + def _removeChildrenFromTree(self, device):
> + devs_to_remove = self.getDependentDevices(device)
> + while devs_to_remove:
> + leaves = [d for d in devs_to_remove if d.isleaf]
This could be generator.
> + for leaf in leaves:
> + self._removeDevice(leaf, moddisk=False)
> + devs_to_remove.remove(leaf)
> + if len(devs_to_remove) == 1 and devs_to_remove[0].isExtended:
> + self._removeDevice(devs_to_remove[0], force=True, moddisk=False)
> + break
> +
> def registerAction(self, action):
> """ Register an action to be performed at a later time.
>
> @@ -1023,9 +1034,9 @@ class DeviceTree(object):
> # newly added device (eg iSCSI) could make this one a multipath member
> if device.format and device.format.type != "multipath_member":
> log.debug("%s newly detected as multipath member, dropping old format and removing kids" % device.name)
> + # remove children from tree so that we don't stumble upon them later
> + self._removeChildrenFromTree(device)
> device.format = formats.DeviceFormat()
> - for d in self.getChildren(device):
> - self._removeDevice(d, moddisk=False)
>
> #
> # The first step is to either look up or create the device
Otherwise this looks good to me.
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list