debuggers.hg

changeset 19993:e07726c03d31

xend: Restore scheduling parameters

Scheduling parameters are reset to default values when I restore
or migrate a domain.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jul 16 10:32:55 2009 +0100 (2009-07-16)
parents 8ce42378828b
children 33447a5c6851
files tools/python/xen/xend/XendConfig.py tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendConfig.py	Thu Jul 16 10:30:50 2009 +0100
     1.2 +++ b/tools/python/xen/xend/XendConfig.py	Thu Jul 16 10:32:55 2009 +0100
     1.3 @@ -1055,7 +1055,10 @@ class XendConfig(dict):
     1.4          if domain.getDomid() is not None:
     1.5              sxpr.append(['domid', domain.getDomid()])
     1.6  
     1.7 -        if not legacy_only:
     1.8 +        if legacy_only:
     1.9 +            sxpr.append(['cpu_weight', int(self['vcpus_params'].get('weight', 256))])
    1.10 +            sxpr.append(['cpu_cap', int(self['vcpus_params'].get('cap', 0))])
    1.11 +        else:
    1.12              for name, typ in XENAPI_CFG_TYPES.items():
    1.13                  if name in self and self[name] not in (None, []):
    1.14                      if typ == dict:
     2.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Thu Jul 16 10:30:50 2009 +0100
     2.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Thu Jul 16 10:32:55 2009 +0100
     2.3 @@ -465,17 +465,11 @@ class XendDomainInfo:
     2.4                  XendTask.log_progress(91, 100, self.refreshShutdown)
     2.5  
     2.6                  xendomains = XendDomain.instance()
     2.7 -                xennode = XendNode.instance()
     2.8  
     2.9                  # save running configuration if XendDomains believe domain is
    2.10                  # persistent
    2.11                  if is_managed:
    2.12                      xendomains.managed_config_save(self)
    2.13 -
    2.14 -                if xennode.xenschedinfo() == 'credit':
    2.15 -                    xendomains.domain_sched_credit_set(self.getDomid(),
    2.16 -                                                       self.getWeight(),
    2.17 -                                                       self.getCap())
    2.18              except:
    2.19                  log.exception('VM start failed')
    2.20                  self.destroy()
    2.21 @@ -497,6 +491,7 @@ class XendDomainInfo:
    2.22                      # we just ignore it so that the domain can still be restored
    2.23                      log.warn("Cannot restore CPU affinity")
    2.24  
    2.25 +                self._setSchedParams()
    2.26                  self._storeVmDetails()
    2.27                  self._createChannels()
    2.28                  self._createDevices()
    2.29 @@ -2555,6 +2550,12 @@ class XendDomainInfo:
    2.30                  for v in range(0, self.info['VCPUs_max']):
    2.31                      xc.vcpu_setaffinity(self.domid, v, cpumask)
    2.32  
    2.33 +    def _setSchedParams(self):
    2.34 +        if XendNode.instance().xenschedinfo() == 'credit':
    2.35 +            from xen.xend import XendDomain
    2.36 +            XendDomain.instance().domain_sched_credit_set(self.getDomid(),
    2.37 +                                                          self.getWeight(),
    2.38 +                                                          self.getCap())
    2.39  
    2.40      def _initDomain(self):
    2.41          log.debug('XendDomainInfo.initDomain: %s %s',
    2.42 @@ -2571,6 +2572,9 @@ class XendDomainInfo:
    2.43              # distribution for NUMA systems.
    2.44              self._setCPUAffinity()
    2.45  
    2.46 +            # Set scheduling parameters.
    2.47 +            self._setSchedParams()
    2.48 +
    2.49              # Use architecture- and image-specific calculations to determine
    2.50              # the various headrooms necessary, given the raw configured
    2.51              # values. maxmem, memory, and shadow are all in KiB.