]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: extract ignoring of inactive vcpu pinning information
authorPeter Krempa <pkrempa@redhat.com>
Tue, 23 Feb 2016 11:35:40 +0000 (12:35 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 9 Mar 2016 09:09:16 +0000 (10:09 +0100)
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.

src/conf/domain_conf.c
src/conf/domain_conf.h

index 595d8a410d435a1a52aaabc5cb24fd74da1b137c..314a584d155951a2fadeb266d92d9ccb39cfff39 100644 (file)
@@ -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;
index 61eb766ae006be8e6799033c2ec69aefc7662b59..832ca4f20c24e32acec090a5baae15feb3d76232 100644 (file)
@@ -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;