]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: process: Move handling of non-backing files into qemuDomainDetermineDiskChain
authorPeter Krempa <pkrempa@redhat.com>
Fri, 24 Nov 2017 11:04:14 +0000 (12:04 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 30 Nov 2017 21:40:23 +0000 (22:40 +0100)
Until now we would skip loading of the backing chain for files which
don't support backing chains only when starting up the VM. Move the
check from qemuProcessPrepareHostStorage with some adaptations so that's
always applied.

src/qemu/qemu_domain.c
src/qemu/qemu_process.c

index 5dc3d73f48fb0ae5cd7288c2dad7def3f9ba17c6..2dd02a3f69d90da59b0e53593e41a09e9b29ea02 100644 (file)
@@ -6372,6 +6372,23 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
     if (force_probe)
         virStorageSourceBackingStoreClear(src);
 
+    /* There is no need to check the backing chain for disks without backing
+     * support */
+    if (virStorageSourceIsLocalStorage(src) &&
+        src->format > VIR_STORAGE_FILE_NONE &&
+        src->format < VIR_STORAGE_FILE_BACKING) {
+
+        if (!virFileExists(src->path)) {
+            if (report_broken)
+                virStorageFileReportBrokenChain(errno, src, disk->src);
+
+            goto cleanup;
+        }
+
+        ret = 0;
+        goto cleanup;
+    }
+
     /* skip to the end of the chain if there is any */
     while (virStorageSourceHasBacking(src)) {
         if (report_broken &&
index 8574f2b413105f609aa9c141105bca772588252c..ea70885dd950150334a4e8b78e161d3242632cf0 100644 (file)
@@ -5555,20 +5555,10 @@ qemuProcessPrepareHostStorage(virQEMUDriverPtr driver,
     for (i = vm->def->ndisks; i > 0; i--) {
         size_t idx = i - 1;
         virDomainDiskDefPtr disk = vm->def->disks[idx];
-        virStorageFileFormat format = virDomainDiskGetFormat(disk);
 
         if (virStorageSourceIsEmpty(disk->src))
             continue;
 
-        /* There is no need to check the backing chain for disks
-         * without backing support, the fact that the file exists is
-         * more than enough */
-        if (virStorageSourceIsLocalStorage(disk->src) &&
-            format > VIR_STORAGE_FILE_NONE &&
-            format < VIR_STORAGE_FILE_BACKING &&
-            virFileExists(virDomainDiskGetSource(disk)))
-            continue;
-
         if (qemuDomainDetermineDiskChain(driver, vm, disk, true, true) >= 0)
             continue;