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

Nikolai Barybin via Devel posted 13 patches 1 year, 5 months ago
There is a newer version of this series
[PATCH v2 01/13] conf: add data-file feature and related fields to virStorageSource
Posted by Nikolai Barybin via Devel 1 year, 5 months ago
Signed-off-by: Nikolai Barybin <nikolai.barybin@virtuozzo.com>
---
 src/conf/storage_source_conf.c | 11 +++++++++++
 src/conf/storage_source_conf.h |  5 +++++
 2 files changed, 16 insertions(+)

diff --git a/src/conf/storage_source_conf.c b/src/conf/storage_source_conf.c
index 908bc5fab2..5d197ee3ca 100644
--- a/src/conf/storage_source_conf.c
+++ b/src/conf/storage_source_conf.c
@@ -69,6 +69,7 @@ VIR_ENUM_IMPL(virStorageFileFeature,
               VIR_STORAGE_FILE_FEATURE_LAST,
               "lazy_refcounts",
               "extended_l2",
+              "data_file",
 );
 
 
@@ -826,6 +827,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);
@@ -891,6 +893,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);
 
@@ -1171,6 +1179,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 05b4bda16c..fa27e61204 100644
--- a/src/conf/storage_source_conf.h
+++ b/src/conf/storage_source_conf.h
@@ -88,6 +88,7 @@ VIR_ENUM_DECL(virStorageFileFormat);
 typedef enum {
     VIR_STORAGE_FILE_FEATURE_LAZY_REFCOUNTS = 0,
     VIR_STORAGE_FILE_FEATURE_EXTENDED_L2,
+    VIR_STORAGE_FILE_FEATURE_DATA_FILE,
 
     VIR_STORAGE_FILE_FEATURE_LAST
 } virStorageFileFeature;
@@ -359,6 +360,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 +373,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 v2 01/13] conf: add data-file feature and related fields to virStorageSource
Posted by Peter Krempa 1 year, 3 months ago
On Sat, Sep 07, 2024 at 17:15:17 +0300, Nikolai Barybin via Devel wrote:
> Signed-off-by: Nikolai Barybin <nikolai.barybin@virtuozzo.com>
> ---
>  src/conf/storage_source_conf.c | 11 +++++++++++
>  src/conf/storage_source_conf.h |  5 +++++
>  2 files changed, 16 insertions(+)
> 
> diff --git a/src/conf/storage_source_conf.c b/src/conf/storage_source_conf.c
> index 908bc5fab2..5d197ee3ca 100644
> --- a/src/conf/storage_source_conf.c
> +++ b/src/conf/storage_source_conf.c
> @@ -69,6 +69,7 @@ VIR_ENUM_IMPL(virStorageFileFeature,
>                VIR_STORAGE_FILE_FEATURE_LAST,
>                "lazy_refcounts",
>                "extended_l2",
> +              "data_file",
>  );

[..]

>  
> diff --git a/src/conf/storage_source_conf.h b/src/conf/storage_source_conf.h
> index 05b4bda16c..fa27e61204 100644
> --- a/src/conf/storage_source_conf.h
> +++ b/src/conf/storage_source_conf.h
> @@ -88,6 +88,7 @@ VIR_ENUM_DECL(virStorageFileFormat);
>  typedef enum {
>      VIR_STORAGE_FILE_FEATURE_LAZY_REFCOUNTS = 0,
>      VIR_STORAGE_FILE_FEATURE_EXTENDED_L2,
> +    VIR_STORAGE_FILE_FEATURE_DATA_FILE,

These hunks seems to belong to a different commit as this has nothing
to do with fields in 'struct virStorageSource'. Please move them
appropriately.

Rest looks good.