render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
404507
From 3ad4635badd77642d59d3789286da72abb66ee72 Mon Sep 17 00:00:00 2001
404507
Message-Id: <3ad4635badd77642d59d3789286da72abb66ee72@dist-git>
404507
From: Peter Krempa <pkrempa@redhat.com>
404507
Date: Fri, 1 Dec 2017 15:57:02 +0100
404507
Subject: [PATCH] qemu: process: Move handling of non-backing files into
404507
 qemuDomainDetermineDiskChain
404507
404507
Until now we would skip loading of the backing chain for files which
404507
don't support backing chains only when starting up the VM. Move the
404507
check from qemuProcessPrepareHostStorage with some adaptations so that's
404507
always applied.
404507
404507
(cherry picked from commit 24e47ee2b93312742f73a785b9ca788df4677749)
404507
404507
 Conflicts:
404507
	src/qemu/qemu_domain.c:
404507
        - since quite lot of the blockdev saga was not backported and
404507
        the previous commit is different this one does not apply as
404507
        well.
404507
404507
        The changes are to accomodate the not-backported change in
404507
        return code logic of qemuDomainDetermineDiskChain which in this
404507
        instance initializes ret to 0 instead of -1, which was changed
404507
        in a patch that was not backported.
404507
404507
https://bugzilla.redhat.com/show_bug.cgi?id=1509110
404507
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
404507
---
404507
 src/qemu/qemu_domain.c  | 17 +++++++++++++++++
404507
 src/qemu/qemu_process.c | 10 ----------
404507
 2 files changed, 17 insertions(+), 10 deletions(-)
404507
404507
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
404507
index 13d120040b..33cb3df949 100644
404507
--- a/src/qemu/qemu_domain.c
404507
+++ b/src/qemu/qemu_domain.c
404507
@@ -6358,6 +6358,23 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
404507
     if (force_probe)
404507
         virStorageSourceBackingStoreClear(disk->src);
404507
 
404507
+    /* There is no need to check the backing chain for disks without backing
404507
+     * support */
404507
+    if (virStorageSourceIsLocalStorage(disk->src) &&
404507
+        disk->src->format > VIR_STORAGE_FILE_NONE &&
404507
+        disk->src->format < VIR_STORAGE_FILE_BACKING) {
404507
+
404507
+        if (!virFileExists(disk->src->path)) {
404507
+            if (report_broken)
404507
+                virStorageFileReportBrokenChain(errno, disk->src, disk->src);
404507
+
404507
+            ret = -1;
404507
+            goto cleanup;
404507
+        }
404507
+
404507
+        goto cleanup;
404507
+    }
404507
+
404507
     if (virStorageSourceHasBacking(disk->src))
404507
         goto cleanup;
404507
 
404507
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
404507
index f7808227a8..91426ad3c3 100644
404507
--- a/src/qemu/qemu_process.c
404507
+++ b/src/qemu/qemu_process.c
404507
@@ -5554,20 +5554,10 @@ qemuProcessPrepareHostStorage(virQEMUDriverPtr driver,
404507
     for (i = vm->def->ndisks; i > 0; i--) {
404507
         size_t idx = i - 1;
404507
         virDomainDiskDefPtr disk = vm->def->disks[idx];
404507
-        virStorageFileFormat format = virDomainDiskGetFormat(disk);
404507
 
404507
         if (virStorageSourceIsEmpty(disk->src))
404507
             continue;
404507
 
404507
-        /* There is no need to check the backing chain for disks
404507
-         * without backing support, the fact that the file exists is
404507
-         * more than enough */
404507
-        if (virStorageSourceIsLocalStorage(disk->src) &&
404507
-            format > VIR_STORAGE_FILE_NONE &&
404507
-            format < VIR_STORAGE_FILE_BACKING &&
404507
-            virFileExists(virDomainDiskGetSource(disk)))
404507
-            continue;
404507
-
404507
         if (qemuDomainDetermineDiskChain(driver, vm, disk, true, true) >= 0)
404507
             continue;
404507
 
404507
-- 
404507
2.15.1
404507