Skip to contentSkip to conversation

xm: Make cpu_{cap|weight} available when using XenAPI

PATCH New Masaki Kanno 1 participant 1 message Sep 2, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xm: Make cpu_{cap|weight} available when using XenAPI

Hi,

Currently, cpu_weight parameter and cpu_cap parameter in domain configuration files are ignored when using XenAPI. The parameters are available by this patch.

Best regards,
Kan

tools/python/xen/xm/xenapi_create.py +23 -0
diff -r 8fc927798476 tools/python/xen/xm/xenapi_create.py
@@ -778,6 +778,12 @@
 
         map(vm.appendChild, platform)
 
+        # And now the vcpu_params
+
+        vcpu_params = self.extract_vcpu_params(config, document)
+
+        map(vm.appendChild, vcpu_params)
+
         # transient?
 
         if transient:
@@ -1072,6 +1078,23 @@
                 platform_configs.append(platform)
  
         return platform_configs
+
+    def extract_vcpu_params(self, config, document):
+        vcpu_params = []
+
+        vcpu_param = document.createElement("vcpu_param")
+        vcpu_param.attributes["key"] = "weight"
+        vcpu_param.attributes["value"] \
+            = str(get_child_by_name(config, "cpu_weight", 256))
+        vcpu_params.append(vcpu_param)
+
+        vcpu_param = document.createElement("vcpu_param")
+        vcpu_param.attributes["key"] = "cap"
+        vcpu_param.attributes["value"] \
+            = str(get_child_by_name(config, "cpu_cap", 0))
+        vcpu_params.append(vcpu_param)
+
+        return vcpu_params
     
     _eths = -1
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel