From: Peter Krempa Date: Tue, 26 Sep 2017 11:52:43 +0000 (+0200) Subject: util: storagefile: Track whether a virStorageSource was auto-detected X-Git-Tag: v3.9.0-rc1~120 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a5cbba4bcdf8548dd86d44833700504a9b32fa1;p=thirdparty%2Flibvirt.git util: storagefile: Track whether a virStorageSource was auto-detected 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. --- diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index bc56da70d0..d2b21a8169 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -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; diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index 86e60de2ad..1e36a6671e 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -296,6 +296,8 @@ struct _virStorageSource { char *tlsAlias; char *tlsCertdir; bool tlsVerify; + + bool detected; /* true if this entry was not provided by the user */ };