Introduce VIR_DOMAIN_DEF_FEATURE_OFFLINE_CPUPIN 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. --- src/conf/domain_conf.c | 28 +++++++++++++++++++++++----- src/conf/domain_conf.h | 1 + 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 101fae2..4220448 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -4215,6 +4215,25 @@ virDomainDeviceDefPostParseInternal(virDomainDeviceDefPtr dev, } +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: @@ -4235,6 +4254,9 @@ virDomainDefPostParseCheckFeatures(virDomainDefPtr def, virDomainDefCheckUnsupportedMemoryHotplug(def) < 0) return -1; + if (UNSUPPORTED(VIR_DOMAIN_DEF_FEATURE_OFFLINE_CPUPIN)) + virDomainDefRemoveOfflineVcpuPin(def); + return 0; } @@ -14216,11 +14238,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; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index c660a02..44a92d3 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2406,6 +2406,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_CPUPIN = (1 << 2), } virDomainDefFeatures; -- 2.6.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list