ia64/xen-unstable

changeset 7172:cc9988317416

Added method XendDomain.privilegedDomain and use that inside DevController to
avoid hard-coding the domain ID 0.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@ewan
date Tue Oct 04 00:21:49 2005 +0100 (2005-10-04)
parents 716a0d177ffa
children e6e5f22d19f8
files tools/python/xen/xend/XendDomain.py tools/python/xen/xend/server/DevController.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomain.py	Mon Oct 03 23:28:24 2005 +0100
     1.2 +++ b/tools/python/xen/xend/XendDomain.py	Tue Oct 04 00:21:49 2005 +0100
     1.3 @@ -284,6 +284,11 @@ class XendDomain:
     1.4                  pass
     1.5          return dominfo
     1.6  
     1.7 +
     1.8 +    def privilegedDomain(self):
     1.9 +        return self.domains[PRIV_DOMAIN]
    1.10 +
    1.11 + 
    1.12      def domain_unpause(self, id):
    1.13          """Unpause domain execution.
    1.14  
     2.1 --- a/tools/python/xen/xend/server/DevController.py	Mon Oct 03 23:28:24 2005 +0100
     2.2 +++ b/tools/python/xen/xend/server/DevController.py	Tue Oct 04 00:21:49 2005 +0100
     2.3 @@ -189,8 +189,17 @@ class DevController:
     2.4          """
     2.5  
     2.6          import xen.xend.XendDomain
     2.7 -        backdom = xen.xend.XendDomain.instance().domain_lookup_by_name(
     2.8 -            sxp.child_value(config, 'backend', '0'))
     2.9 +        xd = xen.xend.XendDomain.instance()
    2.10 +
    2.11 +        backdom_name = sxp.child_value(config, 'backend')
    2.12 +        if backdom_name:
    2.13 +            backdom = xd.domain_lookup_by_name(backdom_name)
    2.14 +        else:
    2.15 +            backdom = xd.privilegedDomain()
    2.16 +
    2.17 +        if not backdom:
    2.18 +            raise VmError("Cannot configure device for unknown backend %s" %
    2.19 +                          backdom_name)
    2.20  
    2.21          frontpath = self.frontendPath(devid)
    2.22          backpath  = self.backendPath(backdom, devid)