[libvirt] [PATCH 12/18] util: storagefile: Add fields from virStorageMetadata to virStorageSource

Peter Krempa pkrempa at redhat.com
Sun Apr 20 22:13:16 UTC 2014


Add the required fields that are missing from the new structure that
will allow us to switch the storage file metadata code entirely to the
new structure.

Add "relPath" and "relDir" and the raw backing store name. Also allow
creating linked lists of virStorageSourcePtrs to express backing chains.
---
 src/util/virstoragefile.c |  7 +++++++
 src/util/virstoragefile.h | 14 ++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 7f853a4..f519d82 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -1711,6 +1711,13 @@ virStorageSourceClear(virStorageSourcePtr def)

     virStorageNetHostDefFree(def->nhosts, def->hosts);
     virStorageSourceAuthClear(def);
+
+    VIR_FREE(def->relPath);
+    VIR_FREE(def->relDir);
+    VIR_FREE(def->backingStoreRaw);
+
+    /* recursively free backing chain */
+    virStorageSourceFree(def->backingMeta);
 }


diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index 0e5136e..11e25eb 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -271,8 +271,22 @@ struct _virStorageSource {
     size_t nseclabels;
     virSecurityDeviceLabelDefPtr *seclabels;

+    /* backing chain of the storage source */
+    virStorageSourcePtr backingMeta;
+
     /* metadata for storage driver access to remote and local volumes */
     virStorageDriverDataPtr drv;
+
+    /* metadata about storage image which need separate fields */
+    /* Name of the current file as spelled by the user (top level) or
+     * metadata of the overlay (if this is a backing store).  */
+    char *relPath;
+    /* Directory to start from if backingStoreRaw is a relative file
+     * name.  */
+    char *relDir;
+    /* Name of the child backing store recorded in metadata of the
+     * current file.  */
+    char *backingStoreRaw;
 };


-- 
1.9.1




More information about the libvir-list mailing list