]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
conf: Do not parse cpuset only if the placement is auto
authorOsier Yang <jyang@redhat.com>
Tue, 17 Apr 2012 14:57:01 +0000 (22:57 +0800)
committerOsier Yang <jyang@redhat.com>
Tue, 17 Apr 2012 14:57:01 +0000 (22:57 +0800)
So that a domain xml which doesn't have "placement" specified, but
"cpuset" is specified, could be parsed. And in this case, the
"placement" mode will be set as "static".

src/conf/domain_conf.c

index b28ae5cae2c5eb55b37a0a692edcf3ae751eb198..65a35c3eff11fbaf595ea6ab9ce0516f7a2ea6ed 100644 (file)
@@ -7896,11 +7896,10 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
         }
         VIR_FREE(tmp);
     } else {
-        if (def->cpumasklen)
-            def->placement_mode = VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC;
+        def->placement_mode = VIR_DOMAIN_CPU_PLACEMENT_MODE_DEFAULT;
     }
 
-    if (def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC) {
+    if (def->placement_mode != VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO) {
         tmp = virXPathString("string(./vcpu[1]/@cpuset)", ctxt);
         if (tmp) {
             char *set = tmp;
@@ -7912,6 +7911,8 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
                                      def->cpumasklen) < 0)
                 goto error;
             VIR_FREE(tmp);
+            if (def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_DEFAULT)
+                def->placement_mode = VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC;
         }
     }