On 1/23/19 11:10 AM, Peter Krempa wrote:
The function at first validates the top image of the chain, then
traverses the chain as declared in the XML (if any) and then procedes to
detect the rest of the chain from images. All of the steps have their
own temporary iterator.
Clarify the use scope of the steps by introducing a new temp variable
holding the top level source and adding comments.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_domain.c | 40 +++++++++++++++++++++++-----------------
1 file changed, 23 insertions(+), 17 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 32a43f2064..8e3d0dd374 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -8945,43 +8945,49 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
bool report_broken)
{
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
- virStorageSourcePtr src = disk->src;
- virStorageSourcePtr n;
+ virStorageSourcePtr disksrc = NULL; /* disk source */
NIT: Chould be disksrc = disk->src here and then in the next patch it's
removed and [1] becomes part of the next patch.
+ virStorageSourcePtr src; /* iterator for the backing chain
declared in XML */
+ virStorageSourcePtr n; /* iterator for the backing chain detected from disk */
qemuDomainObjPrivatePtr priv = vm->privateData;
int ret = -1;
uid_t uid;
gid_t gid;
- if (virStorageSourceIsEmpty(src)) {
+ if (!disksrc)
+ disksrc = disk->src;
[1] always going to happen with this patch...
Reviewed-by: John Ferlan <jferlan(a)redhat.com>
John
[...]