[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 3/4] qemu: check presence of each disk in chain



For disk with startupPolicy support, such as cdrom and floppy
when its chain is broken, the startup policy  will apply,
otherwise, report error on chain issue.

Force to collect diskchain metadata when qemu process start
everytime.
---
 src/qemu/qemu_domain.c  | 19 ++++++++++---------
 src/qemu/qemu_process.c |  7 -------
 2 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 1fa1a5f..c4adbaa 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2057,20 +2057,21 @@ qemuDomainCheckDiskPresence(virQEMUDriverPtr driver,
     for (i = 0; i < vm->def->ndisks; i++) {
         disk = vm->def->disks[i];
 
-        if (!disk->startupPolicy || !disk->src)
+        if (!disk->src)
             continue;
 
-        if (virFileAccessibleAs(disk->src, F_OK,
-                                cfg->user,
-                                cfg->group) >= 0) {
-            /* disk accessible */
+        if (qemuDomainDetermineDiskChain(driver,
+                                         disk, true) >= 0)
             continue;
+
+        if (disk->startupPolicy) {
+            if (qemuDomainCheckDiskStartupPolicy(driver, vm, disk,
+                                                 disk->startupPolicy,
+                                                 cold_boot) >= 0)
+                continue;
         }
 
-        if (qemuDomainCheckDiskStartupPolicy(driver, vm, disk,
-                                             disk->startupPolicy,
-                                             cold_boot) < 0)
-            goto cleanup;
+        goto cleanup;
     }
 
     ret = 0;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 3d5e8f6..f495267 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3562,17 +3562,10 @@ int qemuProcessStart(virConnectPtr conn,
     if (qemuAssignDeviceAliases(vm->def, priv->qemuCaps) < 0)
         goto cleanup;
 
-    VIR_DEBUG("Checking for CDROM and floppy presence");
     if (qemuDomainCheckDiskPresence(driver, vm,
                                     flags & VIR_QEMU_PROCESS_START_COLD) < 0)
         goto cleanup;
 
-    for (i = 0; i < vm->def->ndisks; i++) {
-        if (qemuDomainDetermineDiskChain(driver, vm->def->disks[i],
-                                         false) < 0)
-            goto cleanup;
-    }
-
     /* Get the advisory nodeset from numad if 'placement' of
      * either <vcpu> or <numatune> is 'auto'.
      */
-- 
1.8.3.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]