xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xend: avoid call to XendDomainInfo.recreate() while creating domain
@ 2011-03-22 13:14 Paolo Bonzini
  2011-03-30 16:55 ` Ian Jackson
  0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2011-03-22 13:14 UTC (permalink / raw)
  To: xen-devel

# HG changeset patch
# User Paolo Bonzini <pbonzini@redhat.com>
# Date 1300799548 -3600
# Node ID e1452f8088dc667ca57cc1c5a63983a5131d1314
# Parent  c639f0afaa74591d1053677b0a6348503a14fd78
avoid call to XendDomainInfo.recreate() while creating domain.

We observed xend failing to create a new domain on NUMA machines
in some cases.  The culprit is find_relaxed_node() which calls
XendDomain.instance().list():

                 from xen.xend import XendDomain
                 doms = XendDomain.instance().list('all')
                 for dom in filter (lambda d: d.domid != self.domid, doms):

Depending on the state of the XendDomain singleton, XendDomain._refresh
may call XendDomainInfo.recreate(); this one fails because the domain
info hasn't been initialized yet, so that self.info['memory'] is zero.
XendDomain then decides things are broken beyond repair, and destroys
the domain.

This patch skips the refresh in this case, and fixes the problem.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

diff --git a/tools/python/xen/xend/XendDomain.py b/tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py
+++ b/tools/python/xen/xend/XendDomain.py
@@ -825,7 +825,7 @@ class XendDomain:
     # ------------------------------------------------------------
     # Xen Legacy API     
 
-    def list(self, state = DOM_STATE_RUNNING):
+    def list(self, state = DOM_STATE_RUNNING, refresh = True):
         """Get list of domain objects.
 
         @param: the state in which the VMs should be -- one of the
@@ -844,7 +844,7 @@ class XendDomain:
                 break
             count += 1
         try:
-            if resu:
+            if resu and refresh:
                 self._refresh(refresh_shutdown = False)
             
             # active domains
diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py
+++ b/tools/python/xen/xend/XendDomainInfo.py
@@ -2726,7 +2726,7 @@ class XendDomainInfo:
                 nodeload = [0]
                 nodeload = nodeload * nr_nodes
                 from xen.xend import XendDomain
-                doms = XendDomain.instance().list('all')
+                doms = XendDomain.instance().list('all', False)
                 for dom in filter (lambda d: d.domid != self.domid, doms):
                     cpuinfo = dom.getVCPUInfo()
                     for vcpu in sxp.children(cpuinfo, 'vcpu'):

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

* Re: [PATCH] xend: avoid call to XendDomainInfo.recreate() while creating domain
  2011-03-22 13:14 [PATCH] xend: avoid call to XendDomainInfo.recreate() while creating domain Paolo Bonzini
@ 2011-03-30 16:55 ` Ian Jackson
  2011-03-31  7:05   ` Paolo Bonzini
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Jackson @ 2011-03-30 16:55 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: xen-devel

Paolo Bonzini writes ("[Xen-devel] [PATCH] xend: avoid call to XendDomainInfo.recreate() while creating domain"):
> avoid call to XendDomainInfo.recreate() while creating domain.

I'm not sure I'm convinced this is the right fix.  Without reading the
code, it seems to me that the problem is that the domain is added to
the list processed by XendDomain.instance().list() before it has been
properly created.

Note that use of xend is deprecated in xen-unstable and we will
probably remove it in this release cycle.  Bugfixes will still be
accepted into older trees.

Ian.

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

* Re: [PATCH] xend: avoid call to XendDomainInfo.recreate() while creating domain
  2011-03-30 16:55 ` Ian Jackson
@ 2011-03-31  7:05   ` Paolo Bonzini
  0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2011-03-31  7:05 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel

On 03/30/2011 06:55 PM, Ian Jackson wrote:
> Paolo Bonzini writes ("[Xen-devel] [PATCH] xend: avoid call to XendDomainInfo.recreate() while creating domain"):
>> avoid call to XendDomainInfo.recreate() while creating domain.
>
> I'm not sure I'm convinced this is the right fix.  Without reading the
> code, it seems to me that the problem is that the domain is added to
> the list processed by XendDomain.instance().list() before it has been
> properly created.

I thought the same, the problem is that this list comes straight from 
xc_domain_getinfo.

> Note that use of xend is deprecated in xen-unstable and we will
> probably remove it in this release cycle.  Bugfixes will still be
> accepted into older trees.

I know, I'm still pushing out RH patches when they apply though.

Paolo

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

end of thread, other threads:[~2011-03-31  7:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-22 13:14 [PATCH] xend: avoid call to XendDomainInfo.recreate() while creating domain Paolo Bonzini
2011-03-30 16:55 ` Ian Jackson
2011-03-31  7:05   ` Paolo Bonzini

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