mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 23:07:44 +00:00
Support for VirtualBox version 3.2
This commit is contained in:
parent
fa0bb9f6b1
commit
8b0cd87696
@ -257,7 +257,8 @@ VBOX_DRIVER_SOURCES = \
|
|||||||
vbox/vbox_driver.c vbox/vbox_driver.h \
|
vbox/vbox_driver.c vbox/vbox_driver.h \
|
||||||
vbox/vbox_V2_2.c vbox/vbox_CAPI_v2_2.h \
|
vbox/vbox_V2_2.c vbox/vbox_CAPI_v2_2.h \
|
||||||
vbox/vbox_V3_0.c vbox/vbox_CAPI_v3_0.h \
|
vbox/vbox_V3_0.c vbox/vbox_CAPI_v3_0.h \
|
||||||
vbox/vbox_V3_1.c vbox/vbox_CAPI_v3_1.h
|
vbox/vbox_V3_1.c vbox/vbox_CAPI_v3_1.h \
|
||||||
|
vbox/vbox_V3_2.c vbox/vbox_CAPI_v3_2.h
|
||||||
|
|
||||||
VBOX_DRIVER_EXTRA_DIST = vbox/vbox_tmpl.c vbox/README
|
VBOX_DRIVER_EXTRA_DIST = vbox/vbox_tmpl.c vbox/README
|
||||||
|
|
||||||
|
5607
src/vbox/vbox_CAPI_v3_2.h
Normal file
5607
src/vbox/vbox_CAPI_v3_2.h
Normal file
File diff suppressed because it is too large
Load Diff
13
src/vbox/vbox_V3_2.c
Normal file
13
src/vbox/vbox_V3_2.c
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
/** @file vbox_V3_2.c
|
||||||
|
* C file to include support for multiple versions of VirtualBox
|
||||||
|
* at runtime.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
/** The API Version */
|
||||||
|
#define VBOX_API_VERSION 3002
|
||||||
|
/** Version specific prefix. */
|
||||||
|
#define NAME(name) vbox32##name
|
||||||
|
|
||||||
|
#include "vbox_tmpl.c"
|
@ -53,6 +53,9 @@ extern virStorageDriver vbox30StorageDriver;
|
|||||||
extern virDriver vbox31Driver;
|
extern virDriver vbox31Driver;
|
||||||
extern virNetworkDriver vbox31NetworkDriver;
|
extern virNetworkDriver vbox31NetworkDriver;
|
||||||
extern virStorageDriver vbox31StorageDriver;
|
extern virStorageDriver vbox31StorageDriver;
|
||||||
|
extern virDriver vbox32Driver;
|
||||||
|
extern virNetworkDriver vbox32NetworkDriver;
|
||||||
|
extern virStorageDriver vbox32StorageDriver;
|
||||||
|
|
||||||
static virDriver vboxDriverDummy;
|
static virDriver vboxDriverDummy;
|
||||||
|
|
||||||
@ -106,6 +109,11 @@ int vboxRegister(void) {
|
|||||||
driver = &vbox31Driver;
|
driver = &vbox31Driver;
|
||||||
networkDriver = &vbox31NetworkDriver;
|
networkDriver = &vbox31NetworkDriver;
|
||||||
storageDriver = &vbox31StorageDriver;
|
storageDriver = &vbox31StorageDriver;
|
||||||
|
} else if (uVersion >= 3001051 && uVersion < 3002051) {
|
||||||
|
DEBUG0("VirtualBox API version: 3.2");
|
||||||
|
driver = &vbox32Driver;
|
||||||
|
networkDriver = &vbox32NetworkDriver;
|
||||||
|
storageDriver = &vbox32StorageDriver;
|
||||||
} else {
|
} else {
|
||||||
DEBUG0("Unsupport VirtualBox API version");
|
DEBUG0("Unsupport VirtualBox API version");
|
||||||
}
|
}
|
||||||
|
@ -61,6 +61,8 @@
|
|||||||
# include "vbox_CAPI_v3_0.h"
|
# include "vbox_CAPI_v3_0.h"
|
||||||
#elif VBOX_API_VERSION == 3001
|
#elif VBOX_API_VERSION == 3001
|
||||||
# include "vbox_CAPI_v3_1.h"
|
# include "vbox_CAPI_v3_1.h"
|
||||||
|
#elif VBOX_API_VERSION == 3002
|
||||||
|
# include "vbox_CAPI_v3_2.h"
|
||||||
#else
|
#else
|
||||||
# error "Unsupport VBOX_API_VERSION"
|
# error "Unsupport VBOX_API_VERSION"
|
||||||
#endif
|
#endif
|
||||||
@ -2029,9 +2031,11 @@ static char *vboxDomainDumpXML(virDomainPtr dom, int flags) {
|
|||||||
def->features = 0;
|
def->features = 0;
|
||||||
#if VBOX_API_VERSION < 3001
|
#if VBOX_API_VERSION < 3001
|
||||||
machine->vtbl->GetPAEEnabled(machine, &PAEEnabled);
|
machine->vtbl->GetPAEEnabled(machine, &PAEEnabled);
|
||||||
#else /* VBOX_API_VERSION >= 3001 */
|
#elif VBOX_API_VERSION == 3001
|
||||||
machine->vtbl->GetCpuProperty(machine, CpuPropertyType_PAE, &PAEEnabled);
|
machine->vtbl->GetCpuProperty(machine, CpuPropertyType_PAE, &PAEEnabled);
|
||||||
#endif /* VBOX_API_VERSION >= 3001 */
|
#elif VBOX_API_VERSION >= 3002
|
||||||
|
machine->vtbl->GetCPUProperty(machine, CPUPropertyType_PAE, &PAEEnabled);
|
||||||
|
#endif
|
||||||
if (PAEEnabled) {
|
if (PAEEnabled) {
|
||||||
def->features = def->features | (1 << VIR_DOMAIN_FEATURE_PAE);
|
def->features = def->features | (1 << VIR_DOMAIN_FEATURE_PAE);
|
||||||
}
|
}
|
||||||
@ -3357,6 +3361,9 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml) {
|
|||||||
vboxIID *mchiid = NULL;
|
vboxIID *mchiid = NULL;
|
||||||
virDomainDefPtr def = NULL;
|
virDomainDefPtr def = NULL;
|
||||||
PRUnichar *machineNameUtf16 = NULL;
|
PRUnichar *machineNameUtf16 = NULL;
|
||||||
|
#if VBOX_API_VERSION >= 3002
|
||||||
|
PRBool override = PR_FALSE;
|
||||||
|
#endif
|
||||||
nsresult rc;
|
nsresult rc;
|
||||||
|
|
||||||
if (!(def = virDomainDefParseString(data->caps, xml,
|
if (!(def = virDomainDefParseString(data->caps, xml,
|
||||||
@ -3373,12 +3380,22 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml) {
|
|||||||
|
|
||||||
VBOX_UTF8_TO_UTF16(def->name, &machineNameUtf16);
|
VBOX_UTF8_TO_UTF16(def->name, &machineNameUtf16);
|
||||||
vboxIIDFromUUID(def->uuid, iid);
|
vboxIIDFromUUID(def->uuid, iid);
|
||||||
|
#if VBOX_API_VERSION < 3002
|
||||||
rc = data->vboxObj->vtbl->CreateMachine(data->vboxObj,
|
rc = data->vboxObj->vtbl->CreateMachine(data->vboxObj,
|
||||||
machineNameUtf16,
|
machineNameUtf16,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
iid,
|
iid,
|
||||||
&machine);
|
&machine);
|
||||||
|
#else /* VBOX_API_VERSION >= 3002 */
|
||||||
|
rc = data->vboxObj->vtbl->CreateMachine(data->vboxObj,
|
||||||
|
machineNameUtf16,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
iid,
|
||||||
|
override,
|
||||||
|
&machine);
|
||||||
|
#endif /* VBOX_API_VERSION >= 3002 */
|
||||||
VBOX_UTF16_FREE(machineNameUtf16);
|
VBOX_UTF16_FREE(machineNameUtf16);
|
||||||
|
|
||||||
if (NS_FAILED(rc)) {
|
if (NS_FAILED(rc)) {
|
||||||
@ -3405,11 +3422,15 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml) {
|
|||||||
#if VBOX_API_VERSION < 3001
|
#if VBOX_API_VERSION < 3001
|
||||||
rc = machine->vtbl->SetPAEEnabled(machine, (def->features) &
|
rc = machine->vtbl->SetPAEEnabled(machine, (def->features) &
|
||||||
(1 << VIR_DOMAIN_FEATURE_PAE));
|
(1 << VIR_DOMAIN_FEATURE_PAE));
|
||||||
#else /* VBOX_API_VERSION >= 3001 */
|
#elif VBOX_API_VERSION == 3001
|
||||||
rc = machine->vtbl->SetCpuProperty(machine, CpuPropertyType_PAE,
|
rc = machine->vtbl->SetCpuProperty(machine, CpuPropertyType_PAE,
|
||||||
(def->features) &
|
(def->features) &
|
||||||
(1 << VIR_DOMAIN_FEATURE_PAE));
|
(1 << VIR_DOMAIN_FEATURE_PAE));
|
||||||
#endif /* VBOX_API_VERSION >= 3001 */
|
#elif VBOX_API_VERSION >= 3002
|
||||||
|
rc = machine->vtbl->SetCPUProperty(machine, CPUPropertyType_PAE,
|
||||||
|
(def->features) &
|
||||||
|
(1 << VIR_DOMAIN_FEATURE_PAE));
|
||||||
|
#endif
|
||||||
if (NS_FAILED(rc)) {
|
if (NS_FAILED(rc)) {
|
||||||
vboxError(VIR_ERR_INTERNAL_ERROR,
|
vboxError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("could not change PAE status to: %s, rc=%08x"),
|
_("could not change PAE status to: %s, rc=%08x"),
|
||||||
@ -6334,7 +6355,11 @@ static IVirtualBoxCallback *vboxAllocCallbackObj(void) {
|
|||||||
vboxCallback->vtbl->OnMachineRegistered = &vboxCallbackOnMachineRegistered;
|
vboxCallback->vtbl->OnMachineRegistered = &vboxCallbackOnMachineRegistered;
|
||||||
vboxCallback->vtbl->OnSessionStateChange = &vboxCallbackOnSessionStateChange;
|
vboxCallback->vtbl->OnSessionStateChange = &vboxCallbackOnSessionStateChange;
|
||||||
vboxCallback->vtbl->OnSnapshotTaken = &vboxCallbackOnSnapshotTaken;
|
vboxCallback->vtbl->OnSnapshotTaken = &vboxCallbackOnSnapshotTaken;
|
||||||
|
# if VBOX_API_VERSION < 3002
|
||||||
vboxCallback->vtbl->OnSnapshotDiscarded = &vboxCallbackOnSnapshotDiscarded;
|
vboxCallback->vtbl->OnSnapshotDiscarded = &vboxCallbackOnSnapshotDiscarded;
|
||||||
|
# else /* VBOX_API_VERSION >= 3002 */
|
||||||
|
vboxCallback->vtbl->OnSnapshotDeleted = &vboxCallbackOnSnapshotDiscarded;
|
||||||
|
# endif /* VBOX_API_VERSION >= 3002 */
|
||||||
vboxCallback->vtbl->OnSnapshotChange = &vboxCallbackOnSnapshotChange;
|
vboxCallback->vtbl->OnSnapshotChange = &vboxCallbackOnSnapshotChange;
|
||||||
vboxCallback->vtbl->OnGuestPropertyChange = &vboxCallbackOnGuestPropertyChange;
|
vboxCallback->vtbl->OnGuestPropertyChange = &vboxCallbackOnGuestPropertyChange;
|
||||||
g_pVBoxGlobalData->vboxCallBackRefCount = 1;
|
g_pVBoxGlobalData->vboxCallBackRefCount = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user