diff --git a/api/src/com/cloud/agent/api/RebootAnswer.java b/api/src/com/cloud/agent/api/RebootAnswer.java index a16f06f2ceb..147fa661104 100644 --- a/api/src/com/cloud/agent/api/RebootAnswer.java +++ b/api/src/com/cloud/agent/api/RebootAnswer.java @@ -45,6 +45,10 @@ public class RebootAnswer extends Answer { bytesReceived = null; } + public RebootAnswer(RebootCommand cmd, Exception e) { + super(cmd, e); + } + public void setBytesReceived(Long bytesReceived) { this.bytesReceived = bytesReceived; } diff --git a/api/src/com/cloud/agent/api/StopAnswer.java b/api/src/com/cloud/agent/api/StopAnswer.java index 9b1c71d58a6..d66b671dd2b 100755 --- a/api/src/com/cloud/agent/api/StopAnswer.java +++ b/api/src/com/cloud/agent/api/StopAnswer.java @@ -34,6 +34,11 @@ public class StopAnswer extends RebootAnswer { } + public StopAnswer(StopCommand cmd, Exception e) { + super(cmd, e); + } + + @Override public Integer getVncPort() { return vncPort; } diff --git a/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java index 73032b6d6ee..1d87cda09db 100755 --- a/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java +++ b/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java @@ -103,7 +103,6 @@ import com.cloud.agent.api.ModifyStoragePoolAnswer; import com.cloud.agent.api.ModifyStoragePoolCommand; import com.cloud.agent.api.NetworkRulesSystemVmCommand; import com.cloud.agent.api.PingCommand; -import com.cloud.agent.api.PingRoutingCommand; import com.cloud.agent.api.PingRoutingWithNwGroupsCommand; import com.cloud.agent.api.PingRoutingWithOvsCommand; import com.cloud.agent.api.PingTestCommand; @@ -123,7 +122,6 @@ import com.cloud.agent.api.StartAnswer; import com.cloud.agent.api.StartCommand; import com.cloud.agent.api.StartupCommand; import com.cloud.agent.api.StartupRoutingCommand; -import com.cloud.agent.api.StartupRoutingCommand.VmState; import com.cloud.agent.api.StartupStorageCommand; import com.cloud.agent.api.StopAnswer; import com.cloud.agent.api.StopCommand; @@ -2855,7 +2853,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe task = vm.poolMigrateAsync(conn, destHost, other); try { // poll every 1 seconds - long timeout = (long)(_migratewait) * 1000L; + long timeout = (_migratewait) * 1000L; waitForTask(conn, task, 1000, timeout); checkForSuccess(conn, task); } catch (Types.HandleInvalid e) { @@ -3040,9 +3038,9 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe @Override public StopAnswer execute(StopCommand cmd) { - Connection conn = getConnection(); String vmName = cmd.getVmName(); try { + Connection conn = getConnection(); Set vms = VM.getByNameLabel(conn, vmName); // stop vm which is running on this host or is in halted state Iterator iter = vms.iterator(); @@ -3158,6 +3156,9 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe String msg = "Stop Vm " + vmName + " fail due to " + e.getMessage(); s_logger.warn(msg, e); return new StopAnswer(cmd, msg); + } catch (Exception e) { + s_logger.warn("Unable to stop " + vmName + " due to ", e); + return new StopAnswer(cmd, e); } return new StopAnswer(cmd, "Stop VM failed"); }