From 1690fc880503ccade44111950a331e5563733d93 Mon Sep 17 00:00:00 2001 Message-Id: <1690fc880503ccade44111950a331e5563733d93@dist-git> From: Martin Kletzander Date: Tue, 2 Aug 2016 13:32:33 +0200 Subject: [PATCH] qemu: Make qemuDomainCheckDiskStartupPolicy self-contained https://bugzilla.redhat.com/show_bug.cgi?id=1168453 There is an error reset following the function and check for startupPolicy before that. Let's reflect those things inside that function so that future code doesn't have to be that complex. Signed-off-by: Martin Kletzander (cherry picked from commit e2705cfb6e50039a5f1d1c620f7ed18b37eca36d) Signed-off-by: Martin Kletzander --- src/qemu/qemu_domain.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 158f3ef..383356d 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4089,6 +4089,7 @@ qemuDomainCheckDiskStartupPolicy(virQEMUDriverPtr driver, return -1; break; + case VIR_DOMAIN_STARTUP_POLICY_DEFAULT: case VIR_DOMAIN_STARTUP_POLICY_MANDATORY: return -1; @@ -4097,14 +4098,13 @@ qemuDomainCheckDiskStartupPolicy(virQEMUDriverPtr driver, return -1; break; - case VIR_DOMAIN_STARTUP_POLICY_DEFAULT: case VIR_DOMAIN_STARTUP_POLICY_LAST: /* this should never happen */ break; } qemuDomainCheckRemoveOptionalDisk(driver, vm, diskIndex); - + virResetLastError(); return 0; } @@ -4138,12 +4138,8 @@ qemuDomainCheckDiskPresence(virQEMUDriverPtr driver, if (qemuDomainDetermineDiskChain(driver, vm, disk, true, true) >= 0) continue; - if (disk->startupPolicy && - qemuDomainCheckDiskStartupPolicy(driver, vm, idx, - cold_boot) >= 0) { - virResetLastError(); + if (qemuDomainCheckDiskStartupPolicy(driver, vm, idx, cold_boot) >= 0) continue; - } goto error; } -- 2.9.2