mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
conf: extract ignoring of inactive vcpu pinning information
Introduce VIR_DOMAIN_DEF_FEATURE_OFFLINE_VCPUPIN domain feature flag whcih will allow to skip ignoring of the pinning information for hypervisor drivers which will want to implement forward-pinning of vcpus.
This commit is contained in:
parent
185d13b1b0
commit
acf521e121
@ -4213,6 +4213,32 @@ virDomainDeviceDefPostParseInternal(virDomainDeviceDefPtr dev,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virDomainDefRemoveOfflineVcpuPin:
|
||||
* @def: domain definition
|
||||
*
|
||||
* This function removes vcpu pinning information from offline vcpus. This is
|
||||
* designed to be used for drivers which don't support offline vcpupin.
|
||||
*/
|
||||
static void
|
||||
virDomainDefRemoveOfflineVcpuPin(virDomainDefPtr def)
|
||||
{
|
||||
size_t i;
|
||||
virDomainVcpuInfoPtr vcpu;
|
||||
|
||||
for (i = 0; i < virDomainDefGetVcpusMax(def); i++) {
|
||||
vcpu = virDomainDefGetVcpu(def, i);
|
||||
|
||||
if (!vcpu->online && vcpu->cpumask) {
|
||||
virBitmapFree(vcpu->cpumask);
|
||||
vcpu->cpumask = NULL;
|
||||
|
||||
VIR_WARN("Ignoring unsupported vcpupin for offline vcpu '%zu'", i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define UNSUPPORTED(FEATURE) (!((FEATURE) & xmlopt->config.features))
|
||||
/**
|
||||
* virDomainDefPostParseCheckFeatures:
|
||||
@ -4233,6 +4259,9 @@ virDomainDefPostParseCheckFeatures(virDomainDefPtr def,
|
||||
virDomainDefCheckUnsupportedMemoryHotplug(def) < 0)
|
||||
return -1;
|
||||
|
||||
if (UNSUPPORTED(VIR_DOMAIN_DEF_FEATURE_OFFLINE_VCPUPIN))
|
||||
virDomainDefRemoveOfflineVcpuPin(def);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -14247,11 +14276,7 @@ virDomainVcpuPinDefParseXML(virDomainDefPtr def,
|
||||
}
|
||||
VIR_FREE(tmp);
|
||||
|
||||
if (!(vcpu = virDomainDefGetVcpu(def, vcpuid)) ||
|
||||
!vcpu->online) {
|
||||
/* To avoid the regression when daemon loading domain confs, we can't
|
||||
* simply error out if <vcpupin> nodes greater than current vcpus.
|
||||
* Ignore them instead. */
|
||||
if (!(vcpu = virDomainDefGetVcpu(def, vcpuid))) {
|
||||
VIR_WARN("Ignoring vcpupin for missing vcpus");
|
||||
ret = 0;
|
||||
goto cleanup;
|
||||
|
@ -2410,6 +2410,7 @@ typedef bool (*virDomainObjListACLFilter)(virConnectPtr conn,
|
||||
typedef enum {
|
||||
VIR_DOMAIN_DEF_FEATURE_WIDE_SCSI = (1 << 0),
|
||||
VIR_DOMAIN_DEF_FEATURE_MEMORY_HOTPLUG = (1 << 1),
|
||||
VIR_DOMAIN_DEF_FEATURE_OFFLINE_VCPUPIN = (1 << 2),
|
||||
} virDomainDefFeatures;
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user