ia64/xen-unstable

changeset 12195:505cd4708946

Allow domain config file to specify credit-scheduler parameters.

Imported from xen-unstable 11864:babae8ac84b95ff4fbc1cfe4ac27c59ceaba7e38,
with conflict resolution by Ewan Mellor.

Signed-off-by: Masami Watanabe <masami.watanabe@jp.fujitsu.com>
author Ewan Mellor <ewan@xensource.com>
date Sat Oct 28 18:08:43 2006 +0100 (2006-10-28)
parents 63d1b02dad34
children 0471272a5de2
files tools/python/xen/xend/XendConfig.py tools/python/xen/xend/XendDomain.py tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xm/create.py
line diff
     1.1 --- a/tools/python/xen/xend/XendConfig.py	Mon Oct 23 12:23:57 2006 +0100
     1.2 +++ b/tools/python/xen/xend/XendConfig.py	Sat Oct 28 18:08:43 2006 +0100
     1.3 @@ -239,7 +239,8 @@ DEFAULT_CONFIGURATION = (
     1.4      ('on_xend_stop', lambda info: 'ignore'),
     1.5  
     1.6      ('cpus',         lambda info: []),
     1.7 -    ('cpu_weight',   lambda info: 1.0),
     1.8 +    ('cpu_cap',      lambda info: 0),
     1.9 +    ('cpu_weight',   lambda info: 256),
    1.10      ('vcpus',        lambda info: DEFAULT_VCPUS(info)),
    1.11      ('online_vcpus', lambda info: info['vcpus']),
    1.12      ('max_vcpu_id',  lambda info: info['vcpus']-1),
     2.1 --- a/tools/python/xen/xend/XendDomain.py	Mon Oct 23 12:23:57 2006 +0100
     2.2 +++ b/tools/python/xen/xend/XendDomain.py	Sat Oct 28 18:08:43 2006 +0100
     2.3 @@ -772,6 +772,9 @@ class XendDomain:
     2.4          try:
     2.5              dominfo = XendDomainInfo.create(config)
     2.6              self._add_domain(dominfo)
     2.7 +            self.domain_sched_credit_set(dominfo.getDomid(),
     2.8 +                                         dominfo.getWeight(),
     2.9 +                                         dominfo.getCap())
    2.10              return dominfo
    2.11          finally:
    2.12              self.domains_lock.release()
     3.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Mon Oct 23 12:23:57 2006 +0100
     3.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Sat Oct 28 18:08:43 2006 +0100
     3.3 @@ -79,7 +79,8 @@ ROUNDTRIPPING_CONFIG_ENTRIES = [
     3.4      ('uuid',            str),
     3.5      ('vcpus',           int),
     3.6      ('vcpu_avail',      int),
     3.7 -    ('cpu_weight',      float),
     3.8 +    ('cpu_cap',         int),
     3.9 +    ('cpu_weight',      int),
    3.10      ('memory',          int),
    3.11      ('shadow_memory',   int),
    3.12      ('maxmem',          int),
    3.13 @@ -828,6 +829,12 @@ class XendDomainInfo:
    3.14      def getResume(self):
    3.15          return "%s" % self.info['resume']
    3.16  
    3.17 +    def getCap(self):
    3.18 +        return self.info['cpu_cap']
    3.19 +
    3.20 +    def getWeight(self):
    3.21 +        return self.info['cpu_weight']
    3.22 +
    3.23      def setResume(self, state):
    3.24          self.info['resume'] = state
    3.25  
     4.1 --- a/tools/python/xen/xm/create.py	Mon Oct 23 12:23:57 2006 +0100
     4.2 +++ b/tools/python/xen/xm/create.py	Sat Oct 28 18:08:43 2006 +0100
     4.3 @@ -189,10 +189,14 @@ gopts.var('vcpus', val='VCPUS',
     4.4            fn=set_int, default=1,
     4.5            use="# of Virtual CPUS in domain.")
     4.6  
     4.7 +gopts.var('cpu_cap', val='CAP',
     4.8 +          fn=set_int, default=None,
     4.9 +          use="""Set the maximum amount of cpu.
    4.10 +          CAP is a percentage that fixes the maximum amount of cpu.""")
    4.11 +
    4.12  gopts.var('cpu_weight', val='WEIGHT',
    4.13 -          fn=set_float, default=None,
    4.14 -          use="""Set the new domain's cpu weight.
    4.15 -          WEIGHT is a float that controls the domain's share of the cpu.""")
    4.16 +          fn=set_int, default=None,
    4.17 +          use="""Set the cpu time ratio to be allocated to the domain.""")
    4.18  
    4.19  gopts.var('restart', val='onreboot|always|never',
    4.20            fn=set_value, default=None,
    4.21 @@ -705,6 +709,8 @@ def make_config(vals):
    4.22          config.append(['cpu', vals.cpu])
    4.23      if vals.cpus is not None:
    4.24          config.append(['cpus', vals.cpus])
    4.25 +    if vals.cpu_cap is not None:
    4.26 +        config.append(['cpu_cap', vals.cpu_cap])
    4.27      if vals.cpu_weight is not None:
    4.28          config.append(['cpu_weight', vals.cpu_weight])
    4.29      if vals.blkif: