Re: [PATCH rhel5-branch] Install and enable openibd service if IPoIB is used (#788871)

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

 



On 06/06/2012 06:54 PM, Brian C. Lane wrote:
On Wed, Jun 06, 2012 at 01:13:39PM +0200, Radek Vykydal wrote:
diff --git a/network.py b/network.py
index 4cdc294..b9b5d14 100644
--- a/network.py
+++ b/network.py
@@ -173,6 +173,9 @@ class NetworkDevice(SimpleConfigFile):
  	elif dev.startswith('iucv'):
  	    self.info["TYPE"] = "IUCV"

+    def isIPoIB(self):
+        return len(self.get('hwaddr')) == 59
+
This needs some protection from traceback, if hwaddr isn't available
len(None) will blow up. Maybe use this:

return len(self.get('hwaddr', "")) == 59


Here self is instance of NetworkDevice(SimpleConfigFile) whose get method
always returns string ("" if it doesn't find the key).

Also, is this really the best way to check for IPoIB? Seems fragile.


In rhel 6 we are using libnl to detect type of device in loader
and pass it to stage2 with TYPE in ifcfg files which doesn't fit
into rhel 5 much.
I asked Doug Ledford if using the hwaddr length is ok and
he was not against it, but then I noticed that in rhel6 we are also
reading the type from sysfs which is probably better.
I am sending v.2 of the patch using sysfs.


  class Network:
      def __init__(self):
  	self.firstnetdevice = None
@@ -443,6 +446,13 @@ class Network:
          return str


+    def hasActiveIPoIBDevice(self):
+        for device in self.netdevices.values():
+            if (device.get("onboot")
+                and device.isIPoIB()):
This would read nicer if the and was on the same line.


Agreed.

Radek

_______________________________________________
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