From: "James (song wei)" <jsong@novell.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH] fix "xm list hangs"
Date: Sun, 20 Jun 2010 20:06:24 -0700 (PDT) [thread overview]
Message-ID: <28944728.post@talk.nabble.com> (raw)
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@novell.com>
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.
reply other threads:[~2010-06-21 3:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=28944728.post@talk.nabble.com \
--to=jsong@novell.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).