All of lore.kernel.org
 help / color / mirror / Atom feed
* HVM vif without bridge
@ 2007-12-27 13:26 Samuel Thibault
  0 siblings, 0 replies; only message in thread
From: Samuel Thibault @ 2007-12-27 13:26 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 1080 bytes --]

Hello,

When using xen without a bridge but NAT or routing, HVM domains can't
boot, and qemu-dm-n.log contains:

config qemu network with xen bridge for  tap0 xenbr0
bridge xenbr0 does not exist!

That's because the qemu-ifup script always tries to add the vif to
a default-named xenbr0 bridge. On the contrary, PV domains just work
fine with the same configuration file except HVM parameters.

I can see several solutions:

- The attached "patch" just ignores brctl failure. Far from elegant, but
  works fine
- The attached "patch2" drops the default xenbr0 bridge, and then people
  have to set bridge=xenbr0 in their configuration file.
- move qemu-ifup into three bridge, nat and route scripts, and add
  another xend-config parameter, along network-script and vif-script,
  which should point to either of those according to the values of
  network-script and vif-script.

It looks to me like the first solution could be used as a workaround for
now and the last one would be preferable for the long run.

Samuel

Signed-off-by: Samuel Thibault <samuel.thibault@citrix.com>

[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 313 bytes --]

diff -r f8819cb5f892 tools/ioemu/target-i386-dm/qemu-ifup
--- a/tools/ioemu/target-i386-dm/qemu-ifup	Mon Jun 04 11:01:46 2007 +0100
+++ b/tools/ioemu/target-i386-dm/qemu-ifup	Thu Dec 27 13:17:05 2007 +0000
@@ -34,4 +34,4 @@ fi
 fi
 
 ifconfig $1 0.0.0.0 up
-brctl addif $bridge $1
+brctl addif $bridge $1 || true

[-- Attachment #3: patch2 --]
[-- Type: text/plain, Size: 3968 bytes --]

diff -r 1e3e30670ce4 tools/ioemu/target-i386-dm/qemu-ifup
--- a/tools/ioemu/target-i386-dm/qemu-ifup	Thu Dec 27 10:41:43 2007 +0000
+++ b/tools/ioemu/target-i386-dm/qemu-ifup	Thu Dec 27 13:13:39 2007 +0000
@@ -5,8 +5,12 @@
 
 echo 'config qemu network with xen bridge for ' $*
 
+ifconfig $1 0.0.0.0 up
+
 bridge=$2
 
+if [ -n "$bridge" ]
+then
 #
 # Old style bridge setup with netloop, used to have a bridge name
 # of xenbrX, enslaving pethX and vif0.X, and then configuring
@@ -25,13 +29,13 @@ bridge=$2
 #
 # This lets old config files work without modification
 #
-if [ ! -e "/sys/class/net/$bridge" ] && [ -z "${bridge##xenbr*}" ]
-then
-   if [ -e "/sys/class/net/eth${bridge#xenbr}/bridge" ]
+   if [ ! -e "/sys/class/net/$bridge" ] && [ -z "${bridge##xenbr*}" ]
    then
-      bridge="eth${bridge#xenbr}"
+      if [ -e "/sys/class/net/eth${bridge#xenbr}/bridge" ]
+      then
+         bridge="eth${bridge#xenbr}"
+      fi
    fi
+
+   brctl addif $bridge $1
 fi
-
-ifconfig $1 0.0.0.0 up
-brctl addif $bridge $1
diff -r 1e3e30670ce4 tools/ioemu/vl.c
--- a/tools/ioemu/vl.c	Thu Dec 27 10:41:43 2007 +0000
+++ b/tools/ioemu/vl.c	Thu Dec 27 13:13:39 2007 +0000
@@ -100,11 +100,6 @@
 #include "exec-all.h"
 
 #define DEFAULT_NETWORK_SCRIPT "/etc/xen/qemu-ifup"
-#ifdef _BSD
-#define DEFAULT_BRIDGE "bridge0"
-#else 
-#define DEFAULT_BRIDGE "xenbr0"
-#endif
 #ifdef __sun__
 #define SMBD_COMMAND "/usr/sfw/sbin/smbd"
 #else
@@ -4111,7 +4106,7 @@ static int net_client_init(const char *s
     if (!strcmp(device, "tap")) {
         char ifname[64];
         char setup_script[1024];
-        char bridge[16];
+        char bridge[16], *_bridge = NULL;
         int fd;
 
 	memset(ifname, 0, sizeof(ifname));
@@ -4129,10 +4124,10 @@ static int net_client_init(const char *s
             if (get_param_value(setup_script, sizeof(setup_script), "script", p) == 0) {
                 pstrcpy(setup_script, sizeof(setup_script), DEFAULT_NETWORK_SCRIPT);
             }
-            if (get_param_value(bridge, sizeof(bridge), "bridge", p) == 0) {
-                pstrcpy(bridge, sizeof(bridge), DEFAULT_BRIDGE);
-            }
-            ret = net_tap_init(vlan, ifname, setup_script, bridge);
+            if (get_param_value(bridge, sizeof(bridge), "bridge", p) > 0) {
+                _bridge = bridge;
+            }
+            ret = net_tap_init(vlan, ifname, setup_script, _bridge);
         }
     } else
 #endif
diff -r 1e3e30670ce4 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py	Thu Dec 27 10:41:43 2007 +0000
+++ b/tools/python/xen/xend/image.py	Thu Dec 27 13:13:39 2007 +0000
@@ -485,13 +485,17 @@ class HVMImageHandler(ImageHandler):
             mac = devinfo.get('mac')
             if mac is None:
                 raise VmError("MAC address not specified or generated.")
-            bridge = devinfo.get('bridge', 'xenbr0')
+            bridge = devinfo.get('bridge')
             model = devinfo.get('model', 'rtl8139')
             ret.append("-net")
             ret.append("nic,vlan=%d,macaddr=%s,model=%s" %
                        (nics, mac, model))
             ret.append("-net")
-            ret.append("tap,vlan=%d,bridge=%s" % (nics, bridge))
+            if bridge is None:
+                bridge = ""
+            else:
+                bridge = (",bridge=%s" % (bridge))
+            ret.append("tap,vlan=%d%s" % (nics, bridge))
 
         return ret
 
diff -r 1e3e30670ce4 tools/xm-test/lib/XmTestLib/XenDevice.py
--- a/tools/xm-test/lib/XmTestLib/XenDevice.py	Thu Dec 27 10:41:43 2007 +0000
+++ b/tools/xm-test/lib/XmTestLib/XenDevice.py	Thu Dec 27 13:13:39 2007 +0000
@@ -179,8 +179,6 @@ class XenNetDevice(XenDevice):
 
         if domain.getDomainType() == "HVM":
             self.config["type"] = "ioemu"
-            if not self.config.has_key('bridge'):
-                self.config["bridge"] = "xenbr0"
 
         if self.config.has_key("ip"):
             self.setNetDevIP(ip=self.config["ip"])

[-- Attachment #4: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-12-27 13:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-27 13:26 HVM vif without bridge Samuel Thibault

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.