[PATCH 1/3] qemu: Make qemuDomainCheckDiskStartupPolicy self-contained

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

 



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 <mkletzan@xxxxxxxxxx>
---
 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 9b439df3b3a8..adbc63fdaa7f 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4183,6 +4183,7 @@ qemuDomainCheckDiskStartupPolicy(virQEMUDriverPtr driver,
                 return -1;
             break;

+        case VIR_DOMAIN_STARTUP_POLICY_DEFAULT:
         case VIR_DOMAIN_STARTUP_POLICY_MANDATORY:
             return -1;

@@ -4191,14 +4192,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;
 }

@@ -4232,12 +4232,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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]