}
+static int
+qemuCanonicalizeMachine(virDomainDefPtr def, virQEMUCapsPtr qemuCaps)
+{
+ const char *canon;
+
+ if (!(canon = virQEMUCapsGetCanonicalMachine(qemuCaps, def->os.machine)))
+ return 0;
+
+ if (STRNEQ(canon, def->os.machine)) {
+ char *tmp;
+ if (VIR_STRDUP(tmp, canon) < 0)
+ return -1;
+ VIR_FREE(def->os.machine);
+ def->os.machine = tmp;
+ }
+
+ return 0;
+}
+
+
static int
qemuDomainDefPostParse(virDomainDefPtr def,
virCapsPtr caps,
if (qemuDomainDefAddDefaultDevices(def, qemuCaps) < 0)
goto cleanup;
+ if (qemuCanonicalizeMachine(def, qemuCaps) < 0)
+ goto cleanup;
+
ret = 0;
cleanup:
virObjectUnref(qemuCaps);
}
-static int
-qemuCanonicalizeMachine(virDomainDefPtr def, virQEMUCapsPtr qemuCaps)
-{
- const char *canon;
-
- if (!(canon = virQEMUCapsGetCanonicalMachine(qemuCaps, def->os.machine)))
- return 0;
-
- if (STRNEQ(canon, def->os.machine)) {
- char *tmp;
- if (VIR_STRDUP(tmp, canon) < 0)
- return -1;
- VIR_FREE(def->os.machine);
- def->os.machine = tmp;
- }
-
- return 0;
-}
-
-
static virDomainPtr qemuDomainCreateXML(virConnectPtr conn,
const char *xml,
unsigned int flags)
if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache, def->emulator)))
goto cleanup;
- if (qemuCanonicalizeMachine(def, qemuCaps) < 0)
- goto cleanup;
-
if (qemuDomainAssignAddresses(def, qemuCaps, NULL) < 0)
goto cleanup;
if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache, def->emulator)))
goto cleanup;
- if (qemuCanonicalizeMachine(def, qemuCaps) < 0)
- goto cleanup;
-
if (qemuDomainAssignAddresses(def, qemuCaps, NULL) < 0)
goto cleanup;
if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache, def->emulator)))
goto cleanup;
- if (qemuCanonicalizeMachine(def, qemuCaps) < 0)
- goto cleanup;
-
if (qemuAssignDeviceAliases(def, qemuCaps) < 0)
goto cleanup;