2010/5/26 Jean-Baptiste Rouault <jean-baptiste.rouault(a)diateam.net>:
Hi there,
Here's a patch to add support to VirtualBox 3.2.
I'm not sure about the 'override' argument to CreateMachine which I set to
false by default.
The SDK documentation says about the override argument: "Create the VM
even if there are conflicting files." So I think it's a good idea to
hardcode it to false.
Regards,
Jean-Baptiste Rouault
>From 9b7f2a9374bf41a054dfa0b80f31bf0a69fbce0a Mon Sep 17 00:00:00 2001
From: Jean-Baptiste Rouault <jean-baptiste.rouault(a)diateam.net>
Date: Wed, 26 May 2010 13:54:16 +0200
Subject: [PATCH] Support for VirtualBox version 3.2
---
src/Makefile.am | 3 +-
src/vbox/vbox_CAPI_v3_2.h | 5607 +++++++++++++++++++++++++++++++++++++++++++++
src/vbox/vbox_V3_2.c | 13 +
src/vbox/vbox_driver.c | 8 +
src/vbox/vbox_tmpl.c | 33 +-
5 files changed, 5659 insertions(+), 5 deletions(-)
create mode 100644 src/vbox/vbox_CAPI_v3_2.h
create mode 100644 src/vbox/vbox_V3_2.c
The patch looks good. I just applied this small patch on top of yours
to make the code a bit more robust to adding support for future
versions:
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 533d969..f70f3b3 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -2033,7 +2033,7 @@ static char *vboxDomainDumpXML(virDomainPtr dom,
int flags) {
machine->vtbl->GetPAEEnabled(machine, &PAEEnabled);
#elif VBOX_API_VERSION == 3001
machine->vtbl->GetCpuProperty(machine,
CpuPropertyType_PAE, &PAEEnabled);
-#elif VBOX_API_VERSION == 3002
+#elif VBOX_API_VERSION >= 3002
machine->vtbl->GetCPUProperty(machine,
CPUPropertyType_PAE, &PAEEnabled);
#endif
if (PAEEnabled) {
@@ -3361,7 +3361,7 @@ static virDomainPtr
vboxDomainDefineXML(virConnectPtr conn, const char *xml) {
vboxIID *mchiid = NULL;
virDomainDefPtr def = NULL;
PRUnichar *machineNameUtf16 = NULL;
-#if VBOX_API_VERSION == 3002
+#if VBOX_API_VERSION >= 3002
PRBool override = PR_FALSE;
#endif
nsresult rc;
@@ -3426,7 +3426,7 @@ static virDomainPtr
vboxDomainDefineXML(virConnectPtr conn, const char *xml) {
rc = machine->vtbl->SetCpuProperty(machine, CpuPropertyType_PAE,
(def->features) &
(1 << VIR_DOMAIN_FEATURE_PAE));
-#elif VBOX_API_VERSION == 3002
+#elif VBOX_API_VERSION >= 3002
rc = machine->vtbl->SetCPUProperty(machine, CPUPropertyType_PAE,
(def->features) &
(1 << VIR_DOMAIN_FEATURE_PAE));
ACK. I pushed the result. Thanks!
Matthias