diff options
author | emellor@ewan <emellor@ewan> | 2005-10-04 00:21:49 +0100 |
---|---|---|
committer | emellor@ewan <emellor@ewan> | 2005-10-04 00:21:49 +0100 |
commit | c9577eb490d71da71eaabdadb621ca33d1941f4b (patch) | |
tree | a0cb6183de65cef66bdaa3af112226bb96f6ab4a /tools/python | |
parent | 72835ed4aa93536d30ffc1ab54f9c9d10fc92a28 (diff) | |
download | xen-c9577eb490d71da71eaabdadb621ca33d1941f4b.tar.gz xen-c9577eb490d71da71eaabdadb621ca33d1941f4b.tar.bz2 xen-c9577eb490d71da71eaabdadb621ca33d1941f4b.zip |
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>
Diffstat (limited to 'tools/python')
-rw-r--r-- | tools/python/xen/xend/XendDomain.py | 5 | ||||
-rw-r--r-- | tools/python/xen/xend/server/DevController.py | 13 |
2 files changed, 16 insertions, 2 deletions
diff --git a/tools/python/xen/xend/XendDomain.py b/tools/python/xen/xend/XendDomain.py index f21d08edbb..81302ad031 100644 --- a/tools/python/xen/xend/XendDomain.py +++ b/tools/python/xen/xend/XendDomain.py @@ -284,6 +284,11 @@ class XendDomain: pass return dominfo + + def privilegedDomain(self): + return self.domains[PRIV_DOMAIN] + + def domain_unpause(self, id): """Unpause domain execution. diff --git a/tools/python/xen/xend/server/DevController.py b/tools/python/xen/xend/server/DevController.py index 0ede664ba0..c9fc72ebaa 100644 --- a/tools/python/xen/xend/server/DevController.py +++ b/tools/python/xen/xend/server/DevController.py @@ -189,8 +189,17 @@ class DevController: """ import xen.xend.XendDomain - backdom = xen.xend.XendDomain.instance().domain_lookup_by_name( - sxp.child_value(config, 'backend', '0')) + xd = xen.xend.XendDomain.instance() + + backdom_name = sxp.child_value(config, 'backend') + if backdom_name: + backdom = xd.domain_lookup_by_name(backdom_name) + else: + backdom = xd.privilegedDomain() + + if not backdom: + raise VmError("Cannot configure device for unknown backend %s" % + backdom_name) frontpath = self.frontendPath(devid) backpath = self.backendPath(backdom, devid) |