mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
vz: add vzCapabilities to connection structure
As far as Virtuozzo6 and Virtuozzo7 support different disk types for virtual machines (ploop and qcow2 respectively) and different buses (vz6: IDE, SCSI, SATA; vz7: IDE SCSI) we add vzCapabilities structure to help undestand which disk formats and buses are supported in the context of a current connection. When a new connection opens, we select proper capabilities in accordance to current Virtuozzo version.
This commit is contained in:
parent
d10b02b5e5
commit
19d979edff
@ -36,6 +36,15 @@
|
||||
#define VIR_FROM_THIS VIR_FROM_PARALLELS
|
||||
#define PRLSRVCTL "prlsrvctl"
|
||||
|
||||
static virDomainDiskBus vz6DiskBuses[] = {VIR_DOMAIN_DISK_BUS_IDE,
|
||||
VIR_DOMAIN_DISK_BUS_SCSI,
|
||||
VIR_DOMAIN_DISK_BUS_SATA,
|
||||
VIR_DOMAIN_DISK_BUS_LAST};
|
||||
|
||||
static virDomainDiskBus vz7DiskBuses[] = {VIR_DOMAIN_DISK_BUS_IDE,
|
||||
VIR_DOMAIN_DISK_BUS_SCSI,
|
||||
VIR_DOMAIN_DISK_BUS_LAST};
|
||||
|
||||
/**
|
||||
* vzDomObjFromDomain:
|
||||
* @domain: Domain pointer that has to be looked up
|
||||
@ -180,6 +189,20 @@ vzNewDomain(vzConnPtr privconn, char *name, const unsigned char *uuid)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
vzInitCaps(unsigned long vzVersion, vzCapabilities *vzCaps)
|
||||
{
|
||||
if (vzVersion < VIRTUOZZO_VER_7) {
|
||||
vzCaps->ctDiskFormat = VIR_STORAGE_FILE_PLOOP;
|
||||
vzCaps->vmDiskFormat = VIR_STORAGE_FILE_PLOOP;
|
||||
vzCaps->diskBuses = vz6DiskBuses;
|
||||
} else {
|
||||
vzCaps->ctDiskFormat = VIR_STORAGE_FILE_PLOOP;
|
||||
vzCaps->vmDiskFormat = VIR_STORAGE_FILE_QCOW2;
|
||||
vzCaps->diskBuses = vz7DiskBuses;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
vzInitVersion(vzConnPtr privconn)
|
||||
{
|
||||
@ -219,6 +242,7 @@ vzInitVersion(vzConnPtr privconn)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
vzInitCaps(privconn->vzVersion, &privconn->vzCaps);
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
|
@ -48,6 +48,15 @@
|
||||
|
||||
# define PARALLELS_DOMAIN_ROUTED_NETWORK_NAME "Routed"
|
||||
# define PARALLELS_DOMAIN_BRIDGED_NETWORK_NAME "Bridged"
|
||||
# define VIRTUOZZO_VER_7 ((unsigned long) 7000000)
|
||||
|
||||
struct _vzCapabilities {
|
||||
virStorageFileFormat vmDiskFormat;
|
||||
virStorageFileFormat ctDiskFormat;
|
||||
virDomainDiskBus *diskBuses;
|
||||
};
|
||||
typedef struct _vzCapabilities vzCapabilities;
|
||||
typedef struct _vzCapabilities *vzCapabilitiesPtr;
|
||||
|
||||
struct _vzConn {
|
||||
virMutex lock;
|
||||
@ -63,6 +72,7 @@ struct _vzConn {
|
||||
/* Immutable pointer, self-locking APIs */
|
||||
virConnectCloseCallbackDataPtr closeCallback;
|
||||
unsigned long vzVersion;
|
||||
vzCapabilities vzCaps;
|
||||
};
|
||||
|
||||
typedef struct _vzConn vzConn;
|
||||
|
Loading…
Reference in New Issue
Block a user