[libvirt] [PATCH 2/3] vz: add virStorageFileFormat to connection structure

Mikhail Feoktistov mfeoktistov at virtuozzo.com
Tue Mar 1 10:46:16 UTC 2016


Virtuozzo6 supports only ploop disks for containers and virtual machines.
Virtuozzo7 supports only qcow2 for virtual machines.
In this patch we add virStorageFileFormat variables to connection structure.
Each variable contains disk format that we support for virtual machines and containers.
In openConnection() callback we get virtuozzo version
and select proper virStorageFileFormat values.
---
 src/vz/vz_utils.c | 8 ++++++++
 src/vz/vz_utils.h | 3 +++
 2 files changed, 11 insertions(+)

diff --git a/src/vz/vz_utils.c b/src/vz/vz_utils.c
index cf37597..f7db9cf 100644
--- a/src/vz/vz_utils.c
+++ b/src/vz/vz_utils.c
@@ -219,6 +219,14 @@ vzInitVersion(vzConnPtr privconn)
         goto cleanup;
     }
 
+    if (privconn->vzVersion < VIRTUOZZO_VER_7) {
+        privconn->ctDiskFormat = VIR_STORAGE_FILE_PLOOP;
+        privconn->vmDiskFormat = VIR_STORAGE_FILE_PLOOP;
+    } else {
+        privconn->ctDiskFormat = VIR_STORAGE_FILE_PLOOP;
+        privconn->vmDiskFormat = VIR_STORAGE_FILE_QCOW2;
+    }
+
     ret = 0;
 
  cleanup:
diff --git a/src/vz/vz_utils.h b/src/vz/vz_utils.h
index 694f204..b1bdcce 100644
--- a/src/vz/vz_utils.h
+++ b/src/vz/vz_utils.h
@@ -47,6 +47,7 @@
 
 # define PARALLELS_DOMAIN_ROUTED_NETWORK_NAME   "Routed"
 # define PARALLELS_DOMAIN_BRIDGED_NETWORK_NAME  "Bridged"
+# define VIRTUOZZO_VER_7 ((unsigned long) 7000000)
 
 struct _vzConn {
     virMutex lock;
@@ -60,6 +61,8 @@ struct _vzConn {
     virObjectEventStatePtr domainEventState;
     const char *drivername;
     unsigned long vzVersion;
+    virStorageFileFormat vmDiskFormat;
+    virStorageFileFormat ctDiskFormat;
 };
 
 typedef struct _vzConn vzConn;
-- 
1.8.3.1




More information about the libvir-list mailing list