According to this http://monaco.sfbay.sun.com/detail.jsf?cr=6904372
There is a while TRUE loop to parse for the ether of a network interface 
and that can cause a looping if an alias is present. The fix is to 
remove the while TRUE loop.

The patch below does just that, use readlines() instead of readline().
Since the interface name is passed in, call ifconfig <interface> rather 
than ifconfig -a to avoid unncessary parsing.

-Ghee


$ svn diff patches/virt-manager-08-dladm-network.diff
Index: patches/virt-manager-08-dladm-network.diff
===================================================================
--- patches/virt-manager-08-dladm-network.diff    (revision 19976)
+++ patches/virt-manager-08-dladm-network.diff    (working copy)
@@ -1,7 +1,7 @@
-/jds/bin/diff -uprN 
virt-manager-0.6.1.old/src/virtManager/connection.py 
virt-manager-0.6.1/src/virtManager/connection.py
---- virt-manager-0.6.1.old/src/virtManager/connection.py    2009-01-26 
19:33:33.000000000 +0000
-+++ virt-manager-0.6.1/src/virtManager/connection.py    2009-04-03 
15:43:55.494587167 +0100
-@@ -30,6 +30,7 @@ import dbus
+diff -urN virt-manager-0.6.1/src/virtManager/connection.py 
../SUNWvirt-manager-0.6.1.hacked/virt-manager-0.6.1/src/virtManager/connection.py
+--- virt-manager-0.6.1/src/virtManager/connection.py    2009-01-26 
19:33:33.000000000 +0000
++++ 
../SUNWvirt-manager-0.6.1.hacked/virt-manager-0.6.1/src/virtManager/connection.py
    
2009-11-27 11:36:20.689660379 +0000
+@@ -30,6 +30,7 @@
  import threading
  import gtk
  import virtinst
@@ -9,7 +9,7 @@
 
  from virtManager.domain import vmmDomain
  from virtManager.network import vmmNetwork
-@@ -142,7 +143,12 @@ class vmmConnection(gobject.GObject):
+@@ -142,7 +143,12 @@
 
              # Find info about all current present physical net devices
              # This is OS portable...
@@ -23,7 +23,7 @@
                  self._net_phys_device_added(path)
          except:
              (_type, value, stacktrace) = sys.exc_info ()
-@@ -154,37 +160,33 @@ class vmmConnection(gobject.GObject):
+@@ -154,37 +160,23 @@
 
      def _net_phys_device_added(self, path):
          logging.debug("Got physical device %s" % path)
@@ -60,22 +60,12 @@
 +            bridge = name
 +
 +            # Parse ifconfig output for MAC address, and whether shared
-+            output=os.popen("/sbin/ifconfig -a")
-+            line = output.readline()
-+            while len(line) != 0 :
-+                if line[0] != ' ' and line[0] != '    ' :
-+                    if (re.search(name,line) != None) and 
(re.search("IPv4", line) !=None):
-+                        while True:
-+                            line = output.readline()
-+                            if re.search("ether", line) != None:
-+                                mac = line.split(' ')[1]
-+                                shared = True
-+                                line = output.readline()
-+                                break
-+                    else:
-+                        line = output.readline()
-+                else:
-+                    line = output.readline()
++            output=os.popen("/sbin/ifconfig %s" % name)
++            for line in output.readlines():
++                if "ether" in line:
++                    mac = line.split(' ')[1]
++                    shared = True
++                    break
 
              # Add the main NIC
 -            self._net_device_added(name, mac, sysfspath)
@@ -86,7 +76,7 @@
 
      def _net_tag_device_added(self, name, sysfspath):
          logging.debug("Checking for VLANs on %s" % sysfspath)
-@@ -205,15 +207,16 @@ class vmmConnection(gobject.GObject):
+@@ -205,15 +197,16 @@
                          vlanpath = pvlanpath
                      self._net_device_added(vlanname, vlanmac, vlanpath)
 

Reply via email to