[PATCH 01/15] conf: add data-file feature and related fields to virStorageSource

Nikolai Barybin via Devel posted 15 patches 20 hours ago
[PATCH 01/15] conf: add data-file feature and related fields to virStorageSource
Posted by Nikolai Barybin via Devel 20 hours ago
Signed-off-by: Nikolai Barybin <nikolai.barybin@virtuozzo.com>
---
 src/conf/storage_source_conf.c | 10 ++++++++++
 src/conf/storage_source_conf.h |  4 ++++
 2 files changed, 14 insertions(+)

diff --git a/src/conf/storage_source_conf.c b/src/conf/storage_source_conf.c
index 5b9a80f100..d4e39b9b57 100644
--- a/src/conf/storage_source_conf.c
+++ b/src/conf/storage_source_conf.c
@@ -829,6 +829,7 @@ virStorageSourceCopy(const virStorageSource *src,
     def->relPath = g_strdup(src->relPath);
     def->backingStoreRaw = g_strdup(src->backingStoreRaw);
     def->backingStoreRawFormat = src->backingStoreRawFormat;
+    def->dataFileRaw = g_strdup(src->dataFileRaw);
     def->snapshot = g_strdup(src->snapshot);
     def->configFile = g_strdup(src->configFile);
     def->nodenameformat = g_strdup(src->nodenameformat);
@@ -894,6 +895,12 @@ virStorageSourceCopy(const virStorageSource *src,
             return NULL;
     }
 
+    if (src->dataFileStore) {
+        if (!(def->dataFileStore = virStorageSourceCopy(src->dataFileStore,
+                                                        false)))
+            return NULL;
+    }
+
     if (src->fdtuple)
         def->fdtuple = g_object_ref(src->fdtuple);
 
@@ -1174,6 +1181,9 @@ virStorageSourceClear(virStorageSource *def)
     VIR_FREE(def->nodenamestorage);
     VIR_FREE(def->nodenameformat);
 
+    VIR_FREE(def->dataFileRaw);
+    g_clear_pointer(&def->dataFileStore, virObjectUnref);
+
     virStorageSourceBackingStoreClear(def);
 
     VIR_FREE(def->tlsAlias);
diff --git a/src/conf/storage_source_conf.h b/src/conf/storage_source_conf.h
index a507116007..aa2aa680de 100644
--- a/src/conf/storage_source_conf.h
+++ b/src/conf/storage_source_conf.h
@@ -359,6 +359,9 @@ struct _virStorageSource {
     /* backing chain of the storage source */
     virStorageSource *backingStore;
 
+    /* qcow2 data file source */
+    virStorageSource *dataFileStore;
+
     /* metadata for storage driver access to remote and local volumes */
     void *drv;
 
@@ -369,6 +372,7 @@ struct _virStorageSource {
     /* Name of the child backing store recorded in metadata of the
      * current file.  */
     char *backingStoreRaw;
+    char *dataFileRaw;
     virStorageFileFormat backingStoreRawFormat;
 
     /* metadata that allows identifying given storage source */
-- 
2.43.5
Re: [PATCH 01/15] conf: add data-file feature and related fields to virStorageSource
Posted by Peter Krempa 18 minutes ago
On Wed, Nov 20, 2024 at 18:48:36 +0300, Nikolai Barybin via Devel wrote:

I'll be adding a commit message:

The 'data-file' is a qcow2 feature which allows storing the actual data
outside of the qcow2 image.

> Signed-off-by: Nikolai Barybin <nikolai.barybin@virtuozzo.com>
> ---
>  src/conf/storage_source_conf.c | 10 ++++++++++
>  src/conf/storage_source_conf.h |  4 ++++
>  2 files changed, 14 insertions(+)

Reviewed-by: Peter Krempa <pkrempa@redhat.com>