All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Prevent xend from destroying Dom0
@ 2005-09-21 20:48 Dan Smith
  2005-09-21 22:25 ` Anthony Liguori
  2005-09-22 10:36 ` Ewan Mellor
  0 siblings, 2 replies; 4+ messages in thread
From: Dan Smith @ 2005-09-21 20:48 UTC (permalink / raw)
  To: Xen Developers

[-- Attachment #1: Type: text/plain, Size: 451 bytes --]

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>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: dom0_destroy.patch --]
[-- Type: text/x-patch, Size: 1176 bytes --]

diff -r 9776d03bf108 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py	Tue Sep 20 13:07:10 2005
+++ b/tools/python/xen/xend/XendDomain.py	Wed Sep 21 13:01:41 2005
@@ -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:

[-- Attachment #3: Type: text/plain, Size: 88 bytes --]


-- 
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms@us.ibm.com

[-- Attachment #4: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Prevent xend from destroying Dom0
  2005-09-21 20:48 [PATCH] Prevent xend from destroying Dom0 Dan Smith
@ 2005-09-21 22:25 ` Anthony Liguori
  2005-09-21 22:49   ` Dan Smith
  2005-09-22 10:36 ` Ewan Mellor
  1 sibling, 1 reply; 4+ messages in thread
From: Anthony Liguori @ 2005-09-21 22:25 UTC (permalink / raw)
  To: Dan Smith; +Cc: Xen Developers

Is it possible to pass DOMID_SELF to domain_lookup?

Regards,

Anthony Liguori

Dan Smith wrote:

>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>
>  
>
>------------------------------------------------------------------------
>
>diff -r 9776d03bf108 tools/python/xen/xend/XendDomain.py
>--- a/tools/python/xen/xend/XendDomain.py	Tue Sep 20 13:07:10 2005
>+++ b/tools/python/xen/xend/XendDomain.py	Wed Sep 21 13:01:41 2005
>@@ -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:
>  
>
>------------------------------------------------------------------------
>
>
>  
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Xen-devel mailing list
>Xen-devel@lists.xensource.com
>http://lists.xensource.com/xen-devel
>  
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Prevent xend from destroying Dom0
  2005-09-21 22:25 ` Anthony Liguori
@ 2005-09-21 22:49   ` Dan Smith
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Smith @ 2005-09-21 22:49 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Xen Developers


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.

-- 
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms@us.ibm.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Prevent xend from destroying Dom0
  2005-09-21 20:48 [PATCH] Prevent xend from destroying Dom0 Dan Smith
  2005-09-21 22:25 ` Anthony Liguori
@ 2005-09-22 10:36 ` Ewan Mellor
  1 sibling, 0 replies; 4+ messages in thread
From: Ewan Mellor @ 2005-09-22 10:36 UTC (permalink / raw)
  To: xen-devel

On Wed, Sep 21, 2005 at 01:48:26PM -0700, Dan Smith wrote:

> 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>

Applied, thanks.

Ewan.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-09-22 10:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-21 20:48 [PATCH] Prevent xend from destroying Dom0 Dan Smith
2005-09-21 22:25 ` Anthony Liguori
2005-09-21 22:49   ` Dan Smith
2005-09-22 10:36 ` Ewan Mellor

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.