[libvirt] [PATCH 2/4] VirtualBox support

Hi All, I have attached a patch which when applied on the HEAD as of today would allow virtualbox support in libvirt. It takes cares of all the stuff mentioned on the list earlier. Still if I have missed anything, please do tell me. The patches are organized as below: Patch 0/4: contains sample xml file Patch 1/4: contains diff of files already in libvirt. Patch 2/4: contains new files needed for VirtualBox support. Patch 3/4: contains support for host only and internal network. Patch 4/4: contains support for rdp in libvirt as mentioned by danpb (also had sent it separately earlier today) Regards, Pritesh

On Thu, Apr 16, 2009 at 04:18:58PM +0200, Pritesh Kothari wrote:
Hi All,
I have attached a patch which when applied on the HEAD as of today would allow virtualbox support in libvirt. It takes cares of all the stuff mentioned on the list earlier. Still if I have missed anything, please do tell me.
I actually just tried out your previous patch from 2 days ago and it worked without trouble, so I reckon we can plan to get this driver in the forthcoming release next week.
+static virCapsPtr vboxCapsInit(void) { + struct utsname utsname; + virCapsPtr caps; + virCapsGuestPtr guest; + + uname(&utsname); + + if ((caps = virCapabilitiesNew(utsname.machine, + 0, 0)) == NULL) + goto no_memory; + + if (virCapsInitNUMA(caps) < 0) + goto no_memory; + + virCapabilitiesSetMacPrefix(caps, (unsigned char[]){ 0x08, 0x00, 0x27 }); + + if ((guest = virCapabilitiesAddGuest(caps, + "hvm", + utsname.machine, + sizeof(int) == 4 ? 32 : 64,
I was wondering why the capabilities said '32' as wordsize even on x86_64, and of course this is because 'int' is still 32 bits on x86_64. I'd switch to 'sizeof(size_t)' instead unless someone has better suggestions for determining the native arch wordsize in a portable manner.
+static const char *vboxGetType(virConnectPtr conn ATTRIBUTE_UNUSED) { + DEBUG("%s: in vboxGetType",conn->driver->name); + return strdup("VBox"); +}
This shouldn't strdup the type - the returned string is const, not to be free'd by caller. Even better just remove this method entirely. I don't know why we have this as a driver method at all. The default impl in src/libvirt.c already does the correct thing, returning the conn->driver->name string. We should remove getType from all our driver impls. Daniel -- |: 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 :|

Hi Daniel,
I have attached a patch which when applied on the HEAD as of today would allow virtualbox support in libvirt. It takes cares of all the stuff mentioned on the list earlier. Still if I have missed anything, please do tell me.
I actually just tried out your previous patch from 2 days ago and it worked without trouble, so I reckon we can plan to get this driver in the forthcoming release next week.
That's great news :)
+ if ((guest = virCapabilitiesAddGuest(caps, + "hvm", + utsname.machine, + sizeof(int) == 4 ? 32 : 64,
I was wondering why the capabilities said '32' as wordsize even on x86_64, and of course this is because 'int' is still 32 bits on x86_64. I'd switch to 'sizeof(size_t)' instead unless someone has better suggestions for determining the native arch wordsize in a portable manner.
fixed this. used (sizeof(void *) * CHAR_BIT) instead of (sizeof(int) == 4 ? 32 : 64)
+static const char *vboxGetType(virConnectPtr conn ATTRIBUTE_UNUSED) { + DEBUG("%s: in vboxGetType",conn->driver->name); + return strdup("VBox"); +}
This shouldn't strdup the type - the returned string is const, not to be free'd by caller. Even better just remove this method entirely. I don't know why we have this as a driver method at all. The default impl in src/libvirt.c already does the correct thing, returning the conn->driver->name string.
We should remove getType from all our driver impls.
removed this method from the driver. Thanks Regards, Pritesh

Hi All,
Patch 2/4: contains new files needed for VirtualBox support.
Resending this patch again with the "hostonly", "internal" network and rdp functionality spilt up in two separate patches. the patches are as follows: vbox_2009_04_16.patch1_split : the whole patch 2 with no rdp and hostonly/internal network stuff, it also fix's the bugs mentioned earlier on the list vbox_2009_04_16.patch1_rdp: patch to turn on the rdp functionality vbox_2009_04_16.patch1_net: patch to turn on the hostonly/internal network functionality vbox_2009_04_16.patch2 and vbox_2009_04_16.patch3 as sent yesterday are required only if you use vbox_2009_04_16.patch1_net and vbox_2009_04_16.patch1_rdp respectively. Regards, Pritesh

On Fri, Apr 17, 2009 at 11:17:58AM +0200, Pritesh Kothari wrote:
Hi All,
Patch 2/4: contains new files needed for VirtualBox support.
Resending this patch again with the "hostonly", "internal" network and rdp functionality spilt up in two separate patches.
the patches are as follows:
vbox_2009_04_16.patch1_split : the whole patch 2 with no rdp and hostonly/internal network stuff, it also fix's the bugs mentioned earlier on the list
Okay, that patch too looks fine to me, ACK,
vbox_2009_04_16.patch1_rdp: patch to turn on the rdp functionality
vbox_2009_04_16.patch1_net: patch to turn on the hostonly/internal network functionality
vbox_2009_04_16.patch2 and vbox_2009_04_16.patch3 as sent yesterday are required only if you use vbox_2009_04_16.patch1_net and vbox_2009_04_16.patch1_rdp respectively.
This will go in another round, there is still some unification and review needed, 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/

On Fri, Apr 17, 2009 at 05:46:21PM +0200, Daniel Veillard wrote:
On Fri, Apr 17, 2009 at 11:17:58AM +0200, Pritesh Kothari wrote:
Hi All,
Patch 2/4: contains new files needed for VirtualBox support.
Resending this patch again with the "hostonly", "internal" network and rdp functionality spilt up in two separate patches.
the patches are as follows:
vbox_2009_04_16.patch1_split : the whole patch 2 with no rdp and hostonly/internal network stuff, it also fix's the bugs mentioned earlier on the list
Okay, that patch too looks fine to me, ACK,
After a couple of last minute tweaks, it's now commited. Adding some documentation section would be a good idea, that can still be done in time for next week release :-) 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/

On Fri, Apr 17, 2009 at 06:11:29PM +0200, Daniel Veillard wrote:
On Fri, Apr 17, 2009 at 05:46:21PM +0200, Daniel Veillard wrote:
On Fri, Apr 17, 2009 at 11:17:58AM +0200, Pritesh Kothari wrote:
Hi All,
Patch 2/4: contains new files needed for VirtualBox support.
Resending this patch again with the "hostonly", "internal" network and rdp functionality spilt up in two separate patches.
the patches are as follows:
vbox_2009_04_16.patch1_split : the whole patch 2 with no rdp and hostonly/internal network stuff, it also fix's the bugs mentioned earlier on the list
Okay, that patch too looks fine to me, ACK,
After a couple of last minute tweaks, it's now commited. Adding some documentation section would be a good idea, that can still be done in time for next week release :-)
I added an extra rule to src/Makefile.am because some files were missed in the 'make dist' causing build failures in the RPM. I also turned off vbox driver in our mingw32 specfile / automated build since it didn't compile under mingw32 Daniel -- |: 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 :|

Hi All,
After a couple of last minute tweaks, it's now commited. Adding some documentation section would be a good idea, that can still be done in time for next week release :-)
Done. Attaching a patch for the documentation. Regards, Pritesh

On Tue, Apr 21, 2009 at 01:32:39PM +0200, Pritesh Kothari wrote:
Hi All,
After a couple of last minute tweaks, it's now commited. Adding some documentation section would be a good idea, that can still be done in time for next week release :-)
Done. Attaching a patch for the documentation.
Looks fine, applied and commited, thanks ! It should be on-line soonish 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