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

[Xen-changelog] [xen-unstable] Don't complain about name non-uniqueness

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Don't complain about name non-uniqueness if one domain is dying. This happens
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 08 Nov 2006 15:00:33 +0000
Delivery-date: Wed, 08 Nov 2006 07:00:31 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Node ID 69d8263d5f856a6a360d381d97c44c440dd574d7
# Parent  40e586047ead7bd79514ca803fd045cce831e4f8
Don't complain about name non-uniqueness if one domain is dying.  This happens
across a reboot regularly.  Inside _refresh, there is the occasion for new
domains to appear, if an existing domain reboots itself.  In this case, we
need to get the list of running domains from Xen again.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendDomain.py     |   44 ++++++++++++++++++--------------
 tools/python/xen/xend/XendDomainInfo.py |    4 --
 2 files changed, 26 insertions(+), 22 deletions(-)

diff -r 40e586047ead -r 69d8263d5f85 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py       Wed Nov 08 12:26:34 2006 +0000
+++ b/tools/python/xen/xend/XendDomain.py       Wed Nov 08 12:56:45 2006 +0000
@@ -357,27 +357,29 @@ class XendDomain:
         either xenstore has changed or when a method requires
         up to date information (like uptime, cputime stats).
 
+        Expects to be protected by the domains_lock.
+
         @rtype: None
         """
-        self.domains_lock.acquire()
-        try:
-            # update information for all running domains
-            # - like cpu_time, status, dying, etc.
-            running = self._running_domains()
-            for dom in running:
-                domid = dom['domid']
-                if domid in self.domains:
-                    self.domains[domid].update(dom)
-
-            # remove domains that are not running from active
-            # domain list
-            running_domids = [d['domid'] for d in running]
-            for domid, dom in self.domains.items():
-                if domid not in running_domids and domid != DOM0_ID:
-                    self._remove_domain(dom, domid)
-                    
-        finally:
-            self.domains_lock.release()
+
+        # update information for all running domains
+        # - like cpu_time, status, dying, etc.
+        running = self._running_domains()
+        for dom in running:
+            domid = dom['domid']
+            if domid in self.domains:
+                self.domains[domid].update(dom)
+
+        # remove domains that are not running from active domain list.
+        # The list might have changed by now, because the update call may
+        # cause new domains to be added, if the domain has rebooted.  We get
+        # the list again.
+        running = self._running_domains()
+        running_domids = [d['domid'] for d in running]
+        for domid, dom in self.domains.items():
+            if domid not in running_domids and domid != DOM0_ID:
+                self._remove_domain(dom, domid)
+
 
     def _add_domain(self, info):
         """Add the given domain entry to this instance's internal cache.
@@ -1228,8 +1230,12 @@ class XendDomain:
             elif cap < 0 or cap > dominfo.getVCpuCount() * 100:
                 raise XendError("cap is out of range")
 
+            assert type(weight) == int
+            assert type(cap) == int
+
             return xc.sched_credit_domain_set(dominfo.getDomid(), weight, cap)
         except Exception, ex:
+            log.exception(ex)
             raise XendError(str(ex))
 
     def domain_maxmem_set(self, domid, mem):
diff -r 40e586047ead -r 69d8263d5f85 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Wed Nov 08 12:26:34 2006 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py   Wed Nov 08 12:56:45 2006 +0000
@@ -1353,8 +1353,6 @@ class XendDomainInfo:
             except:
                 log.exception("Removing domain path failed.")
 
-            self.info['dying'] = 0
-            self.info['shutdown'] = 0
             self._stateSet(DOM_STATE_HALTED)
         finally:
             self.refresh_shutdown_lock.release()
@@ -1626,7 +1624,7 @@ class XendDomainInfo:
             raise VmError('Invalid VM Name')
 
         dom =  XendDomain.instance().domain_lookup_nr(name)
-        if dom and dom != self:
+        if dom and dom != self and not dom.info['dying']:
             raise VmError("VM name '%s' already exists" % name)
         
 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Don't complain about name non-uniqueness if one domain is dying. This happens, Xen patchbot-unstable <=