Hi All, I have added the support for hostonly and internal network as suggested on irc and list and am attaching the patch for same. PATCH 1/2: contains changes in the xml parsing/formatting on libvirt side namely adding a mode attribute to <source> tag in domain/interface xml PATCH 2/2: contains changes in the vbox driver itself. Regards, Pritesh
commit 11024ae0d14c1d0a2fdf1d141ce598e14435b2d3 Author: Pritesh Kothari <Pritesh.Kothari@xxxxxxx> Date: Wed Apr 29 10:49:02 2009 +0200 added 'mode' attribute to source tag under interface diff --git a/src/domain_conf.c b/src/domain_conf.c index dde4020..bb134c0 100644 --- a/src/domain_conf.c +++ b/src/domain_conf.c @@ -303,6 +303,7 @@ void virDomainNetDefFree(virDomainNetDefPtr def) case VIR_DOMAIN_NET_TYPE_NETWORK: VIR_FREE(def->data.network.name); + VIR_FREE(def->data.network.mode); break; case VIR_DOMAIN_NET_TYPE_BRIDGE: @@ -880,6 +881,7 @@ virDomainNetDefParseXML(virConnectPtr conn, char *macaddr = NULL; char *type = NULL; char *network = NULL; + char *networkmode = NULL; char *bridge = NULL; char *dev = NULL; char *ifname = NULL; @@ -914,6 +916,7 @@ virDomainNetDefParseXML(virConnectPtr conn, (def->type == VIR_DOMAIN_NET_TYPE_NETWORK) && (xmlStrEqual(cur->name, BAD_CAST "source"))) { network = virXMLPropString(cur, "network"); + networkmode = virXMLPropString(cur, "mode"); } else if ((network == NULL) && (def->type == VIR_DOMAIN_NET_TYPE_BRIDGE) && (xmlStrEqual(cur->name, BAD_CAST "source"))) { @@ -961,13 +964,15 @@ virDomainNetDefParseXML(virConnectPtr conn, switch (def->type) { case VIR_DOMAIN_NET_TYPE_NETWORK: - if (network == NULL) { + if ((network == NULL) || (networkmode == NULL)) { virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s", - _("No <source> 'network' attribute specified with <interface type='network'/>")); + _("No <source> 'network' or 'mode' attribute specified with <interface type='network'/>")); goto error; } def->data.network.name = network; + def->data.network.mode = networkmode; network = NULL; + networkmode = NULL; break; case VIR_DOMAIN_NET_TYPE_ETHERNET: @@ -3011,8 +3016,9 @@ virDomainNetDefFormat(virConnectPtr conn, switch (def->type) { case VIR_DOMAIN_NET_TYPE_NETWORK: - virBufferEscapeString(buf, " <source network='%s'/>\n", - def->data.network.name); + virBufferVSprintf(buf, " <source network='%s' mode='%s'/>\n", + def->data.network.name, + def->data.network.mode); break; case VIR_DOMAIN_NET_TYPE_ETHERNET: diff --git a/src/domain_conf.h b/src/domain_conf.h index d4e7442..5fbc395 100644 --- a/src/domain_conf.h +++ b/src/domain_conf.h @@ -162,6 +162,7 @@ struct _virDomainNetDef { } socket; /* any of NET_CLIENT or NET_SERVER or NET_MCAST */ struct { char *name; + char *mode; } network; struct { char *brname;
-- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list