提交 19d979ed 编写于 作者: M Mikhail Feoktistov 提交者: Maxim Nestratov

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.
上级 d10b02b5
...@@ -36,6 +36,15 @@ ...@@ -36,6 +36,15 @@
#define VIR_FROM_THIS VIR_FROM_PARALLELS #define VIR_FROM_THIS VIR_FROM_PARALLELS
#define PRLSRVCTL "prlsrvctl" #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: * vzDomObjFromDomain:
* @domain: Domain pointer that has to be looked up * @domain: Domain pointer that has to be looked up
...@@ -180,6 +189,20 @@ vzNewDomain(vzConnPtr privconn, char *name, const unsigned char *uuid) ...@@ -180,6 +189,20 @@ vzNewDomain(vzConnPtr privconn, char *name, const unsigned char *uuid)
return NULL; 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 int
vzInitVersion(vzConnPtr privconn) vzInitVersion(vzConnPtr privconn)
{ {
...@@ -219,6 +242,7 @@ vzInitVersion(vzConnPtr privconn) ...@@ -219,6 +242,7 @@ vzInitVersion(vzConnPtr privconn)
goto cleanup; goto cleanup;
} }
vzInitCaps(privconn->vzVersion, &privconn->vzCaps);
ret = 0; ret = 0;
cleanup: cleanup:
......
...@@ -48,6 +48,15 @@ ...@@ -48,6 +48,15 @@
# define PARALLELS_DOMAIN_ROUTED_NETWORK_NAME "Routed" # define PARALLELS_DOMAIN_ROUTED_NETWORK_NAME "Routed"
# define PARALLELS_DOMAIN_BRIDGED_NETWORK_NAME "Bridged" # 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 { struct _vzConn {
virMutex lock; virMutex lock;
...@@ -63,6 +72,7 @@ struct _vzConn { ...@@ -63,6 +72,7 @@ struct _vzConn {
/* Immutable pointer, self-locking APIs */ /* Immutable pointer, self-locking APIs */
virConnectCloseCallbackDataPtr closeCallback; virConnectCloseCallbackDataPtr closeCallback;
unsigned long vzVersion; unsigned long vzVersion;
vzCapabilities vzCaps;
}; };
typedef struct _vzConn vzConn; typedef struct _vzConn vzConn;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册