From mboxrd@z Thu Jan 1 00:00:00 1970 From: Samuel Thibault Subject: HVM vif without bridge Date: Thu, 27 Dec 2007 14:26:13 +0100 Message-ID: <20071227132613.GC4239@implementation.uk.xensource.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="ibTvN161/egqYuK8" Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --ibTvN161/egqYuK8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 --ibTvN161/egqYuK8 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=patch 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 --ibTvN161/egqYuK8 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=patch2 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"]) --ibTvN161/egqYuK8 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --ibTvN161/egqYuK8--