Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 917A41023F for ; Wed, 13 Nov 2013 22:57:59 +0000 (UTC) Received: (qmail 24815 invoked by uid 500); 13 Nov 2013 22:57:59 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 24745 invoked by uid 500); 13 Nov 2013 22:57:59 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 24710 invoked by uid 99); 13 Nov 2013 22:57:59 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Nov 2013 22:57:59 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 101478A8B15; Wed, 13 Nov 2013 22:57:59 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: anthonyxu@apache.org To: commits@cloudstack.apache.org Date: Wed, 13 Nov 2013 22:58:00 -0000 Message-Id: <0cd81f74065543a2a30c724551a6214f@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [2/2] git commit: updated refs/heads/4.2-workplace to 7fb36a5 don't retry through other XAPI calls if current one timeout, found vm stop and vm reboot are the cases. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7fb36a5b Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7fb36a5b Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7fb36a5b Branch: refs/heads/4.2-workplace Commit: 7fb36a5b0a893940ed1f62f5a8248333532c72ba Parents: 175a1da Author: Anthony Xu Authored: Wed Nov 13 14:57:00 2013 -0800 Committer: Anthony Xu Committed: Wed Nov 13 14:57:00 2013 -0800 ---------------------------------------------------------------------- .../xen/resource/CitrixResourceBase.java | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7fb36a5b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java index 0f7ef12..fa1aef3 100644 --- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java +++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java @@ -49,6 +49,8 @@ import javax.ejb.Local; import javax.naming.ConfigurationException; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; +import java.util.concurrent.TimeoutException; + import org.apache.commons.codec.binary.Base64; import org.apache.log4j.Logger; @@ -3603,7 +3605,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe return false; } - protected void waitForTask(Connection c, Task task, long pollInterval, long timeout) throws XenAPIException, XmlRpcException { + protected void waitForTask(Connection c, Task task, long pollInterval, long timeout) throws XenAPIException, XmlRpcException, TimeoutException { long beginTime = System.currentTimeMillis(); if (s_logger.isTraceEnabled()) { s_logger.trace("Task " + task.getNameLabel(c) + " (" + task.getType(c) + ") sent to " + c.getSessionReference() + " is pending completion with a " + timeout + "ms timeout"); @@ -3620,7 +3622,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe String msg = "Async " + timeout/1000 + " seconds timeout for task " + task.toString(); s_logger.warn(msg); task.cancel(c); - throw new Types.BadAsyncResult(msg); + throw new TimeoutException(msg); } } } @@ -3645,7 +3647,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe task = vm.cleanRebootAsync(conn); try { //poll every 1 seconds , timeout after 10 minutes - waitForTask(conn, task, 1000, 10 * 60 * 1000); + waitForTask(conn, task, 1000, 10 * 60 * 1000); checkForSuccess(conn, task); } catch (Types.HandleInvalid e) { if (vm.getPowerState(conn) == Types.VmPowerState.RUNNING) { @@ -3654,6 +3656,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } throw new CloudRuntimeException("Reboot VM catch HandleInvalid and VM is not in RUNNING state"); } + } catch (TimeoutException e) { + throw new CloudRuntimeException(e.toString()); } catch (XenAPIException e) { s_logger.debug("Unable to Clean Reboot VM(" + vmName + ") on host(" + _host.uuid +") due to " + e.toString() + ", try hard reboot"); try { @@ -3702,6 +3706,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } throw new CloudRuntimeException("Shutdown VM catch HandleInvalid and VM is not in HALTED state"); } + } catch (TimeoutException e) { + throw new CloudRuntimeException(e.toString()); } catch (XenAPIException e) { s_logger.debug("Unable to cleanShutdown VM(" + vmName + ") on host(" + _host.uuid +") due to " + e.toString()); try { @@ -3755,6 +3761,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } throw new CloudRuntimeException("Shutdown VM catch HandleInvalid and VM is not in RUNNING state"); } + } catch (TimeoutException e) { + throw new CloudRuntimeException(e.toString()); } catch (XenAPIException e) { String msg = "Unable to start VM(" + vmName + ") on host(" + _host.uuid +") due to " + e.toString(); s_logger.warn(msg, e); @@ -3789,6 +3797,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } throw new CloudRuntimeException("migrate VM catch HandleInvalid and VM is not running on dest host"); } + } catch (TimeoutException e) { + throw new CloudRuntimeException(e.toString()); } catch (XenAPIException e) { String msg = "Unable to migrate VM(" + vmName + ") from host(" + _host.uuid +") due to " + e.toString(); s_logger.warn(msg, e); @@ -3816,6 +3826,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe checkForSuccess(conn, task); VDI dvdi = Types.toVDI(task, conn); return dvdi; + } catch (TimeoutException e) { + throw new CloudRuntimeException(e.toString()); } finally { if (task != null) { try { @@ -3955,6 +3967,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe s_logger.trace("callHostPlugin Result: " + result); } return result.replace("", "").replace("", "").replace("\n", ""); + } catch (TimeoutException e) { + throw new CloudRuntimeException(e.toString()); } catch (Types.HandleInvalid e) { s_logger.warn("callHostPlugin failed for cmd: " + cmd + " with args " + getArgsString(args) + " due to HandleInvalid clazz:" + e.clazz + ", handle:" + e.handle);