On 10/12/2017 03:13 PM, Peter Krempa wrote:
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;
+
Dang it... Looked at the wrong tab when checking build results, compiler
returns:
util/virstoragefile.c: In function 'virStorageSourceNewFromBacking':
util/virstoragefile.c:3440:19: error: potential null pointer dereference
[-Werror=null-dereference]
ret->detected = true;
here for me.
That needs to be fixed...
John
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 */
};