direct-io.hg

changeset 11864:babae8ac84b9

Allow domain config file to specify credit-scheduler parameters.
Signed-off-by: Masami Watanabe <masami.watanabe@jp.fujitsu.com>
author kfraser@localhost.localdomain
date Mon Oct 23 12:28:33 2006 +0100 (2006-10-23)
parents 763339844784
children 356520dca6df
files 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/XendDomain.py	Mon Oct 23 12:23:57 2006 +0100
     1.2 +++ b/tools/python/xen/xend/XendDomain.py	Mon Oct 23 12:28:33 2006 +0100
     1.3 @@ -227,6 +227,9 @@ class XendDomain:
     1.4          try:
     1.5              dominfo = XendDomainInfo.create(config)
     1.6              self._add_domain(dominfo)
     1.7 +            self.domain_sched_credit_set(dominfo.getDomid(),
     1.8 +                                         dominfo.getWeight(),
     1.9 +                                         dominfo.getCap())
    1.10              return dominfo
    1.11          finally:
    1.12              self.domains_lock.release()
     2.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Mon Oct 23 12:23:57 2006 +0100
     2.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Mon Oct 23 12:28:33 2006 +0100
     2.3 @@ -131,7 +131,8 @@ ROUNDTRIPPING_CONFIG_ENTRIES = [
     2.4      ('uuid',            str),
     2.5      ('vcpus',           int),
     2.6      ('vcpu_avail',      int),
     2.7 -    ('cpu_weight',      float),
     2.8 +    ('cpu_cap',         int),
     2.9 +    ('cpu_weight',      int),
    2.10      ('memory',          int),
    2.11      ('shadow_memory',   int),
    2.12      ('maxmem',          int),
    2.13 @@ -562,7 +563,8 @@ class XendDomainInfo:
    2.14              defaultInfo('features',     lambda: "")
    2.15              defaultInfo('cpu',          lambda: None)
    2.16              defaultInfo('cpus',         lambda: [])
    2.17 -            defaultInfo('cpu_weight',   lambda: 1.0)
    2.18 +            defaultInfo('cpu_cap',      lambda: 0)
    2.19 +            defaultInfo('cpu_weight',   lambda: 256)
    2.20  
    2.21              # some domains don't have a config file (e.g. dom0 )
    2.22              # to set number of vcpus so we derive available cpus
    2.23 @@ -826,6 +828,12 @@ class XendDomainInfo:
    2.24      def getResume(self):
    2.25          return "%s" % self.info['resume']
    2.26  
    2.27 +    def getCap(self):
    2.28 +        return self.info['cpu_cap']
    2.29 +
    2.30 +    def getWeight(self):
    2.31 +        return self.info['cpu_weight']
    2.32 +
    2.33      def endRestore(self):
    2.34          self.setResume(False)
    2.35  
     3.1 --- a/tools/python/xen/xm/create.py	Mon Oct 23 12:23:57 2006 +0100
     3.2 +++ b/tools/python/xen/xm/create.py	Mon Oct 23 12:28:33 2006 +0100
     3.3 @@ -189,10 +189,14 @@ gopts.var('vcpus', val='VCPUS',
     3.4            fn=set_int, default=1,
     3.5            use="# of Virtual CPUS in domain.")
     3.6  
     3.7 +gopts.var('cpu_cap', val='CAP',
     3.8 +          fn=set_int, default=None,
     3.9 +          use="""Set the maximum amount of cpu.
    3.10 +          CAP is a percentage that fixes the maximum amount of cpu.""")
    3.11 +
    3.12  gopts.var('cpu_weight', val='WEIGHT',
    3.13 -          fn=set_float, default=None,
    3.14 -          use="""Set the new domain's cpu weight.
    3.15 -          WEIGHT is a float that controls the domain's share of the cpu.""")
    3.16 +          fn=set_int, default=None,
    3.17 +          use="""Set the cpu time ratio to be allocated to the domain.""")
    3.18  
    3.19  gopts.var('restart', val='onreboot|always|never',
    3.20            fn=set_value, default=None,
    3.21 @@ -687,6 +691,8 @@ def make_config(vals):
    3.22          config.append(['cpu', vals.cpu])
    3.23      if vals.cpus is not None:
    3.24          config.append(['cpus', vals.cpus])
    3.25 +    if vals.cpu_cap is not None:
    3.26 +        config.append(['cpu_cap', vals.cpu_cap])
    3.27      if vals.cpu_weight is not None:
    3.28          config.append(['cpu_weight', vals.cpu_weight])
    3.29      if vals.blkif: