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 infinite loop in waitForSuspend

To: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>, Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>, Ian Campbell <Ian.Campbell@xxxxxxxxxx>
Subject: [Xen-devel] [PATCH] Fix infinite loop in waitForSuspend
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
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:from:date:message-id:subject:to:cc :content-type:content-transfer-encoding; bh=easR1ueSpi5aIlN2akb9EKx44O8m7XHHYPpktnTe0TY=; b=q+ztgaVStm+cXlRt5+GcywhIFeCIOQIoW6HA09qejngpBKIpdgLSWNpH8DRwuj3wEY 5ivUVC1NPJYOzr1Xf1bwirKB6iK+OUJJtkpxKGRZbvJM37IHXlsXwfT9LNQXb9FbIMD9 2qDF4sjjWc2k17sEz4fXb1Slxw/ScJnV9jQvc=
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=
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
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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] Fix infinite loop in waitForSuspend, Frank Pan <=