Skip to contentSkip to conversation

Prevent xend from destroying Dom0

PATCH Applied Dan Smith 3 participants 4 messages Sep 21, 2005 – Sep 22, 2005

lore
Share & tools
lore

Dan Smith

author
#0 lore raw

PATCH 1/1 Prevent xend from destroying Dom0

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

tools/python/xen/xend/XendDomain.py +7 -2
diff -r 9776d03bf108 tools/python/xen/xend/XendDomain.py
@@ -45,6 +45,7 @@
 __all__ = [ "XendDomain" ]
 
 SHUTDOWN_TIMEOUT = 30
+PRIV_DOMAIN      =  0
 
 def is_dead(dom):
     return dom['crashed'] or dom['shutdown'] or (
@@ -168,7 +169,7 @@
         self.domain_restarts()
 
     def dom0_setup(self):
-        dom0 = self.domain_lookup(0)
+        dom0 = self.domain_lookup(PRIV_DOMAIN)
         if not dom0:
             dom0 = self.dom0_unknown()
         dom0.dom0_init_store()    
@@ -337,7 +338,7 @@
         return self.domains.get(id)
 
     def dom0_unknown(self):
-        dom0 = 0
+        dom0 = PRIV_DOMAIN
         uuid = None
         info = self.xen_domain(dom0)
         dompath = GetDomainPath(dom0)
@@ -505,6 +506,10 @@
 
         @param domid: domain id
         """
+
+        if domid == PRIV_DOMAIN:
+            raise XendError("Cannot destroy priviliged domain %i" % domid)
+        
         self.domain_restart_schedule(domid, reason, force=True)
         dominfo = self.domain_lookup(domid)
         if dominfo:
Signature · 5 lines
-- 
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: [email protected]

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw

Is it possible to pass DOMID_SELF to domain_lookup?

Regards,

Anthony Liguori

Quoted 71 lines · Dan Smith

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

------------------------------------------------------------------------

diff -r 9776d03bf108 tools/python/xen/xend/XendDomain.py

tools/python/xen/xend/XendDomain.py +0 -0
@@ -45,6 +45,7 @@

__all__ = [ "XendDomain" ]

SHUTDOWN_TIMEOUT = 30
+PRIV_DOMAIN = 0

def is_dead(dom):

    return dom['crashed'] or dom['shutdown'] or (
tools/python/xen/xend/XendDomain.py +6 -4
@@ -168,7 +169,7 @@
        self.domain_restarts()
 
    def dom0_setup(self):
-        dom0 = self.domain_lookup(0)
+        dom0 = self.domain_lookup(PRIV_DOMAIN)
        if not dom0:
            dom0 = self.dom0_unknown()
        dom0.dom0_init_store()    
@@ -337,7 +338,7 @@
        return self.domains.get(id)
 
    def dom0_unknown(self):
-        dom0 = 0
+        dom0 = PRIV_DOMAIN
        uuid = None
        info = self.xen_domain(dom0)
        dompath = GetDomainPath(dom0)
@@ -505,6 +506,10 @@
 
        @param domid: domain id
        """
+
+        if domid == PRIV_DOMAIN:
+            raise XendError("Cannot destroy priviliged domain %i" % domid)
+        
        self.domain_restart_schedule(domid, reason, force=True)
        dominfo = self.domain_lookup(domid)
        if dominfo:
 
 
------------------------------------------------------------------------
 
 
 
 
------------------------------------------------------------------------

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

author
#2 lore raw

AL> Is it possible to pass DOMID_SELF to domain_lookup?

Possibly, if this was exposed via xc, but I don't think that would be all that was needed to allow running xend on an arbitrarily-numbered domain.

Signature · 4 lines
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: [email protected]
Applied
#3 lore raw
In reply to Dan Smith
Quoted 6 lines · Dan Smith

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:

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

This will fix bugzilla bug #243

Applied, thanks.

Ewan.