From 4a5cbba4bcdf8548dd86d44833700504a9b32fa1 Mon Sep 17 00:00:00 2001 From: Peter Krempa <pkrempa@redhat.com> Date: Tue, 26 Sep 2017 13:52:43 +0200 Subject: [PATCH] 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. --- 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 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 */ };