[libvirt] [PATCH 18/30] storagefile: Add externalDataStore member

Cole Robinson crobinso at redhat.com
Mon Oct 7 21:49:32 UTC 2019


Add the plumbing to track a externalDataStoreRaw as a virStorageSource

Signed-off-by: Cole Robinson <crobinso at redhat.com>
---
 src/util/virstoragefile.c | 9 +++++++++
 src/util/virstoragefile.h | 3 +++
 2 files changed, 12 insertions(+)

diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 7ae6719dd6..ce669b6e0b 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -2339,6 +2339,12 @@ virStorageSourceCopy(const virStorageSource *src,
             return NULL;
     }
 
+    if (src->externalDataStore) {
+        if (!(def->externalDataStore = virStorageSourceCopy(src->externalDataStore,
+                                                            true)))
+            return NULL;
+    }
+
     VIR_STEAL_PTR(ret, def);
     return ret;
 }
@@ -2560,6 +2566,9 @@ virStorageSourceClear(virStorageSourcePtr def)
     VIR_FREE(def->timestamps);
     VIR_FREE(def->externalDataStoreRaw);
 
+    virObjectUnref(def->externalDataStore);
+    def->externalDataStore = NULL;
+
     virStorageNetHostDefFree(def->nhosts, def->hosts);
     virStorageAuthDefFree(def->auth);
     virObjectUnref(def->privateData);
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index bbff511657..d84dad052d 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -292,6 +292,9 @@ struct _virStorageSource {
     /* backing chain of the storage source */
     virStorageSourcePtr backingStore;
 
+    /* external data store storage source */
+    virStorageSourcePtr externalDataStore;
+
     /* metadata for storage driver access to remote and local volumes */
     virStorageDriverDataPtr drv;
 
-- 
2.23.0




More information about the libvir-list mailing list