Re: [PATCH rhel6-branch 2/7] iscsi: add iface binding support to iscsi device class (nic) (#500273)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 28, 2012 at 08:46:23PM +0100, Radek Vykydal wrote:
> On 02/28/2012 07:39 PM, David Cantrell wrote:
> >Ack, with comments.
> >
> >On Tue, Feb 28, 2012 at 12:03:29PM +0100, Radek Vykydal wrote:
> >>-
> >>-    def usedByISCSI(self, anaconda):
> >>-        import storage
> >>-        for d in anaconda.id.storage.devices:
> >>-            if (isinstance(d, storage.devices.NetworkStorageDevice) and
> >>-                d.host_address):
> >>-                if self.iface == ifaceForHostIP(d.host_address):
> >>-                    return True
> >>+                if d.nic:
> >>+                    if self.iface == d.nic:
> >>+                        return True
> >This could be reduced to:
> >
> >     if d.nic and self.iface == d.nic:
> >         return True
> 
> You may have overlooked that the block is in a loop,
> so the behaviour for:
> 
> bool(d.nic) = True
> self.iface != d.nic
> self.iface == ifaceForHostIP(d.host_address)
> 
> from doing next cycle to returning True
> 
> 
> >>+                else:
> >>+                    if self.iface == ifaceForHostIP(d.host_address):
> >>+                        return True
> >These could just be merged to an elif line.
> 
> sure, I found it expressing what it should represent more
> clearly this way, perhaps this would be more clear:
> 
>                 # device bound to interface
>                 if d.nic:
>                     if self.iface == d.nic:
>                         return True
>                 # device using default interface
>                 else:
>                     if self.iface == ifaceForHostIP(d.host_address):
>                         return True
> 

I did note that the block was in a loop, I was just seeing obvious test
reductions.  But I think I understand what you were going for now, so it's
fine by me.  Ack.

-- 
David Cantrell <dcantrell@xxxxxxxxxx>
Supervisor, Installer Engineering Team
Red Hat, Inc. | Westford, MA | EST5EDT

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux