mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 07:59:00 +00:00
qemu: domain: Validate that machine type is supported by qemu
Every supported qemu is able to return the list of machine types it supports so we can start validating it against that list. The advantage is a better error message, and the change will also prevent having stale test data. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
cb5a89c115
commit
0b9d1a8073
@ -2701,7 +2701,7 @@ virQEMUCapsProbeQMPMachineTypes(virQEMUCapsPtr qemuCaps,
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
bool
|
||||
virQEMUCapsIsMachineSupported(virQEMUCapsPtr qemuCaps,
|
||||
virDomainVirtType virtType,
|
||||
const char *canonical_machine)
|
||||
|
@ -631,6 +631,10 @@ bool virQEMUCapsIsCPUModeSupported(virQEMUCapsPtr qemuCaps,
|
||||
const char *virQEMUCapsGetCanonicalMachine(virQEMUCapsPtr qemuCaps,
|
||||
virDomainVirtType virtType,
|
||||
const char *name);
|
||||
bool virQEMUCapsIsMachineSupported(virQEMUCapsPtr qemuCaps,
|
||||
virDomainVirtType virtType,
|
||||
const char *canonical_machine)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3);
|
||||
int virQEMUCapsGetMachineMaxCpus(virQEMUCapsPtr qemuCaps,
|
||||
virDomainVirtType virtType,
|
||||
const char *name);
|
||||
|
@ -5727,6 +5727,14 @@ qemuDomainDefValidate(const virDomainDef *def,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (qemuCaps &&
|
||||
!virQEMUCapsIsMachineSupported(qemuCaps, def->virtType, def->os.machine)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Emulator '%s' does not support machine type '%s'"),
|
||||
def->emulator, def->os.machine);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (def->mem.min_guarantee) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Parameter 'min_guarantee' not supported by QEMU."));
|
||||
|
Loading…
x
Reference in New Issue
Block a user