[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] Fix infinite loop in waitForSuspend


  • To: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>, Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>, Ian Campbell <Ian.Campbell@xxxxxxxxxx>
  • From: Frank Pan <frankpzh@xxxxxxxxx>
  • Date: Wed, 30 Mar 2011 21:22:19 +0800
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 30 Mar 2011 06:23:10 -0700
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; b=IXLRE9tvKYv8RS1nXmC8RtLFSge7Y37kk9MKNkrO+DN14YIlblvYbkED2PdHGVcyLv xeLJS6qJb/mbbL9Jyp82u8jjVrc4Ypi1HWRS5jyYXTgpEsewGILrikaizBnmUFvqgQpt v1zBMPz5qXMmkpYb6wPvn2MvDpRMcKL7rowAU=
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

When guest responses the suspend request (on control/shutdown),
but fails on suspending, the xend will fall into an infinite
loop.

The following patch fixes this.

Signed-off-by: Frank Pan <frankpzh@xxxxxxxxx>
---
 tools/python/xen/xend/XendDomainInfo.py |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/tools/python/xen/xend/XendDomainInfo.py
b/tools/python/xen/xend/XendDomainInfo.py
index d5e92be..2bbd510 100644
--- a/tools/python/xen/xend/XendDomainInfo.py
+++ b/tools/python/xen/xend/XendDomainInfo.py
@@ -2983,21 +2983,19 @@ class XendDomainInfo:
         won't suspend, so we give up.  HVM guests with no PV drivers
         should already be shutdown.
         """
-        state = "suspend"
         nr_tries = 60

         self.state_updated.acquire()
         try:
             while self._stateGet() in (DOM_STATE_RUNNING,DOM_STATE_PAUSED):
                 self.state_updated.wait(1.0)
-                if state == "suspend":
-                    if nr_tries == 0:
-                        msg = ('Timeout waiting for domain %s to suspend'
-                            % self.domid)
-                        self._writeDom('control/shutdown', '')
-                        raise XendError(msg)
-                    state = self.readDom('control/shutdown')
-                    nr_tries -= 1
+                if nr_tries == 0:
+                    msg = ('Timeout waiting for domain %s to suspend'
+                           % self.domid)
+                    self._writeDom('control/shutdown', '')
+                    raise XendError(msg)
+                nr_tries -= 1
+
         finally:
             self.state_updated.release()

-- 
1.7.0.4

-- 
æéç, Frank Pan

Computer Science and Technology
Tsinghua University

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.