qemu: Move check that validates 'min_guarantee' to qemuDomainDefValidate

Introduce a validation callback for qemu and move checking of
min_guarantee to the new callback.
This commit is contained in:
Peter Krempa 2016-05-17 15:56:51 +02:00
parent 18f1dda390
commit 5972f185e1
2 changed files with 17 additions and 7 deletions

View File

@ -2168,6 +2168,22 @@ qemuDomainDefPostParse(virDomainDefPtr def,
return ret;
}
static int
qemuDomainDefValidate(const virDomainDef *def,
virCapsPtr caps ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{
if (def->mem.min_guarantee) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Parameter 'min_guarantee' not supported by QEMU."));
return -1;
}
return 0;
}
static const char *
qemuDomainDefaultNetModel(const virDomainDef *def,
virQEMUCapsPtr qemuCaps)
@ -2419,6 +2435,7 @@ virDomainDefParserConfig virQEMUDriverDomainDefParserConfig = {
.devicesPostParseCallback = qemuDomainDeviceDefPostParse,
.domainPostParseCallback = qemuDomainDefPostParse,
.assignAddressesCallback = qemuDomainDefAssignAddresses,
.domainValidateCallback = qemuDomainDefValidate,
.features = VIR_DOMAIN_DEF_FEATURE_MEMORY_HOTPLUG |
VIR_DOMAIN_DEF_FEATURE_OFFLINE_VCPUPIN
};

View File

@ -4307,13 +4307,6 @@ qemuProcessStartValidateXML(virQEMUDriverPtr driver,
virDomainDefValidate(vm->def, caps, 0, driver->xmlopt) < 0)
return -1;
if (vm->def->mem.min_guarantee) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Parameter 'min_guarantee' "
"not supported by QEMU."));
return -1;
}
return 0;
}