]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
conf: Ignore vcpupin for not onlined vcpus when parsing
authorOsier Yang <jyang@redhat.com>
Fri, 12 Oct 2012 13:52:07 +0000 (21:52 +0800)
committerOsier Yang <jyang@redhat.com>
Mon, 15 Oct 2012 04:13:57 +0000 (12:13 +0800)
Setting pinning policy for vcpu which exceeds current vcpus number
just makes no sense, however, it could cause various problems, E.g.

<vcpu current='1'>4</vcpu>
<cputune>
  <vcpupin vcpuid='3' cpuset='4'/>
</cputune>

% virsh start linux
error: Failed to start domain linux
error: cannot set CPU affinity on process 32534: No such process

We must have some odd codes underlying which produces the
"on process 32534", but the point is why we not to prevent
earlier when parsing? Note that this is only one of the
problem it could cause.

This patch is to ignore the <vcpupin> for not onlined vcpus.

src/conf/domain_conf.c

index c87c6155207b37a328762505fc20f44cf40879e1..be803165ba6c9b564df890d3fe4cfd0b075b3f2f 100644 (file)
@@ -8806,7 +8806,15 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
             goto error;
         }
 
-        def->cputune.vcpupin[def->cputune.nvcpupin++] = vcpupin;
+        if (vcpupin->vcpuid >= def->vcpus)
+            /* To avoid the regression when daemon loading
+             * domain confs, we can't simply error out if
+             * <vcpupin> nodes greater than current vcpus,
+             * ignoring them instead.
+             */
+            VIR_WARN("Ignore vcpupin for not onlined vcpus");
+        else
+            def->cputune.vcpupin[def->cputune.nvcpupin++] = vcpupin;
     }
     VIR_FREE(nodes);