[libvirt] [PATCH 3/3] util: storagefile: Track whether a virStorageSource was auto-detected

Peter Krempa pkrempa at redhat.com
Thu Oct 12 19:13:32 UTC 2017


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 | 3 +++
 src/util/virstoragefile.h | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index dd4494940..df6a547b0 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -2042,6 +2042,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;
@@ -3418,6 +3419,8 @@ virStorageSourceNewFromBacking(virStorageSourcePtr parent)
             goto error;
     }

+    ret->detected = true;
+
     return ret;

  error:
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index 74dee10f2..5181d6cb9 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -295,6 +295,8 @@ struct _virStorageSource {
     char *tlsAlias;
     char *tlsCertdir;
     bool tlsVerify;
+
+    bool detected; /* true if this entry was not provided by the user */
 };


-- 
2.14.1




More information about the libvir-list mailing list