From a7a4d92739bb1892f9edaab2f6643b9c90815646 Mon Sep 17 00:00:00 2001 From: Alex Huang Date: Thu, 16 Dec 2010 14:18:53 -0800 Subject: [PATCH] Renamed Start2 to Start --- .../computing/LibvirtComputingResource.java | 14 ++++++------- .../{Start2Command.java => StartCommand.java} | 6 +++--- .../src/com/cloud/agent/api/Start2Answer.java | 21 ------------------- core/src/com/cloud/agent/api/StartAnswer.java | 21 +++++++++++++++++++ .../xen/resource/CitrixResourceBase.java | 14 ++++++------- .../hypervisor/HypervisorResource.java | 6 +++--- .../com/cloud/agent/manager/AgentAttache.java | 4 ++-- .../cloud/vm/VirtualMachineManagerImpl.java | 4 ++-- 8 files changed, 45 insertions(+), 45 deletions(-) rename api/src/com/cloud/agent/api/{Start2Command.java => StartCommand.java} (90%) delete mode 100644 core/src/com/cloud/agent/api/Start2Answer.java create mode 100644 core/src/com/cloud/agent/api/StartAnswer.java diff --git a/agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java b/agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java index f5fcc568dd1..c2d4d97ceca 100644 --- a/agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java +++ b/agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java @@ -121,8 +121,8 @@ import com.cloud.agent.api.ReadyCommand; import com.cloud.agent.api.RebootAnswer; import com.cloud.agent.api.RebootCommand; import com.cloud.agent.api.RebootRouterCommand; -import com.cloud.agent.api.Start2Answer; -import com.cloud.agent.api.Start2Command; +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.StopAnswer; @@ -1100,8 +1100,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv return execute((DeleteStoragePoolCommand) cmd); } else if (cmd instanceof FenceCommand ) { return execute((FenceCommand) cmd); - } else if (cmd instanceof Start2Command ) { - return execute((Start2Command) cmd); + } else if (cmd instanceof StartCommand ) { + return execute((StartCommand) cmd); } else if (cmd instanceof RoutingCommand) { return _virtRouterResource.executeRequest(cmd); } else if (cmd instanceof CheckSshCommand) { @@ -2390,7 +2390,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv } - protected synchronized Start2Answer execute(Start2Command cmd) { + protected synchronized StartAnswer execute(StartCommand cmd) { VirtualMachineTO vmSpec = cmd.getVirtualMachine(); String vmName = vmSpec.getName(); LibvirtVMDef vm = null; @@ -2438,11 +2438,11 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv } } state = State.Running; - return new Start2Answer(cmd); + return new StartAnswer(cmd); } catch (Exception e) { s_logger.warn("Exception ", e); handleVmStartFailure(vmName, vm); - return new Start2Answer(cmd, e.getMessage()); + return new StartAnswer(cmd, e.getMessage()); } finally { synchronized (_vms) { if (state != State.Stopped) { diff --git a/api/src/com/cloud/agent/api/Start2Command.java b/api/src/com/cloud/agent/api/StartCommand.java similarity index 90% rename from api/src/com/cloud/agent/api/Start2Command.java rename to api/src/com/cloud/agent/api/StartCommand.java index 7bcb27084f1..7f088028254 100644 --- a/api/src/com/cloud/agent/api/Start2Command.java +++ b/api/src/com/cloud/agent/api/StartCommand.java @@ -22,7 +22,7 @@ import com.cloud.agent.api.to.VirtualMachineTO; /** * This command carries information to start a VM. */ -public class Start2Command extends Command { +public class StartCommand extends Command { VirtualMachineTO vm; public VirtualMachineTO getVirtualMachine() { @@ -34,10 +34,10 @@ public class Start2Command extends Command { return true; } - protected Start2Command() { + protected StartCommand() { } - public Start2Command(VirtualMachineTO vm) { + public StartCommand(VirtualMachineTO vm) { this.vm = vm; } } diff --git a/core/src/com/cloud/agent/api/Start2Answer.java b/core/src/com/cloud/agent/api/Start2Answer.java deleted file mode 100644 index 7b6ec6eb740..00000000000 --- a/core/src/com/cloud/agent/api/Start2Answer.java +++ /dev/null @@ -1,21 +0,0 @@ -/** - * - */ -package com.cloud.agent.api; - -public class Start2Answer extends Answer { - protected Start2Answer() { - } - - public Start2Answer(Start2Command cmd, String msg) { - super(cmd, false, msg); - } - - public Start2Answer(Start2Command cmd, Exception e) { - super(cmd, false, e.getMessage()); - } - - public Start2Answer(Start2Command cmd) { - super(cmd, true, null); - } -} diff --git a/core/src/com/cloud/agent/api/StartAnswer.java b/core/src/com/cloud/agent/api/StartAnswer.java new file mode 100644 index 00000000000..48daf476e47 --- /dev/null +++ b/core/src/com/cloud/agent/api/StartAnswer.java @@ -0,0 +1,21 @@ +/** + * + */ +package com.cloud.agent.api; + +public class StartAnswer extends Answer { + protected StartAnswer() { + } + + public StartAnswer(StartCommand cmd, String msg) { + super(cmd, false, msg); + } + + public StartAnswer(StartCommand cmd, Exception e) { + super(cmd, false, e.getMessage()); + } + + public StartAnswer(StartCommand cmd) { + super(cmd, true, null); + } +} diff --git a/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java index 29415425c71..9ee165897a0 100644 --- a/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java +++ b/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java @@ -106,8 +106,8 @@ import com.cloud.agent.api.RebootCommand; import com.cloud.agent.api.RebootRouterCommand; import com.cloud.agent.api.SetupAnswer; import com.cloud.agent.api.SetupCommand; -import com.cloud.agent.api.Start2Answer; -import com.cloud.agent.api.Start2Command; +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.StartupStorageCommand; @@ -429,8 +429,8 @@ public abstract class CitrixResourceBase implements ServerResource { return execute((ModifySshKeysCommand) cmd); } else if (cmd instanceof PoolEjectCommand) { return execute((PoolEjectCommand) cmd); - } else if (cmd instanceof Start2Command) { - return execute((Start2Command)cmd); + } else if (cmd instanceof StartCommand) { + return execute((StartCommand)cmd); } else if (cmd instanceof RemoteAccessVpnCfgCommand) { return execute((RemoteAccessVpnCfgCommand)cmd); } else if (cmd instanceof VpnUsersCfgCommand) { @@ -775,7 +775,7 @@ public abstract class CitrixResourceBase implements ServerResource { return new CheckSshAnswer(cmd); } - protected Start2Answer execute(Start2Command cmd) { + protected StartAnswer execute(StartCommand cmd) { Connection conn = getConnection(); VirtualMachineTO vmSpec = cmd.getVirtualMachine(); String vmName = vmSpec.getName(); @@ -837,11 +837,11 @@ public abstract class CitrixResourceBase implements ServerResource { } state = State.Running; - return new Start2Answer(cmd); + return new StartAnswer(cmd); } catch (Exception e) { s_logger.warn("Catch Exception: " + e.getClass().toString() + " due to " + e.toString(), e); String msg = handleVmStartFailure(conn, vmName, vm, "", e); - return new Start2Answer(cmd, msg); + return new StartAnswer(cmd, msg); } finally { synchronized (_vms) { if (state != State.Stopped) { diff --git a/core/src/com/cloud/resource/hypervisor/HypervisorResource.java b/core/src/com/cloud/resource/hypervisor/HypervisorResource.java index 509d029d6c7..57f39c2ee9d 100644 --- a/core/src/com/cloud/resource/hypervisor/HypervisorResource.java +++ b/core/src/com/cloud/resource/hypervisor/HypervisorResource.java @@ -19,8 +19,8 @@ package com.cloud.resource.hypervisor; import com.cloud.agent.api.RebootAnswer; import com.cloud.agent.api.RebootCommand; -import com.cloud.agent.api.Start2Answer; -import com.cloud.agent.api.Start2Command; +import com.cloud.agent.api.StartAnswer; +import com.cloud.agent.api.StartCommand; import com.cloud.agent.api.StopAnswer; import com.cloud.agent.api.StopCommand; import com.cloud.resource.ServerResource; @@ -37,7 +37,7 @@ public interface HypervisorResource extends ServerResource { * @param cmd carries all the information necessary to start a VM * @return Start2Answer answer. */ - Start2Answer execute(Start2Command cmd); + StartAnswer execute(StartCommand cmd); /** * Stops a VM. Must return true as long as the VM does not exist. diff --git a/server/src/com/cloud/agent/manager/AgentAttache.java b/server/src/com/cloud/agent/manager/AgentAttache.java index c06464e5b25..cb01c678010 100644 --- a/server/src/com/cloud/agent/manager/AgentAttache.java +++ b/server/src/com/cloud/agent/manager/AgentAttache.java @@ -40,7 +40,7 @@ import com.cloud.agent.api.MaintainCommand; import com.cloud.agent.api.MigrateCommand; import com.cloud.agent.api.PingTestCommand; import com.cloud.agent.api.ReadyCommand; -import com.cloud.agent.api.Start2Command; +import com.cloud.agent.api.StartCommand; import com.cloud.agent.api.StopCommand; import com.cloud.agent.api.storage.CreateCommand; import com.cloud.agent.transport.Request; @@ -100,7 +100,7 @@ public abstract class AgentAttache { public final static String[] s_commandsAllowedInMaintenanceMode = new String[] { MaintainCommand.class.toString(), MigrateCommand.class.toString(), StopCommand.class.toString(), CheckVirtualMachineCommand.class.toString(), PingTestCommand.class.toString(), CheckHealthCommand.class.toString(), ReadyCommand.class.toString() }; protected final static String[] s_commandsNotAllowedInConnectingMode = - new String[] { Start2Command.class.toString(), CreateCommand.class.toString() }; + new String[] { StartCommand.class.toString(), CreateCommand.class.toString() }; static { Arrays.sort(s_commandsAllowedInMaintenanceMode); Arrays.sort(s_commandsNotAllowedInConnectingMode); diff --git a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java index a5ebf0693c1..e15fd1d4216 100644 --- a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java @@ -31,7 +31,7 @@ import org.apache.log4j.Logger; import com.cloud.agent.AgentManager; import com.cloud.agent.AgentManager.OnError; import com.cloud.agent.api.Answer; -import com.cloud.agent.api.Start2Command; +import com.cloud.agent.api.StartCommand; import com.cloud.agent.api.StopAnswer; import com.cloud.agent.api.StopCommand; import com.cloud.agent.api.to.VirtualMachineTO; @@ -422,7 +422,7 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Cluster VirtualMachineTO vmTO = hvGuru.implement(vmProfile); Commands cmds = new Commands(OnError.Revert); - cmds.addCommand(new Start2Command(vmTO)); + cmds.addCommand(new StartCommand(vmTO)); vmGuru.finalizeDeployment(cmds, vmProfile, dest, context); try {