]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: process: Call disk startup policy check after cloning domain def
authorPeter Krempa <pkrempa@redhat.com>
Thu, 2 Jun 2016 13:32:00 +0000 (15:32 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 8 Jun 2016 06:15:11 +0000 (08:15 +0200)
In commit 1e38ef72 the disk startup policy check was moved prior to the
call to virDomainObjSetDefTransient which dropped the disk from the
config rather than the def to be started which is a bug.

Additionally we'd not report the disk change event for this since the
disk aliases were not set at that point.

Finally 'volume' based disks would not work with startup policy too.

Fix it by moving it back after the definition is copied, aliases are
assigned and disk sources are translated.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1341415

src/qemu/qemu_process.c

index 84454ab97b1c141b6c02b20f8f979c1af996b948..87c1fe81de077f6371faa091b961137754ddd0de 100644 (file)
@@ -4344,10 +4344,6 @@ qemuProcessStartValidate(virQEMUDriverPtr driver,
             }
         }
 
-        if (qemuDomainCheckDiskPresence(driver, vm,
-                                        flags & VIR_QEMU_PROCESS_START_COLD) < 0)
-            return -1;
-
         VIR_DEBUG("Checking domain and device security labels");
         if (virSecurityManagerCheckAllLabel(driver->securityManager, vm->def) < 0)
             return -1;
@@ -4870,6 +4866,14 @@ qemuProcessPrepareDomain(virConnectPtr conn,
             goto cleanup;
     }
 
+    /* drop possibly missing disks from the definition. This needs to happen
+     * after the def is copied, aliases are set and disk sources are translated */
+    if (!(flags & VIR_QEMU_PROCESS_START_PRETEND)) {
+        if (qemuDomainCheckDiskPresence(driver, vm,
+                                        flags & VIR_QEMU_PROCESS_START_COLD) < 0)
+            goto cleanup;
+    }
+
     VIR_DEBUG("Create domain masterKey");
     if (qemuDomainMasterKeyCreate(vm) < 0)
         goto cleanup;