ia64/xen-unstable

changeset 14141:0b5da89e2b3d

Move credit scheduler configuration into XendDomainInfo, so that the domain
will be cleaned up correctly if the scheduler parameters are wrong.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
author Ewan Mellor <ewan@xensource.com>
date Mon Feb 26 15:39:34 2007 +0000 (2007-02-26)
parents ca1dd3480540
children 0261e86db3b1
files tools/python/xen/xend/XendDomain.py tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomain.py	Mon Feb 26 14:48:46 2007 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomain.py	Mon Feb 26 15:39:34 2007 +0000
     1.3 @@ -32,7 +32,7 @@ import threading
     1.4  import xen.lowlevel.xc
     1.5  
     1.6  
     1.7 -from xen.xend import XendOptions, XendCheckpoint, XendDomainInfo, XendNode
     1.8 +from xen.xend import XendOptions, XendCheckpoint, XendDomainInfo
     1.9  from xen.xend.PrettyPrint import prettyprint
    1.10  from xen.xend.XendConfig import XendConfig
    1.11  from xen.xend.XendError import XendError, XendInvalidDomain, VmError
    1.12 @@ -875,10 +875,6 @@ class XendDomain:
    1.13              self._refresh()
    1.14  
    1.15              dominfo = XendDomainInfo.create(config)
    1.16 -            if XendNode.instance().xenschedinfo() == 'credit':
    1.17 -                self.domain_sched_credit_set(dominfo.getDomid(),
    1.18 -                                             dominfo.getWeight(),
    1.19 -                                             dominfo.getCap())
    1.20              return dominfo
    1.21          finally:
    1.22              self.domains_lock.release()
    1.23 @@ -895,10 +891,6 @@ class XendDomain:
    1.24              self._refresh()
    1.25  
    1.26              dominfo = XendDomainInfo.create_from_dict(config_dict)
    1.27 -            if XendNode.instance().xenschedinfo() == 'credit':
    1.28 -                self.domain_sched_credit_set(dominfo.getDomid(),
    1.29 -                                             dominfo.getWeight(),
    1.30 -                                             dominfo.getCap())
    1.31              return dominfo
    1.32          finally:
    1.33              self.domains_lock.release()
    1.34 @@ -952,10 +944,6 @@ class XendDomain:
    1.35                                   POWER_STATE_NAMES[dominfo.state])
    1.36              
    1.37              dominfo.start(is_managed = True)
    1.38 -            if XendNode.instance().xenschedinfo() == 'credit':
    1.39 -                self.domain_sched_credit_set(dominfo.getDomid(),
    1.40 -                                             dominfo.getWeight(),
    1.41 -                                             dominfo.getCap())
    1.42          finally:
    1.43              self.domains_lock.release()
    1.44          dominfo.waitForDevices()
     2.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Mon Feb 26 14:48:46 2007 +0000
     2.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Mon Feb 26 15:39:34 2007 +0000
     2.3 @@ -398,11 +398,18 @@ class XendDomainInfo:
     2.4                  XendTask.log_progress(81, 90, self._registerWatches)
     2.5                  XendTask.log_progress(91, 100, self.refreshShutdown)
     2.6  
     2.7 +                xendomains = XendDomain.instance()
     2.8 +                xennode = XendNode.instance()
     2.9 +
    2.10                  # save running configuration if XendDomains believe domain is
    2.11                  # persistent
    2.12                  if is_managed:
    2.13 -                    xendomains = XendDomain.instance()
    2.14                      xendomains.managed_config_save(self)
    2.15 +
    2.16 +                if xennode.xenschedinfo() == 'credit':
    2.17 +                    xendomains.domain_sched_credit_set(self.getDomid(),
    2.18 +                                                       self.getWeight(),
    2.19 +                                                       self.getCap())
    2.20              except:
    2.21                  log.exception('VM start failed')
    2.22                  self.destroy()