[libvirt] [PATCH 2/3] support for "Host only" and "Internal" networks in VirtualBox driver

Hi All, As discussed on the list resending the networking patch's. the patch's are as below: [PATCH 1/3]: contains support for "Internal" network in libvirt [PATCH 2/3]: contains support for "Host only" and "Internal" networks in VirtualBox driver [PATCH 3/3]: contains networking API for hostonly networks in VirtualBox driver in libvirt (it contains all the fix's proposed on list along with two extra *DefinedNetworks functions) The patches work as per cvs checkin today. (git SHA1 ID: 9136ae2056b45ea83854d3fe31d860f645b8c883) Regards, Pritesh

On Wed, May 06, 2009 at 06:11:50PM +0200, Pritesh Kothari wrote:
Hi All,
As discussed on the list resending the networking patch's. the patch's are as below:
[PATCH 2/3]: contains support for "Host only" and "Internal" networks in VirtualBox driver
ACK,
commit 2cc53f659c470838af96b85ce81c0342cefe2184 Author: pk221555 <pk221555@krishna.(none)> Date: Wed May 6 17:06:21 2009 +0200
libvirt: Added support for "Host only" and "Internal" networks
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index 7297172..fb6a6df 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -1713,7 +1713,6 @@ static char *vboxDomainDumpXML(virDomainPtr dom, int flags) { data->pFuncs->pfnUtf8Free(hostInt); data->pFuncs->pfnUtf16Free(hostIntUtf16);
-#if 0 } else if (attachmentType == NetworkAttachmentType_Internal) { PRUnichar *intNetUtf16 = NULL; char *intNet = NULL; @@ -1732,17 +1731,16 @@ static char *vboxDomainDumpXML(virDomainPtr dom, int flags) { PRUnichar *hostIntUtf16 = NULL; char *hostInt = NULL;
- def->nets[netAdpIncCnt]->type = VIR_DOMAIN_NET_TYPE_HOSTONLY; + def->nets[netAdpIncCnt]->type = VIR_DOMAIN_NET_TYPE_NETWORK;
adapter->vtbl->GetHostInterface(adapter, &hostIntUtf16);
data->pFuncs->pfnUtf16ToUtf8(hostIntUtf16, &hostInt); - def->nets[netAdpIncCnt]->data.hostonly.name = strdup(hostInt); + def->nets[netAdpIncCnt]->data.network.name = strdup(hostInt);
data->pFuncs->pfnUtf8Free(hostInt); data->pFuncs->pfnUtf16Free(hostIntUtf16);
-#endif } else { /* default to user type i.e. NAT in VirtualBox if this * dump is ever used to create a machine. @@ -2813,14 +2811,11 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml) { DEBUG("NIC(%d): Model: %s", i, def->nets[i]->model); DEBUG("NIC(%d): Mac: %s", i, macaddr); DEBUG("NIC(%d): ifname: %s", i, def->nets[i]->ifname); -#if 0 - if (def->nets[i]->type == VIR_DOMAIN_NET_TYPE_HOSTONLY) { - DEBUG("NIC(%d): name: %s", i, def->nets[i]->data.hostonly.name); + if (def->nets[i]->type == VIR_DOMAIN_NET_TYPE_NETWORK) { + DEBUG("NIC(%d): name: %s", i, def->nets[i]->data.network.name); } else if (def->nets[i]->type == VIR_DOMAIN_NET_TYPE_INTERNAL) { DEBUG("NIC(%d): name: %s", i, def->nets[i]->data.internal.name); - } else -#endif - if (def->nets[i]->type == VIR_DOMAIN_NET_TYPE_USER) { + } else if (def->nets[i]->type == VIR_DOMAIN_NET_TYPE_USER) { DEBUG("NIC(%d): NAT.", i); } else if (def->nets[i]->type == VIR_DOMAIN_NET_TYPE_BRIDGE) { DEBUG("NIC(%d): brname: %s", i, def->nets[i]->data.bridge.brname); @@ -2859,19 +2854,18 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml) { adapter->vtbl->SetHostInterface(adapter, hostInterface); data->pFuncs->pfnUtf16Free(hostInterface); } -#if 0 } else if (def->nets[i]->type == VIR_DOMAIN_NET_TYPE_INTERNAL) { PRUnichar *internalNetwork = NULL; /* Internal Network */
adapter->vtbl->AttachToInternalNetwork(adapter);
- if (def->nets[i]->data.network.name) { - data->pFuncs->pfnUtf8ToUtf16(def->nets[i]->data.network.name, &internalNetwork); + if (def->nets[i]->data.internal.name) { + data->pFuncs->pfnUtf8ToUtf16(def->nets[i]->data.internal.name, &internalNetwork); adapter->vtbl->SetInternalNetwork(adapter, internalNetwork); data->pFuncs->pfnUtf16Free(internalNetwork); } - } else if (def->nets[i]->type == VIR_DOMAIN_NET_TYPE_HOSTONLY) { + } else if (def->nets[i]->type == VIR_DOMAIN_NET_TYPE_NETWORK) { PRUnichar *hostInterface = NULL; /* Host Only Networking (currently only vboxnet0 available * on *nix and mac, on windows you can create and configure @@ -2879,12 +2873,11 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml) { */ adapter->vtbl->AttachToHostOnlyInterface(adapter);
- if (def->nets[i]->data.ethernet.dev) { - g_pVBoxFuncs->pfnUtf8ToUtf16(def->nets[i]->data.hostonly.name, &hostInterface); + if (def->nets[i]->data.network.name) { + g_pVBoxFuncs->pfnUtf8ToUtf16(def->nets[i]->data.network.name, &hostInterface); adapter->vtbl->SetHostInterface(adapter, hostInterface); data->pFuncs->pfnUtf16Free(hostInterface); } -#endif } else if (def->nets[i]->type == VIR_DOMAIN_NET_TYPE_USER) { /* NAT */ adapter->vtbl->AttachToNAT(adapter);
-- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
-- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Wed, May 06, 2009 at 06:11:50PM +0200, Pritesh Kothari wrote:
[PATCH 2/3]: contains support for "Host only" and "Internal" networks in VirtualBox driver
Okay, standalone, looks fine, so applied and commited too, thanks ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/
participants (3)
-
Daniel P. Berrange
-
Daniel Veillard
-
Pritesh Kothari