cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthon...@apache.org
Subject [2/2] git commit: updated refs/heads/4.2-workplace to 7fb36a5
Date Wed, 13 Nov 2013 22:58:00 GMT
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 <anthony.xu@citrix.com>
Authored: Wed Nov 13 14:57:00 2013 -0800
Committer: Anthony Xu <anthony.xu@citrix.com>
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("<value>", "").replace("</value>", "").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);


Mime
View raw message