mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-23 06:23:10 +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,
|
virQEMUCapsIsMachineSupported(virQEMUCapsPtr qemuCaps,
|
||||||
virDomainVirtType virtType,
|
virDomainVirtType virtType,
|
||||||
const char *canonical_machine)
|
const char *canonical_machine)
|
||||||
|
@ -631,6 +631,10 @@ bool virQEMUCapsIsCPUModeSupported(virQEMUCapsPtr qemuCaps,
|
|||||||
const char *virQEMUCapsGetCanonicalMachine(virQEMUCapsPtr qemuCaps,
|
const char *virQEMUCapsGetCanonicalMachine(virQEMUCapsPtr qemuCaps,
|
||||||
virDomainVirtType virtType,
|
virDomainVirtType virtType,
|
||||||
const char *name);
|
const char *name);
|
||||||
|
bool virQEMUCapsIsMachineSupported(virQEMUCapsPtr qemuCaps,
|
||||||
|
virDomainVirtType virtType,
|
||||||
|
const char *canonical_machine)
|
||||||
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3);
|
||||||
int virQEMUCapsGetMachineMaxCpus(virQEMUCapsPtr qemuCaps,
|
int virQEMUCapsGetMachineMaxCpus(virQEMUCapsPtr qemuCaps,
|
||||||
virDomainVirtType virtType,
|
virDomainVirtType virtType,
|
||||||
const char *name);
|
const char *name);
|
||||||
|
@ -5727,6 +5727,14 @@ qemuDomainDefValidate(const virDomainDef *def,
|
|||||||
goto cleanup;
|
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) {
|
if (def->mem.min_guarantee) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("Parameter 'min_guarantee' not supported by QEMU."));
|
_("Parameter 'min_guarantee' not supported by QEMU."));
|
||||||
|
Loading…
Reference in New Issue
Block a user