Blame SOURCES/libvirt-qemu-domain-Refactor-control-flow-in-qemuDomainDetermineDiskChain.patch

c1c534
From 3dcba116fd4e0a6df50b905b021151b30ef55714 Mon Sep 17 00:00:00 2001
c1c534
Message-Id: <3dcba116fd4e0a6df50b905b021151b30ef55714@dist-git>
c1c534
From: Peter Krempa <pkrempa@redhat.com>
c1c534
Date: Fri, 1 Dec 2017 15:57:01 +0100
c1c534
Subject: [PATCH] qemu: domain: Refactor control flow in
c1c534
 qemuDomainDetermineDiskChain
c1c534
c1c534
Split out clearing of the backing chain prior to other code since it
c1c534
will be required later and optimize few layers of nested conditions and
c1c534
loops.
c1c534
c1c534
(cherry picked from commit b19710b9b6039728620a8d557a322ef139529226)
c1c534
c1c534
 Conflicts:
c1c534
	src/qemu/qemu_domain.c:
c1c534
        a92c4f7537577f1443ddd6fef4e0dfcb054e5f08 was not backported thus
c1c534
        the code skipping to the end of the backing chain is missing
c1c534
c1c534
        This patch only moves the block that clears the backing store
c1c534
        earlier so that the rest of the patches will apply
c1c534
c1c534
https://bugzilla.redhat.com/show_bug.cgi?id=1509110
c1c534
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
c1c534
---
c1c534
 src/qemu/qemu_domain.c | 11 +++++------
c1c534
 1 file changed, 5 insertions(+), 6 deletions(-)
c1c534
c1c534
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
c1c534
index 1b5f439621..13d120040b 100644
c1c534
--- a/src/qemu/qemu_domain.c
c1c534
+++ b/src/qemu/qemu_domain.c
c1c534
@@ -6355,12 +6355,11 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
c1c534
     if (virStorageSourceIsEmpty(disk->src))
c1c534
         goto cleanup;
c1c534
 
c1c534
-    if (virStorageSourceHasBacking(disk->src)) {
c1c534
-        if (force_probe)
c1c534
-            virStorageSourceBackingStoreClear(disk->src);
c1c534
-        else
c1c534
-            goto cleanup;
c1c534
-    }
c1c534
+    if (force_probe)
c1c534
+        virStorageSourceBackingStoreClear(disk->src);
c1c534
+
c1c534
+    if (virStorageSourceHasBacking(disk->src))
c1c534
+        goto cleanup;
c1c534
 
c1c534
     qemuDomainGetImageIds(cfg, vm, disk->src, &uid, &gid;;
c1c534
 
c1c534
-- 
c1c534
2.15.1
c1c534