diff --git a/src/bhyve/bhyve_domain.c b/src/bhyve/bhyve_domain.c index c47ad392a0..684d870749 100644 --- a/src/bhyve/bhyve_domain.c +++ b/src/bhyve/bhyve_domain.c @@ -89,7 +89,8 @@ bhyveDomainDefPostParse(virDomainDef *def, if (!virCapabilitiesDomainSupported(caps, def->os.type, def->os.arch, - def->virtType)) + def->virtType, + true)) return -1; /* Add an implicit PCI root controller */ diff --git a/src/ch/ch_domain.c b/src/ch/ch_domain.c index acadd76edc..8e3e205c8c 100644 --- a/src/ch/ch_domain.c +++ b/src/ch/ch_domain.c @@ -125,11 +125,14 @@ virCHDomainDefPostParse(virDomainDef *def, { virCHDriver *driver = opaque; g_autoptr(virCaps) caps = virCHDriverGetCapabilities(driver, false); + if (!caps) return -1; + if (!virCapabilitiesDomainSupported(caps, def->os.type, def->os.arch, - def->virtType)) + def->virtType, + true)) return -1; return 0; diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c index 9394924f2d..ae550802f5 100644 --- a/src/ch/ch_driver.c +++ b/src/ch/ch_driver.c @@ -890,9 +890,9 @@ static int chStateInitialize(bool privileged, goto cleanup; if (!virCapabilitiesDomainSupported(ch_driver->caps, -1, - VIR_ARCH_NONE, VIR_DOMAIN_VIRT_KVM) && + VIR_ARCH_NONE, VIR_DOMAIN_VIRT_KVM, false) && !virCapabilitiesDomainSupported(ch_driver->caps, -1, - VIR_ARCH_NONE, VIR_DOMAIN_VIRT_HYPERV)) { + VIR_ARCH_NONE, VIR_DOMAIN_VIRT_HYPERV, false)) { VIR_INFO("/dev/kvm and /dev/mshv are missing. CH driver failed to initialize."); return VIR_DRV_STATE_INIT_SKIPPED; } diff --git a/src/ch/ch_process.c b/src/ch/ch_process.c index 7488b1d65d..b532f547b3 100644 --- a/src/ch/ch_process.c +++ b/src/ch/ch_process.c @@ -660,7 +660,7 @@ virCHProcessStartValidate(virCHDriver *driver, if (vm->def->virtType == VIR_DOMAIN_VIRT_KVM) { VIR_DEBUG("Checking for KVM availability"); if (!virCapabilitiesDomainSupported(driver->caps, -1, - VIR_ARCH_NONE, VIR_DOMAIN_VIRT_KVM)) { + VIR_ARCH_NONE, VIR_DOMAIN_VIRT_KVM, false)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Domain requires KVM, but it is not available. Check that virtualization is enabled in the host BIOS, and host configuration is setup to load the kvm modules.")); return -1; @@ -668,7 +668,7 @@ virCHProcessStartValidate(virCHDriver *driver, } else if (vm->def->virtType == VIR_DOMAIN_VIRT_HYPERV) { VIR_DEBUG("Checking for mshv availability"); if (!virCapabilitiesDomainSupported(driver->caps, -1, - VIR_ARCH_NONE, VIR_DOMAIN_VIRT_HYPERV)) { + VIR_ARCH_NONE, VIR_DOMAIN_VIRT_HYPERV, false)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Domain requires MSHV device, but it is not available. Check that virtualization is enabled in the host BIOS, and host configuration is setup to load the mshv modules.")); return -1; diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c index 88c6b84c7c..fe5e42c167 100644 --- a/src/conf/capabilities.c +++ b/src/conf/capabilities.c @@ -769,7 +769,8 @@ bool virCapabilitiesDomainSupported(virCaps *caps, int ostype, virArch arch, - int virttype) + int virttype, + bool reportError) { g_autofree virCapsDomainData *capsdata = NULL; @@ -777,7 +778,7 @@ virCapabilitiesDomainSupported(virCaps *caps, arch, virttype, NULL, NULL, - true); + reportError); return capsdata != NULL; } diff --git a/src/conf/capabilities.h b/src/conf/capabilities.h index c67b3ce397..daea835817 100644 --- a/src/conf/capabilities.h +++ b/src/conf/capabilities.h @@ -316,7 +316,8 @@ bool virCapabilitiesDomainSupported(virCaps *caps, int ostype, virArch arch, - int domaintype); + int domaintype, + bool reportError); void diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index ad2ad1ce0e..16c2ab973b 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -309,7 +309,8 @@ libxlDomainDefValidate(const virDomainDef *def, if (!virCapabilitiesDomainSupported(cfg->caps, def->os.type, def->os.arch, - def->virtType)) + def->virtType, + true)) return -1; /* Xen+ovmf does not support secure boot */ diff --git a/src/lxc/lxc_domain.c b/src/lxc/lxc_domain.c index cf9bf96a4e..afd8d6e980 100644 --- a/src/lxc/lxc_domain.c +++ b/src/lxc/lxc_domain.c @@ -238,7 +238,8 @@ virLXCDomainDefPostParse(virDomainDef *def, return -1; if (!virCapabilitiesDomainSupported(caps, def->os.type, def->os.arch, - def->virtType)) + def->virtType, + true)) return -1; /* check for emulator and create a default one if needed */ diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c index eab3f748d0..81769eb147 100644 --- a/src/openvz/openvz_conf.c +++ b/src/openvz/openvz_conf.c @@ -1007,7 +1007,8 @@ openvzDomainDefPostParse(virDomainDef *def, struct openvz_driver *driver = opaque; if (!virCapabilitiesDomainSupported(driver->caps, def->os.type, def->os.arch, - def->virtType)) + def->virtType, + true)) return -1; /* fill the init path */ diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c index 416ce126e8..e28c732cb0 100644 --- a/src/vmware/vmware_driver.c +++ b/src/vmware/vmware_driver.c @@ -106,7 +106,8 @@ vmwareDomainDefPostParse(virDomainDef *def, struct vmware_driver *driver = opaque; if (!virCapabilitiesDomainSupported(driver->caps, def->os.type, def->os.arch, - def->virtType)) + def->virtType, + true)) return -1; return 0; diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index 69ee66e668..5da67aae60 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -613,7 +613,8 @@ virVMXDomainDefPostParse(virDomainDef *def, virCaps *caps = opaque; if (!virCapabilitiesDomainSupported(caps, def->os.type, def->os.arch, - def->virtType)) + def->virtType, + true)) return -1; return 0; diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c index c7ceec2339..380fdcb57e 100644 --- a/src/vz/vz_driver.c +++ b/src/vz/vz_driver.c @@ -241,7 +241,8 @@ vzDomainDefPostParse(virDomainDef *def, struct _vzDriver *driver = opaque; if (!virCapabilitiesDomainSupported(driver->caps, def->os.type, def->os.arch, - def->virtType)) + def->virtType, + true)) return -1; if (vzDomainDefAddDefaultInputDevices(def) < 0)