[libvirt] [RFC 9/7] rfc: add fields to virStorageSource

Eric Blake eblake at redhat.com
Wed Apr 2 04:03:57 UTC 2014


---

...continuing my thoughts from 8/7.  These are the additional
fields required in virStorageSource to copy all fields directly
listed in virStorageFileMetadata that are not already rendered
redundant, as mentioned in those comments.  By populating these
fields directly in virStorageSource, I can follow up with some
patches to s/virStorageFileMetadata/virStorageSource/, and
finally have one struct in use.  From there, I now have the
situation that following the backing chain in order to do
SELinux labeling also leaves the chain populated with the
details I need for enhanced XML output of domain <disk>
information for a live guest.

 src/util/virstoragefile.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index da90374..440504b 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -238,7 +238,27 @@ typedef virStorageSource *virStorageSourcePtr;
  * view.  */
 struct _virStorageSource {
     int type; /* enum virStorageType */
+
+    /* Name of this source, as spelled by the user (for active layer)
+     * or by metadata of the parent file (for backing store), exposed
+     * in xml */
     char *path;
+    /* Canonical name of this file, if on local file system; used to
+     * detect loops in the backing store chain.  Not in xml */
+    char *canonName;
+    /* Directory to start from if backingStoreRaw is a relative file
+     * name. Not in xml */
+    char *relDir;
+    /* Name of backing store recorded in metadata. Not in xml for this
+     * element, but duplicated in backingMeta->path where it is in xml
+     * for the child */
+    char *backingStoreRaw;
+    /* Backing store for this element. If backingStoreRaw is non-NULL
+     * but this is NULL, there was an error following the chain;
+     * otherwise, the two fields should both be NULL or both be
+     * non-NULL.  */
+    virStorageSourcePtr backingMeta;
+
     int protocol; /* enum virStorageNetProtocol */
     size_t nhosts;
     virStorageNetHostDefPtr hosts;
-- 
1.9.0




More information about the libvir-list mailing list