mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
conf: Refactor virDomainDefOSValidate()
This makes it explicit that there are two possible scenarios (whether or not firmware autoselection is in use) and will make upcoming changes cleaner to implement. Signed-off-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
421d4f1fa8
commit
f5dcd8b979
@ -1598,21 +1598,23 @@ static int
|
||||
virDomainDefOSValidate(const virDomainDef *def,
|
||||
virDomainXMLOption *xmlopt)
|
||||
{
|
||||
if (def->os.firmware &&
|
||||
!(xmlopt->config.features & VIR_DOMAIN_DEF_FEATURE_FW_AUTOSELECT)) {
|
||||
virReportError(VIR_ERR_XML_DETAIL, "%s",
|
||||
_("firmware auto selection not implemented for this driver"));
|
||||
return -1;
|
||||
}
|
||||
virDomainLoaderDef *loader = def->os.loader;
|
||||
|
||||
if (!def->os.loader)
|
||||
return 0;
|
||||
if (def->os.firmware) {
|
||||
if (!(xmlopt->config.features & VIR_DOMAIN_DEF_FEATURE_FW_AUTOSELECT)) {
|
||||
virReportError(VIR_ERR_XML_DETAIL, "%s",
|
||||
_("firmware auto selection not implemented for this driver"));
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
if (!loader)
|
||||
return 0;
|
||||
|
||||
if (!def->os.loader->path &&
|
||||
def->os.firmware == VIR_DOMAIN_OS_DEF_FIRMWARE_NONE) {
|
||||
virReportError(VIR_ERR_XML_DETAIL, "%s",
|
||||
_("no loader path specified and firmware auto selection disabled"));
|
||||
return -1;
|
||||
if (!loader->path) {
|
||||
virReportError(VIR_ERR_XML_DETAIL, "%s",
|
||||
_("no loader path specified and firmware auto selection disabled"));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user