For disk with startupPolicy support, such as cdrom and floppy
when its chain is broken, the startup policy will apply,
otherwise, report an error on chain issue.
---
src/qemu/qemu_domain.c | 21 ++++++++++++---------
src/qemu/qemu_process.c | 6 ------
2 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index be77991..b607454 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2091,22 +2091,25 @@ qemuDomainCheckDiskPresence(virQEMUDriverPtr driver,
virDomainDiskDefPtr disk;
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+ VIR_DEBUG("Checking for disk presence");
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 */
- continue;
+ if (qemuDomainDetermineDiskChain(driver, disk, false) >= 0)
+ if (qemuDiskChainCheckBroken(disk) >= 0)
+ continue;
+
+ if (disk->startupPolicy) {
+ virResetLastError();
+ if (qemuDomainCheckDiskStartupPolicy(driver, vm, disk,
+ cold_boot) >= 0)
+ continue;
}
- if (qemuDomainCheckDiskStartupPolicy(driver, vm, disk,
- cold_boot) < 0)
- goto cleanup;
+ goto cleanup;
}
ret = 0;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index e8e459e..61a897c 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3621,16 +3621,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