[PATCH] Multipath, fwraid members need not be in exclusiveDisks. (#1032919)

David Lehman dlehman at redhat.com
Fri Jan 17 20:49:24 UTC 2014


On Fri, 2014-01-17 at 14:48 -0500, Chris Lumens wrote:
> > diff --git a/blivet/devicetree.py b/blivet/devicetree.py
> > index 4997515..45a7f27 100644
> > --- a/blivet/devicetree.py
> > +++ b/blivet/devicetree.py
> > @@ -1084,6 +1084,15 @@ class DeviceTree(object):
> >                  for parent in device.parents:
> >                      parent.protected = True
> >  
> > +        # If we just added a multipath or fwraid disk that is in exclusiveDisks
> > +        # we have to make sure all of its members are in the list too.
> > +        mdclasses = (DMRaidArrayDevice, MDRaidArrayDevice, MultipathDevice)
> > +        if device.isDisk and isinstance(device, mdclasses):
> > +            if device.name in self.exclusiveDisks:
> > +                for parent in device.parents:
> > +                    if parent.name not in self.exclusiveDisks:
> > +                        self.exclusiveDisks.append(parent.name)
> > +
> >          # Don't try to do format handling on drives without media or
> >          # if we didn't end up with a device somehow.
> >          if not device or not device.mediaPresent:
> 
> My stairstep alarm is going off here.  I think condensing this down into
> fewer lines might look less intimidating:
> 
>     if device.isDisk and isinstance(device, mdclasses) and device.name in self.exclusiveDisks:
>         for parent in [p for p in device.parents if p.name not in exclusiveDisks]:
>             self.exclusiveDisks.append(parent.name)
> 
> Hm, maybe that's not less clear.

I already pushed it.

I did consider combining the first two if statements, but I did not give
any thought to the list comprehension piece.

> 
> - Chris
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches




More information about the anaconda-patches mailing list