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

[libvirt] [PATCH 03/12] qemu: Move assignment of default emulator to the basic post parse callback



---
 src/qemu/qemu_domain.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 40608554c..9e395aec9 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2924,9 +2924,23 @@ qemuDomainDefVerifyFeatures(const virDomainDef *def)
 }


+static int
+qemuDomainDefPostParseBasic(virDomainDefPtr def,
+                            virCapsPtr caps,
+                            void *opaque ATTRIBUTE_UNUSED)
+{
+    /* check for emulator and create a default one if needed */
+    if (!def->emulator &&
+        !(def->emulator = virDomainDefGetDefaultEmulator(def, caps)))
+        return -1;
+
+    return 0;
+}
+
+
 static int
 qemuDomainDefPostParse(virDomainDefPtr def,
-                       virCapsPtr caps,
+                       virCapsPtr caps ATTRIBUTE_UNUSED,
                        unsigned int parseFlags,
                        void *opaque,
                        void *parseOpaque)
@@ -2957,11 +2971,6 @@ qemuDomainDefPostParse(virDomainDefPtr def,
             goto cleanup;
     }

-    /* check for emulator and create a default one if needed */
-    if (!def->emulator &&
-        !(def->emulator = virDomainDefGetDefaultEmulator(def, caps)))
-        goto cleanup;
-
     if (qemuCaps) {
         virObjectRef(qemuCaps);
     } else {
@@ -3716,6 +3725,7 @@ qemuDomainDefAssignAddresses(virDomainDef *def,


 virDomainDefParserConfig virQEMUDriverDomainDefParserConfig = {
+    .domainPostParseBasicCallback = qemuDomainDefPostParseBasic,
     .devicesPostParseCallback = qemuDomainDeviceDefPostParse,
     .domainPostParseCallback = qemuDomainDefPostParse,
     .assignAddressesCallback = qemuDomainDefAssignAddresses,
-- 
2.14.0


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