]> xenbits.xensource.com Git - libvirt.git/commitdiff
util: storagefile: Track whether a virStorageSource was auto-detected
authorPeter Krempa <pkrempa@redhat.com>
Tue, 26 Sep 2017 11:52:43 +0000 (13:52 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 18 Oct 2017 07:44:29 +0000 (09:44 +0200)
When formatting an inactive or migratable XML we will need to suppress
backing chain members which were detected from the disk to keep
semantics straight. This means we need to record, whether a
virStorageSource originates from autodetection.

src/util/virstoragefile.c
src/util/virstoragefile.h

index bc56da70d0ebca11e8f9737430678f2e7f53f183..d2b21a81693efd5f70441cf037420f8825d91fce 100644 (file)
@@ -2060,6 +2060,7 @@ virStorageSourceCopy(const virStorageSource *src,
     ret->haveTLS = src->haveTLS;
     ret->tlsFromConfig = src->tlsFromConfig;
     ret->tlsVerify = src->tlsVerify;
+    ret->detected = src->detected;
 
     /* storage driver metadata are not copied */
     ret->drv = NULL;
@@ -3434,6 +3435,8 @@ virStorageSourceNewFromBacking(virStorageSourcePtr parent)
         /* copy parent's labelling and other top level stuff */
         if (virStorageSourceInitChainElement(ret, parent, true) < 0)
             goto error;
+
+        ret->detected = true;
     }
 
     return ret;
index 86e60de2ad6a22ade1440f97ec0ca270f3f7d565..1e36a6671e8b37f418aa0c9412c5750063261a6b 100644 (file)
@@ -296,6 +296,8 @@ struct _virStorageSource {
     char *tlsAlias;
     char *tlsCertdir;
     bool tlsVerify;
+
+    bool detected; /* true if this entry was not provided by the user */
 };