mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
qemu: Introduce qemuDomainDefMachinePostParse()
Move all the machine type related parts of qemuDomainDefPostParse() to a separate helper. Signed-off-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
6f1c6534a8
commit
7e12610387
@ -4425,6 +4425,31 @@ qemuDomainRecheckInternalPaths(virDomainDef *def,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuDomainDefMachinePostParse(virDomainDef *def,
|
||||
virQEMUCaps *qemuCaps)
|
||||
{
|
||||
if (!def->os.machine) {
|
||||
const char *machine = virQEMUCapsGetPreferredMachine(qemuCaps,
|
||||
def->virtType);
|
||||
if (!machine) {
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
_("could not get preferred machine for %s type=%s"),
|
||||
def->emulator,
|
||||
virDomainVirtTypeToString(def->virtType));
|
||||
return -1;
|
||||
}
|
||||
|
||||
def->os.machine = g_strdup(machine);
|
||||
}
|
||||
|
||||
if (qemuCanonicalizeMachine(def, qemuCaps) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuDomainDefVcpusPostParse(virDomainDef *def)
|
||||
{
|
||||
@ -4767,26 +4792,15 @@ qemuDomainDefPostParse(virDomainDef *def,
|
||||
if (!qemuCaps)
|
||||
return 1;
|
||||
|
||||
if (qemuDomainDefMachinePostParse(def, qemuCaps) < 0)
|
||||
return -1;
|
||||
|
||||
if (def->os.bootloader || def->os.bootloaderArgs) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("bootloader is not supported by QEMU"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!def->os.machine) {
|
||||
const char *machine = virQEMUCapsGetPreferredMachine(qemuCaps,
|
||||
def->virtType);
|
||||
if (!machine) {
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
_("could not get preferred machine for %s type=%s"),
|
||||
def->emulator,
|
||||
virDomainVirtTypeToString(def->virtType));
|
||||
return -1;
|
||||
}
|
||||
|
||||
def->os.machine = g_strdup(machine);
|
||||
}
|
||||
|
||||
if (virDomainDefHasOldStyleROUEFI(def) &&
|
||||
!def->os.loader->nvram &&
|
||||
def->os.loader->stateless != VIR_TRISTATE_BOOL_YES) {
|
||||
@ -4799,9 +4813,6 @@ qemuDomainDefPostParse(virDomainDef *def,
|
||||
if (qemuDomainDefAddDefaultDevices(driver, def, qemuCaps) < 0)
|
||||
return -1;
|
||||
|
||||
if (qemuCanonicalizeMachine(def, qemuCaps) < 0)
|
||||
return -1;
|
||||
|
||||
if (qemuDomainDefSetDefaultCPU(def, driver->hostarch, qemuCaps) < 0)
|
||||
return -1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user