From d14f66f58d23871dd641687c04ed539b2240a155 Mon Sep 17 00:00:00 2001 From: Anthony Xu Date: Mon, 24 Mar 2014 17:15:08 -0700 Subject: [PATCH] when start vm times out, check VM status, if it is running , return succeed. change XAPI timeout to 60 second. --- .../hypervisor/xen/resource/CitrixResourceBase.java | 10 +++++++++- server/src/com/cloud/configuration/Config.java | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) 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 3c6ddcaeef0..35bbcd1ebd4 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 @@ -3493,10 +3493,18 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe checkForSuccess(conn, task); } catch (Types.HandleInvalid e) { if (vm.getPowerState(conn) == Types.VmPowerState.RUNNING) { + s_logger.debug("VM " + vmName + " is in Running status"); task = null; return; } - throw new CloudRuntimeException("Shutdown VM catch HandleInvalid and VM is not in RUNNING state"); + throw new CloudRuntimeException("Start VM " + vmName + " catch HandleInvalid and VM is not in RUNNING state"); + } catch (Types.BadAsyncResult e) { + if (vm.getPowerState(conn) == Types.VmPowerState.RUNNING) { + s_logger.debug("VM " + vmName + " is in Running status"); + task = null; + return; + } + throw new CloudRuntimeException("Start VM " + vmName + " catch BadAsyncResult and VM is not in RUNNING state"); } } catch (XenAPIException e) { String msg = "Unable to start VM(" + vmName + ") on host(" + _host.uuid + ") due to " + e.toString(); diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java index f2fe68a78a9..af1f062c48f 100755 --- a/server/src/com/cloud/configuration/Config.java +++ b/server/src/com/cloud/configuration/Config.java @@ -683,7 +683,7 @@ public enum Config { null), StorageCleanupEnabled("Advanced", StorageManager.class, Boolean.class, "storage.cleanup.enabled", "true", "Enables/disables the storage cleanup thread.", null), UpdateWait("Advanced", AgentManager.class, Integer.class, "update.wait", "600", "Time to wait (in seconds) before alerting on a updating agent", null), - XapiWait("Advanced", AgentManager.class, Integer.class, "xapiwait", "600", "Time (in seconds) to wait for XAPI to return", null), + XapiWait("Advanced", AgentManager.class, Integer.class, "xapiwait", "60", "Time (in seconds) to wait for XAPI to return", null), MigrateWait("Advanced", AgentManager.class, Integer.class, "migratewait", "3600", "Time (in seconds) to wait for VM migrate finish", null), HAWorkers("Advanced", AgentManager.class, Integer.class, "ha.workers", "5", "Number of ha worker threads.", null), MountParent(