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] fix "xm list hangs"

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] fix "xm list hangs"
From: "James (song wei)" <jsong@xxxxxxxxxx>
Date: Sun, 20 Jun 2010 20:06:24 -0700 (PDT)
Delivery-date: Sun, 20 Jun 2010 20:07:22 -0700
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/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
 If a command hold domains_lock, "xm list" would hang for waiting for the
lock. Such as creating many VMs at a script (such as 20),  command of "xm
list" could hang for long time(10 mins).  I think domains_lock here only
protect update().  So, we shouldn't do update before command of "list"
really get this lock, but xm do need show the domain's information quickly. 
In this patch,  if  command couldn't get the domains_lock after 20 times
trying, "xm list" would show the information of VMs without update().

Signed-off-by: James Song (Wei) <jsong@xxxxxxxxxx> 

diff -r b9c541d9c138 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py       Tue Jun 15 13:27:14 2010
+0100
+++ b/tools/python/xen/xend/XendDomain.py       Mon Jun 21 10:47:56 2010
+0800
@@ -824,10 +824,16 @@
         if type(state) == int:
             state = POWER_STATE_NAMES[state]
         state = state.lower()
-        
-        self.domains_lock.acquire()
+        resu = False
+        count = 0
+        while True:
+            resu = self.domains_lock.acquire(0)
+            if resu or count < 20:
+                break
+            count += 1
         try:
-            self._refresh(refresh_shutdown = False)
+            if resu:
+                self._refresh(refresh_shutdown = False)
             
             # active domains
             active_domains = self.domains.values()
@@ -846,7 +852,8 @@
                                   POWER_STATE_NAMES[x._stateGet()].lower()
== state,
                               active_domains + inactive_domains)
         finally:
-            self.domains_lock.release()
+            if resu:
+                self.domains_lock.release()
 
 
     def list_sorted(self, state = DOM_STATE_RUNNING):








-James Song (Wei)
-- 
View this message in context: 
http://old.nabble.com/-PATCH--fix-%22xm-list-hangs%22-tp28944728p28944728.html
Sent from the Xen - Dev mailing list archive at Nabble.com.


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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] fix "xm list hangs", James (song wei) <=