ia64/xen-unstable

changeset 10711:9ddc5be227c1

[XEND] Improve xm pause/unpause error reporting.
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
author kfraser@localhost.localdomain
date Mon Jul 10 15:18:12 2006 +0100 (2006-07-10)
parents 800261a88275
children c45f1f3a926b
files tools/python/xen/xend/XendDomain.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomain.py	Mon Jul 10 15:10:00 2006 +0100
     1.2 +++ b/tools/python/xen/xend/XendDomain.py	Mon Jul 10 15:18:12 2006 +0100
     1.3 @@ -370,10 +370,15 @@ class XendDomain:
     1.4   
     1.5      def domain_unpause(self, domid):
     1.6          """Unpause domain execution."""
     1.7 +
     1.8 +        dominfo = self.domain_lookup_by_name_or_id_nr(domid)
     1.9 +        if not dominfo:
    1.10 +            raise XendInvalidDomain(str(domid))
    1.11 +
    1.12 +        if dominfo.getDomid() == PRIV_DOMAIN:
    1.13 +            raise XendError("Cannot unpause privileged domain %s" % domid)
    1.14 +
    1.15          try:
    1.16 -            dominfo = self.domain_lookup_by_name_or_id_nr(domid)
    1.17 -            if not dominfo:
    1.18 -                raise XendInvalidDomain(str(domid))
    1.19              log.info("Domain %s (%d) unpaused.", dominfo.getName(),
    1.20                       dominfo.getDomid())
    1.21              return dominfo.unpause()
    1.22 @@ -383,10 +388,15 @@ class XendDomain:
    1.23  
    1.24      def domain_pause(self, domid):
    1.25          """Pause domain execution."""
    1.26 +
    1.27 +        dominfo = self.domain_lookup_by_name_or_id_nr(domid)
    1.28 +        if not dominfo:
    1.29 +            raise XendInvalidDomain(str(domid))
    1.30 +
    1.31 +        if dominfo.getDomid() == PRIV_DOMAIN:
    1.32 +            raise XendError("Cannot pause privileged domain %s" % domid)
    1.33 +
    1.34          try:
    1.35 -            dominfo = self.domain_lookup_by_name_or_id_nr(domid)
    1.36 -            if not dominfo:
    1.37 -                raise XendInvalidDomain(str(domid))
    1.38              log.info("Domain %s (%d) paused.", dominfo.getName(),
    1.39                       dominfo.getDomid())
    1.40              return dominfo.pause()