From 1fbee8dadfe01eb1881005b02e0e74b2f85e5fc9 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Fri, 24 Apr 2009 12:17:50 +0000 Subject: [PATCH] Fix XM driver VIF config creation --- ChangeLog | 10 ++++++++ src/xend_internal.c | 6 ----- src/xend_internal.h | 6 +++++ src/xm_internal.c | 23 ++++++++++++++++++- tests/xmconfigdata/test-escape-paths.cfg | 2 +- tests/xmconfigdata/test-escape-paths.xml | 1 + .../xmconfigdata/test-fullvirt-localtime.cfg | 2 +- .../xmconfigdata/test-fullvirt-localtime.xml | 1 + .../xmconfigdata/test-fullvirt-new-cdrom.cfg | 2 +- .../xmconfigdata/test-fullvirt-new-cdrom.xml | 1 + .../xmconfigdata/test-fullvirt-old-cdrom.cfg | 2 +- .../xmconfigdata/test-fullvirt-old-cdrom.xml | 1 + .../test-fullvirt-parallel-tcp.cfg | 2 +- .../test-fullvirt-parallel-tcp.xml | 1 + .../test-fullvirt-serial-file.cfg | 2 +- .../test-fullvirt-serial-file.xml | 1 + .../test-fullvirt-serial-null.cfg | 2 +- .../test-fullvirt-serial-null.xml | 1 + .../test-fullvirt-serial-pipe.cfg | 2 +- .../test-fullvirt-serial-pipe.xml | 1 + .../xmconfigdata/test-fullvirt-serial-pty.cfg | 2 +- .../xmconfigdata/test-fullvirt-serial-pty.xml | 1 + .../test-fullvirt-serial-stdio.cfg | 2 +- .../test-fullvirt-serial-stdio.xml | 1 + .../test-fullvirt-serial-tcp-telnet.cfg | 2 +- .../test-fullvirt-serial-tcp-telnet.xml | 1 + .../xmconfigdata/test-fullvirt-serial-tcp.cfg | 2 +- .../xmconfigdata/test-fullvirt-serial-tcp.xml | 1 + .../xmconfigdata/test-fullvirt-serial-udp.cfg | 2 +- .../xmconfigdata/test-fullvirt-serial-udp.xml | 1 + .../test-fullvirt-serial-unix.cfg | 2 +- .../test-fullvirt-serial-unix.xml | 1 + tests/xmconfigdata/test-fullvirt-sound.cfg | 2 +- tests/xmconfigdata/test-fullvirt-sound.xml | 1 + tests/xmconfigdata/test-fullvirt-usbmouse.cfg | 2 +- tests/xmconfigdata/test-fullvirt-usbmouse.xml | 1 + .../test-fullvirt-usbtablet-no-bus.xml | 1 + .../xmconfigdata/test-fullvirt-usbtablet.cfg | 2 +- .../xmconfigdata/test-fullvirt-usbtablet.xml | 1 + tests/xmconfigdata/test-fullvirt-utc.cfg | 2 +- tests/xmconfigdata/test-fullvirt-utc.xml | 1 + tests/xmconfigdata/test-no-source-cdrom.cfg | 2 +- tests/xmconfigdata/test-no-source-cdrom.xml | 1 + .../xmconfigdata/test-paravirt-net-e1000.cfg | 2 +- .../xmconfigdata/test-paravirt-net-e1000.xml | 1 + .../test-paravirt-net-vifname.cfg | 2 +- .../test-paravirt-net-vifname.xml | 1 + .../test-paravirt-new-pvfb-vncdisplay.cfg | 2 +- .../test-paravirt-new-pvfb-vncdisplay.xml | 1 + tests/xmconfigdata/test-paravirt-new-pvfb.cfg | 2 +- tests/xmconfigdata/test-paravirt-new-pvfb.xml | 1 + .../test-paravirt-old-pvfb-vncdisplay.cfg | 2 +- .../test-paravirt-old-pvfb-vncdisplay.xml | 1 + tests/xmconfigdata/test-paravirt-old-pvfb.cfg | 2 +- tests/xmconfigdata/test-paravirt-old-pvfb.xml | 1 + tests/xmconfigdata/test-pci-devs.cfg | 2 +- tests/xmconfigdata/test-pci-devs.xml | 1 + 57 files changed, 91 insertions(+), 33 deletions(-) diff --git a/ChangeLog b/ChangeLog index 00bb314d3b..353ab080c8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Fri Apr 24 13:17:47 BST 2009 Daniel P. Berrange + + Fix network config in XM driver + * src/xm_internal.c: Fix setting of bridge & script parameters + in VIF config + * src/xend_internal.h, src/xend_internal.c: Export the + default bridge script name to XM driver + * tests/xmconfigdata/*: Update to take account of script= + setting in VIF config + Fri Apr 24 12:06:47 CEST 2009 Daniel Veillard * po/*: updated a could of locale, regenerated diff --git a/src/xend_internal.c b/src/xend_internal.c index ca8c3139ac..4b327c4e75 100644 --- a/src/xend_internal.c +++ b/src/xend_internal.c @@ -61,12 +61,6 @@ #endif /* PROXY */ -#ifdef __sun -#define DEFAULT_VIF_SCRIPT "vif-vnic" -#else -#define DEFAULT_VIF_SCRIPT "vif-bridge" -#endif - #ifdef WITH_RHEL5_API #define XEND_CONFIG_MAX_VERS_NET_TYPE_IOEMU 0 #define XEND_CONFIG_MIN_VERS_PVFB_NEWCONF 2 diff --git a/src/xend_internal.h b/src/xend_internal.h index 19bb26888d..9d2571bd16 100644 --- a/src/xend_internal.h +++ b/src/xend_internal.h @@ -27,6 +27,12 @@ #include "driver.h" #include "buf.h" +#ifdef __sun +#define DEFAULT_VIF_SCRIPT "vif-vnic" +#else +#define DEFAULT_VIF_SCRIPT "vif-bridge" +#endif + int xenDaemonOpen_unix(virConnectPtr conn, const char *path); diff --git a/src/xm_internal.c b/src/xm_internal.c index 09fe24c4bb..38ef9b2e11 100644 --- a/src/xm_internal.c +++ b/src/xm_internal.c @@ -1980,6 +1980,7 @@ static int xenXMDomainConfigFormatNet(virConnectPtr conn, virBufferVSprintf(&buf, ",bridge=%s", net->data.bridge.brname); if (net->data.bridge.ipaddr) virBufferVSprintf(&buf, ",ip=%s", net->data.bridge.ipaddr); + virBufferVSprintf(&buf, ",script=%s", DEFAULT_VIF_SCRIPT); break; case VIR_DOMAIN_NET_TYPE_ETHERNET: @@ -1990,7 +1991,27 @@ static int xenXMDomainConfigFormatNet(virConnectPtr conn, break; case VIR_DOMAIN_NET_TYPE_NETWORK: - break; + { + virNetworkPtr network = virNetworkLookupByName(conn, net->data.network.name); + char *bridge; + if (!network) { + xenXMError(conn, VIR_ERR_NO_NETWORK, "%s", + net->data.network.name); + return -1; + } + bridge = virNetworkGetBridgeName(network); + virNetworkFree(network); + if (!bridge) { + xenXMError(conn, VIR_ERR_INTERNAL_ERROR, + _("network %s is not active"), + net->data.network.name); + return -1; + } + + virBufferVSprintf(&buf, ",bridge=%s", bridge); + virBufferVSprintf(&buf, ",script=%s", DEFAULT_VIF_SCRIPT); + } + break; default: xenXMError(conn, VIR_ERR_INTERNAL_ERROR, diff --git a/tests/xmconfigdata/test-escape-paths.cfg b/tests/xmconfigdata/test-escape-paths.cfg index 6e2611b9f3..17f7f3a522 100644 --- a/tests/xmconfigdata/test-escape-paths.cfg +++ b/tests/xmconfigdata/test-escape-paths.cfg @@ -20,7 +20,7 @@ vncunused = 1 vnclisten = "127.0.0.1" vncpasswd = "123poi" disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso&test,hdc:cdrom,r" ] -vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,type=ioemu" ] +vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,type=ioemu" ] parallel = "none" serial = "none" soundhw = "sb16,es1370" diff --git a/tests/xmconfigdata/test-escape-paths.xml b/tests/xmconfigdata/test-escape-paths.xml index 7a534baaff..6929ca5efc 100644 --- a/tests/xmconfigdata/test-escape-paths.xml +++ b/tests/xmconfigdata/test-escape-paths.xml @@ -34,6 +34,7 @@ +