WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] Prevent xend from starting duplicate domains

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] Prevent xend from starting duplicate domains
From: Dan Smith <danms@xxxxxxxxxx>
Date: Tue, 13 Sep 2005 14:46:34 -0700
Delivery-date: Tue, 13 Sep 2005 21:44:25 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (gnu/linux)
The attached patch puts a simple check in domain_create() which
prevents starting a domain if there is already one of the same name in
the domain list.

This fixes the problem of getting the following error message from xm
while creating a domain soon after destroying one with the same name:

  xen.xend.XendProtocol.XendError: (3, 'No such process')

Signed-off-by: Dan Smith <danms@xxxxxxxxxx>

diff -r 3a34bcb7c28b tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py       Tue Sep 13 19:09:44 2005
+++ b/tools/python/xen/xend/XendDomain.py       Tue Sep 13 13:25:08 2005
@@ -296,6 +296,13 @@
         @param config: configuration
         @return: domain
         """
+
+        existing = self.domains.get_by_name(sxp.child_value(config, "name"))
+        if existing:
+            log.debug("Attempt to create duplicate domain %s" % existing.name)
+            raise XendError("Domain %s already exists as %i!" %
+                            (existing.name, existing.id))
+        
         dominfo = XendDomainInfo.create(self.dbmap, config)
         return dominfo
 
-- 
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms@xxxxxxxxxx
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel