WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] [xend, xenapi] Fix handling of scheduler

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [xend, xenapi] Fix handling of scheduler params
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 26 Sep 2007 15:50:11 -0700
Delivery-date: Wed, 26 Sep 2007 15:51:10 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir@xxxxxxxxxxxxx>
# Date 1190813996 -3600
# Node ID 69879c7bf4b539cd1a9908be43b67016fddcdc24
# Parent  80277ff19c9ccfae3bade36ca2664aae339cb91c
[xend,xenapi] Fix handling of scheduler params

When creating domains that specify scheduler parameters with XenAPI,
the specified parameters are not used when starting the domain. This
patch collapses cpu_weight and cpu_cap in XendConfig into the
vcpus_params dictionary. The patch has been tested using xm and
XenAPI on config with and without scheduler parameters.

Signed-off-by: Jim Fehlig <jfehlig@xxxxxxxxxx>
---
 tools/python/xen/xend/XendConfig.py     |   20 ++++++++++++--------
 tools/python/xen/xend/XendDomainInfo.py |   13 +++++++------
 2 files changed, 19 insertions(+), 14 deletions(-)

diff -r 80277ff19c9c -r 69879c7bf4b5 tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py       Wed Sep 26 14:14:16 2007 +0100
+++ b/tools/python/xen/xend/XendConfig.py       Wed Sep 26 14:39:56 2007 +0100
@@ -178,8 +178,6 @@ LEGACY_UNSUPPORTED_BY_XENAPI_CFG = [
     # roundtripped (dynamic, unmodified)
     'shadow_memory',
     'vcpu_avail',
-    'cpu_weight',
-    'cpu_cap',
     'features',
     # read/write
     'on_xend_start',
@@ -203,8 +201,6 @@ LEGACY_CFG_TYPES = {
     'shadow_memory': int,
     'maxmem':        int,
     'start_time':    float,
-    'cpu_cap':       int,
-    'cpu_weight':    int,
     'cpu_time':      float,
     'features':      str,
     'localtime':     int,
@@ -330,8 +326,6 @@ class XendConfig(dict):
             'on_xend_start': 'ignore',
             'on_xend_stop': 'ignore',
             'cpus': [],
-            'cpu_weight': 256,
-            'cpu_cap': 0,
             'VCPUs_max': 1,
             'VCPUs_live': 1,
             'VCPUs_at_startup': 1,
@@ -496,6 +490,14 @@ class XendConfig(dict):
         if sxp.child_value(sxp_cfg, "maxmem") != None:
             cfg["maxmem"] = int(sxp.child_value(sxp_cfg, "maxmem"))
             
+        # Convert scheduling parameters to vcpus_params
+        if 'vcpus_params' not in cfg:
+            cfg['vcpus_params'] = {}
+        cfg["vcpus_params"]["weight"] = \
+            int(sxp.child_value(sxp_cfg, "cpu_weight", 256))
+        cfg["vcpus_params"]["cap"] = \
+            int(sxp.child_value(sxp_cfg, "cpu_cap", 0))
+
         # Only extract options we know about.
         extract_keys = LEGACY_UNSUPPORTED_BY_XENAPI_CFG
         extract_keys += XENAPI_CFG_TO_LEGACY_CFG.values()
@@ -812,8 +814,6 @@ class XendConfig(dict):
         _set_cfg_if_exists('on_xend_stop')
         _set_cfg_if_exists('on_xend_start')
         _set_cfg_if_exists('vcpu_avail')
-        _set_cfg_if_exists('cpu_weight')
-        _set_cfg_if_exists('cpu_cap')
         
         # Parse and store runtime configuration 
         _set_cfg_if_exists('start_time')
@@ -865,6 +865,10 @@ class XendConfig(dict):
                 self[key] = type_conv(val)
             else:
                 self[key] = val
+                
+        self['vcpus_params']['weight'] = \
+            int(self['vcpus_params'].get('weight', 256))
+        self['vcpus_params']['cap'] = int(self['vcpus_params'].get('cap', 0))
 
     def to_sxp(self, domain = None, ignore_devices = False, ignore = [],
                legacy_only = True):
diff -r 80277ff19c9c -r 69879c7bf4b5 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Wed Sep 26 14:14:16 2007 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py   Wed Sep 26 14:39:56 2007 +0100
@@ -1115,16 +1115,16 @@ class XendDomainInfo:
         return str(self._resume)
 
     def getCap(self):
-        return self.info.get('cpu_cap', 0)
+        return self.info['vcpus_params']['cap']
 
     def setCap(self, cpu_cap):
-        self.info['cpu_cap'] = cpu_cap
+        self.info['vcpus_params']['cap'] = cpu_cap
 
     def getWeight(self):
-        return self.info.get('cpu_weight', 256)
+        return self.info['vcpus_params']['weight']
 
     def setWeight(self, cpu_weight):
-        self.info['cpu_weight'] = cpu_weight
+        self.info['vcpus_params']['weight'] = cpu_weight
 
     def setResume(self, state):
         self._resume = state
@@ -1596,7 +1596,7 @@ class XendDomainInfo:
     def _initDomain(self):
         log.debug('XendDomainInfo.initDomain: %s %s',
                   self.domid,
-                  self.info['cpu_weight'])
+                  self.info['vcpus_params']['weight'])
 
         self._configureBootloader()
 
@@ -1606,7 +1606,8 @@ class XendDomainInfo:
             if self.info['platform'].get('localtime', 0):
                 xc.domain_set_time_offset(self.domid)
 
-            xc.domain_setcpuweight(self.domid, self.info['cpu_weight'])
+            xc.domain_setcpuweight(self.domid, \
+                                   self.info['vcpus_params']['weight'])
 
             # repin domain vcpus if a restricted cpus list is provided
             # this is done prior to memory allocation to aide in memory

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [xend, xenapi] Fix handling of scheduler params, Xen patchbot-unstable <=