[PATCH 6/9] virstoragefile: Add quorum in virstoragefile

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add VIR_STORAGE_TYPE_QUORUM in virStorageType.
Add VIR_STORAGE_FILE_QUORUM in virStorageFileFormat.

Add threshold value in _virStorageSource

Signed-off-by: Matthias Gatto <matthias.gatto@xxxxxxxxxxxx>
---
 src/conf/domain_conf.c    |  2 ++
 src/qemu/qemu_command.c   |  1 +
 src/qemu/qemu_driver.c    |  4 ++++
 src/qemu/qemu_migration.c |  1 +
 src/util/virstoragefile.c | 25 +++++++++++++++++--------
 src/util/virstoragefile.h |  3 +++
 6 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 00e0470..1add21f 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -5445,6 +5445,7 @@ virDomainDiskSourceParse(xmlNodePtr node,
         if (virDomainDiskSourcePoolDefParse(node, &src->srcpool) < 0)
             goto cleanup;
         break;
+    case VIR_STORAGE_TYPE_QUORUM:
     case VIR_STORAGE_TYPE_NONE:
     case VIR_STORAGE_TYPE_LAST:
         virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -16412,6 +16413,7 @@ virDomainDiskSourceFormatInternal(virBufferPtr buf,
                                                  skipSeclabels);
             break;
 
+        case VIR_STORAGE_TYPE_QUORUM:
         case VIR_STORAGE_TYPE_NONE:
         case VIR_STORAGE_TYPE_LAST:
             virReportError(VIR_ERR_INTERNAL_ERROR,
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 1831323..525a49c 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3086,6 +3086,7 @@ qemuGetDriveSourceString(virStorageSourcePtr src,
             goto cleanup;
         break;
 
+    case VIR_STORAGE_TYPE_QUORUM:
     case VIR_STORAGE_TYPE_VOLUME:
     case VIR_STORAGE_TYPE_NONE:
     case VIR_STORAGE_TYPE_LAST:
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 8e3a492..1dc7558 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -12977,6 +12977,7 @@ qemuDomainSnapshotPrepareDiskExternalBackingInactive(virDomainDiskDefPtr disk)
         }
         break;
 
+    case VIR_STORAGE_TYPE_QUORUM:
     case VIR_STORAGE_TYPE_DIR:
     case VIR_STORAGE_TYPE_VOLUME:
     case VIR_STORAGE_TYPE_NONE:
@@ -13040,6 +13041,7 @@ qemuDomainSnapshotPrepareDiskExternalOverlayActive(virDomainSnapshotDiskDefPtr d
         }
         break;
 
+    case VIR_STORAGE_TYPE_QUORUM:
     case VIR_STORAGE_TYPE_DIR:
     case VIR_STORAGE_TYPE_VOLUME:
     case VIR_STORAGE_TYPE_NONE:
@@ -13064,6 +13066,7 @@ qemuDomainSnapshotPrepareDiskExternalOverlayInactive(virDomainSnapshotDiskDefPtr
     case VIR_STORAGE_TYPE_FILE:
         return 0;
 
+    case VIR_STORAGE_TYPE_QUORUM:
     case VIR_STORAGE_TYPE_NETWORK:
     case VIR_STORAGE_TYPE_DIR:
     case VIR_STORAGE_TYPE_VOLUME:
@@ -13183,6 +13186,7 @@ qemuDomainSnapshotPrepareDiskInternal(virConnectPtr conn,
         }
         break;
 
+    case VIR_STORAGE_TYPE_QUORUM:
     case VIR_STORAGE_TYPE_DIR:
     case VIR_STORAGE_TYPE_VOLUME:
     case VIR_STORAGE_TYPE_NONE:
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 0acbb57..5efd753 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1515,6 +1515,7 @@ qemuMigrationPrecreateDisk(virConnectPtr conn,
     case VIR_STORAGE_TYPE_BLOCK:
     case VIR_STORAGE_TYPE_DIR:
     case VIR_STORAGE_TYPE_NETWORK:
+    case VIR_STORAGE_TYPE_QUORUM:
     case VIR_STORAGE_TYPE_NONE:
     case VIR_STORAGE_TYPE_LAST:
         virReportError(VIR_ERR_INTERNAL_ERROR,
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 4217a80..ad87e80 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -57,7 +57,8 @@ VIR_ENUM_IMPL(virStorage, VIR_STORAGE_TYPE_LAST,
               "block",
               "dir",
               "network",
-              "volume")
+              "volume",
+              "quorum")
 
 VIR_ENUM_IMPL(virStorageFileFormat,
               VIR_STORAGE_FILE_LAST,
@@ -66,7 +67,7 @@ VIR_ENUM_IMPL(virStorageFileFormat,
               "cloop", "dmg", "iso",
               "vpc", "vdi",
               /* Not direct file formats, but used for various drivers */
-              "fat", "vhd", "ploop",
+              "fat", "vhd", "ploop", "quorum",
               /* Formats with backing file below here */
               "cow", "qcow", "qcow2", "qed", "vmdk")
 
@@ -1911,6 +1912,7 @@ virStorageSourceCopy(const virStorageSource *src,
                      bool backingChain)
 {
     virStorageSourcePtr ret = NULL;
+    size_t i;
 
     if (VIR_ALLOC(ret) < 0)
         return NULL;
@@ -1922,6 +1924,8 @@ virStorageSourceCopy(const virStorageSource *src,
     ret->capacity = src->capacity;
     ret->readonly = src->readonly;
     ret->shared = src->shared;
+    ret->nBackingStores = src->nBackingStores;
+    ret->threshold = src->threshold;
 
     /* storage driver metadata are not copied */
     ret->drv = NULL;
@@ -1970,12 +1974,14 @@ virStorageSourceCopy(const virStorageSource *src,
         !(ret->auth = virStorageAuthDefCopy(src->auth)))
         goto error;
 
-    if (backingChain && virStorageSourceGetBackingStore(src, 0)) {
-        if (!virStorageSourceSetBackingStore(ret,
-                                             virStorageSourceCopy(virStorageSourceGetBackingStore(src, 0),
-                                                                  true),
-                                             0))
-            goto error;
+    for (i = 0; i < src->nBackingStores; ++i) {
+        if (backingChain && virStorageSourceGetBackingStore(src, i)) {
+            if (!virStorageSourceSetBackingStore(ret,
+                                                 virStorageSourceCopy(virStorageSourceGetBackingStore(src, i),
+                                                                      true),
+                                                 0))
+                goto error;
+        }
     }
 
     return ret;
@@ -2059,6 +2065,9 @@ virStorageSourceIsLocalStorage(virStorageSourcePtr src)
     case VIR_STORAGE_TYPE_FILE:
     case VIR_STORAGE_TYPE_BLOCK:
     case VIR_STORAGE_TYPE_DIR:
+        /* A quorum is actually both, but we consider it as local
+         * because it keep us to add a lot of exeption in the code*/
+    case VIR_STORAGE_TYPE_QUORUM:
         return true;
 
     case VIR_STORAGE_TYPE_NETWORK:
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index d28138f..40d221c 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -49,6 +49,7 @@ typedef enum {
     VIR_STORAGE_TYPE_DIR,
     VIR_STORAGE_TYPE_NETWORK,
     VIR_STORAGE_TYPE_VOLUME,
+    VIR_STORAGE_TYPE_QUORUM,
 
     VIR_STORAGE_TYPE_LAST
 } virStorageType;
@@ -73,6 +74,7 @@ typedef enum {
     VIR_STORAGE_FILE_FAT,
     VIR_STORAGE_FILE_VHD,
     VIR_STORAGE_FILE_PLOOP,
+    VIR_STORAGE_FILE_QUORUM,
 
     /* Not a format, but a marker: all formats below this point have
      * libvirt support for following a backing chain */
@@ -271,6 +273,7 @@ struct _virStorageSource {
     /* backing chain of the storage source */
     virStorageSourcePtr backingStore;
     size_t      nBackingStores;
+    size_t      threshold;
 
     /* metadata for storage driver access to remote and local volumes */
     virStorageDriverDataPtr drv;
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]