Hi Virt-manager gets the information of the shared physical network device only at the time of start. Therefore, "Not bridged" is displayed on the screen, even if the physical network device is bridged while virt-manager is working. (ex: # /etc/xen/scripts/network-bridge start bridge=xenbr1 vifnum=1 netdev=eth1) This patch fixes it by checking the state of the physical device regularly. Signed-off-by: Masayuki Sunou <fj1826dm@xxxxxxxxxxxxxxxxx> Thanks, Masayuki Sunou. ---------------------------------------------------------------------- diff -r 8bd1b2ab7296 src/virtManager/connection.py --- a/src/virtManager/connection.py Sun Jul 15 17:02:52 2007 -0400 +++ b/src/virtManager/connection.py Thu Jul 26 11:27:41 2007 +0900 @@ -113,41 +113,45 @@ class vmmConnection(gobject.GObject): def _device_added(self, path): obj = self.bus.get_object("org.freedesktop.Hal", path) if obj.QueryCapability("net"): - if not self.netdevs.has_key(path): - name = obj.GetPropertyString("net.interface") - mac = obj.GetPropertyString("net.address") - - # Now magic to determine if the device is part of a bridge - shared = False - bridge = None - try: - # XXX Linux specific - needs porting for other OS - patches - # welcomed... - sysfspath = obj.GetPropertyString("linux.sysfs_path") - - # Sick, disgusting hack for Xen netloop crack which renames - # ethN -> pethN, but which HAL never sees - psysfspath = sysfspath[0:len(sysfspath)-len(name)] + "p" + name - if os.path.exists(psysfspath): - sysfspath = psysfspath - - brportpath = os.path.join(sysfspath, "brport") - - if os.path.exists(brportpath): - shared = True - brlinkpath = os.path.join(brportpath, "bridge") - dest = os.readlink(brlinkpath) - (head,tail) = os.path.split(dest) - bridge = tail - except: - (type, value, stacktrace) = sys.exc_info () - logging.error("Unable to determine if device is shared:" + - str(type) + " " + str(value) + "\n" + \ - traceback.format_exc (stacktrace)) - - dev = vmmNetDevice(self.config, self, name, mac, shared, bridge) - self.netdevs[path] = dev - self.emit("netdev-added", dev.get_name()) + name = obj.GetPropertyString("net.interface") + mac = obj.GetPropertyString("net.address") + + # Now magic to determine if the device is part of a bridge + shared = False + bridge = None + try: + # XXX Linux specific - needs porting for other OS - patches + # welcomed... + sysfspath = obj.GetPropertyString("linux.sysfs_path") + + # Sick, disgusting hack for Xen netloop crack which renames + # ethN -> pethN, but which HAL never sees + psysfspath = sysfspath[0:len(sysfspath)-len(name)] + "p" + name + if os.path.exists(psysfspath): + sysfspath = psysfspath + + brportpath = os.path.join(sysfspath, "brport") + + if os.path.exists(brportpath): + shared = True + brlinkpath = os.path.join(brportpath, "bridge") + dest = os.readlink(brlinkpath) + (head,tail) = os.path.split(dest) + bridge = tail + except: + (type, value, stacktrace) = sys.exc_info () + logging.error("Unable to determine if device is shared:" + + str(type) + " " + str(value) + "\n" + \ + traceback.format_exc (stacktrace)) + + if self.netdevs.has_key(path): + currDev = self.netdevs[path] + if currDev.get_info() == (name, mac, shared, bridge): + return + del self.netdevs[path] + dev = vmmNetDevice(self.config, self, name, mac, shared, bridge) + self.netdevs[path] = dev + self.emit("netdev-added", dev.get_name()) def _device_removed(self, path): if self.netdevs.has_key(path): @@ -321,6 +325,11 @@ class vmmConnection(gobject.GObject): newInactiveNetNames = self.vmm.listDefinedNetworks() except: logging.warn("Unable to list inactive networks") + + # check of net devices + newPaths = self.hal_iface.FindDeviceByCapability("net") + for newPath in newPaths: + self._device_added(newPath) for name in newActiveNetNames: net = self.vmm.networkLookupByName(name) diff -r 8bd1b2ab7296 src/virtManager/netdev.py --- a/src/virtManager/netdev.py Sun Jul 15 17:02:52 2007 -0400 +++ b/src/virtManager/netdev.py Thu Jul 26 10:36:39 2007 +0900 @@ -45,4 +45,7 @@ class vmmNetDevice(gobject.GObject): def get_mac(self): return self.mac + def get_info(self): + return (self.name, self.mac, self.shared, self.bridge) + gobject.type_register(vmmNetDevice) ---------------------------------------------------------------------- _______________________________________________ et-mgmt-tools mailing list et-mgmt-tools@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/et-mgmt-tools