ia64/xen-unstable

changeset 7015:7646b18d4b32

This patch adds a check in xend that prevents a user from trying to
destroy Dom0. Currently, xm does not return an error for this case.
Xend tries to destroy dom0 and leaves the system in an unstable
state. Subsequent attempts to create a domain result in the following
error message:

Error: Error creating domain: (106, 'Transport endpoint is already \
connected')

This will fix bugzilla bug #243

Signed-off-by: Dan Smith <danms@us.ibm.com>
author emellor@ewan
date Thu Sep 22 11:35:35 2005 +0100 (2005-09-22)
parents 0f71667deb52
children 4cff74aa6246
files tools/python/xen/xend/XendDomain.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomain.py	Thu Sep 22 11:21:37 2005 +0100
     1.2 +++ b/tools/python/xen/xend/XendDomain.py	Thu Sep 22 11:35:35 2005 +0100
     1.3 @@ -42,6 +42,7 @@ from xen.xend.xenstore.xsutil import Get
     1.4  __all__ = [ "XendDomain" ]
     1.5  
     1.6  SHUTDOWN_TIMEOUT = 30
     1.7 +PRIV_DOMAIN      =  0
     1.8  
     1.9  def is_dead(dom):
    1.10      return dom['crashed'] or dom['shutdown'] or (
    1.11 @@ -163,7 +164,7 @@ class XendDomain:
    1.12          self.domain_restarts()
    1.13  
    1.14      def dom0_setup(self):
    1.15 -        dom0 = self.domain_lookup(0)
    1.16 +        dom0 = self.domain_lookup(PRIV_DOMAIN)
    1.17          if not dom0:
    1.18              dom0 = self.dom0_unknown()
    1.19          dom0.dom0_init_store()    
    1.20 @@ -331,7 +332,7 @@ class XendDomain:
    1.21          return self.domains.get(id)
    1.22  
    1.23      def dom0_unknown(self):
    1.24 -        dom0 = 0
    1.25 +        dom0 = PRIV_DOMAIN
    1.26          uuid = None
    1.27          info = self.xen_domain(dom0)
    1.28          dompath = GetDomainPath(dom0)
    1.29 @@ -499,6 +500,10 @@ class XendDomain:
    1.30  
    1.31          @param domid: domain id
    1.32          """
    1.33 +
    1.34 +        if domid == PRIV_DOMAIN:
    1.35 +            raise XendError("Cannot destroy priviliged domain %i" % domid)
    1.36 +        
    1.37          self.domain_restart_schedule(domid, reason, force=True)
    1.38          dominfo = self.domain_lookup(domid)
    1.39          if dominfo: