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 01E2510A7A for ; Wed, 16 Oct 2013 00:30:04 +0000 (UTC) Received: (qmail 53861 invoked by uid 500); 16 Oct 2013 00:30:03 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 53825 invoked by uid 500); 16 Oct 2013 00:30:03 -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 53818 invoked by uid 99); 16 Oct 2013 00:30:03 -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, 16 Oct 2013 00:30:03 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 54D588B5882; Wed, 16 Oct 2013 00:30:03 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: kelveny@apache.org To: commits@cloudstack.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: git commit: updated refs/heads/vmsync-rebase to 534345e Date: Wed, 16 Oct 2013 00:30:03 +0000 (UTC) Updated Branches: refs/heads/vmsync-rebase d72af4bd0 -> 534345e8a Switch hypervisor resources to use power state Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/534345e8 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/534345e8 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/534345e8 Branch: refs/heads/vmsync-rebase Commit: 534345e8aa47da0f2cff663229c426428c07c36c Parents: d72af4b Author: Kelven Yang Authored: Tue Oct 15 17:29:13 2013 -0700 Committer: Kelven Yang Committed: Tue Oct 15 17:29:13 2013 -0700 ---------------------------------------------------------------------- .../com/cloud/agent/resource/DummyResource.java | 4 +- .../agent/api/CheckVirtualMachineAnswer.java | 10 +- .../com/cloud/agent/api/PingRoutingCommand.java | 8 +- .../api/PingRoutingWithNwGroupsCommand.java | 4 +- .../agent/api/PingRoutingWithOvsCommand.java | 4 +- .../networkservice/BareMetalResourceBase.java | 13 +- .../BaremetalDhcpResourceBase.java | 8 +- .../networkservice/BaremetalDhcpdResource.java | 4 +- .../BaremetalDnsmasqResource.java | 3 +- .../BaremetalKickStartPxeResource.java | 4 +- .../BaremetalPingPxeResource.java | 4 +- .../kvm/resource/LibvirtComputingResource.java | 171 ++++-------------- .../cloud/ovm/hypervisor/OvmResourceBase.java | 149 ++++------------ .../cloud/agent/manager/MockVmManagerImpl.java | 3 +- .../cloud/resource/AgentRoutingResource.java | 90 +++------- .../vmware/resource/VmwareResource.java | 152 +++------------- .../resource/VmwareStorageProcessor.java | 3 +- .../xen/resource/CitrixResourceBase.java | 177 +++++-------------- .../xen/resource/XenServerPoolVms.java | 2 - .../com/cloud/ha/CheckOnAgentInvestigator.java | 3 +- .../kvm/discoverer/KvmDummyResourceBase.java | 4 +- .../cloud/resource/DummyHostServerResource.java | 3 +- 22 files changed, 194 insertions(+), 629 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/534345e8/agent/src/com/cloud/agent/resource/DummyResource.java ---------------------------------------------------------------------- diff --git a/agent/src/com/cloud/agent/resource/DummyResource.java b/agent/src/com/cloud/agent/resource/DummyResource.java index 37a8b3d..c784983 100755 --- a/agent/src/com/cloud/agent/resource/DummyResource.java +++ b/agent/src/com/cloud/agent/resource/DummyResource.java @@ -29,12 +29,12 @@ import com.cloud.agent.api.Answer; import com.cloud.agent.api.CheckNetworkAnswer; import com.cloud.agent.api.CheckNetworkCommand; import com.cloud.agent.api.Command; +import com.cloud.agent.api.HostVmStateReportEntry; import com.cloud.agent.api.PingCommand; import com.cloud.agent.api.StartupCommand; import com.cloud.agent.api.StartupRoutingCommand; import com.cloud.agent.api.StartupStorageCommand; import com.cloud.agent.api.StoragePoolInfo; -import com.cloud.agent.api.StartupRoutingCommand.VmState; import com.cloud.host.Host; import com.cloud.host.Host.Type; import com.cloud.hypervisor.Hypervisor.HypervisorType; @@ -162,7 +162,7 @@ public class DummyResource implements ServerResource { @Override public StartupCommand[] initialize() { - Map changes = null; + Map changes = null; final List info = getHostInfo(); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/534345e8/core/src/com/cloud/agent/api/CheckVirtualMachineAnswer.java ---------------------------------------------------------------------- diff --git a/core/src/com/cloud/agent/api/CheckVirtualMachineAnswer.java b/core/src/com/cloud/agent/api/CheckVirtualMachineAnswer.java index 3f0ffdb..cebdfd1 100644 --- a/core/src/com/cloud/agent/api/CheckVirtualMachineAnswer.java +++ b/core/src/com/cloud/agent/api/CheckVirtualMachineAnswer.java @@ -16,24 +16,24 @@ // under the License. package com.cloud.agent.api; -import com.cloud.vm.VirtualMachine.State; +import com.cloud.vm.VirtualMachine.PowerState; public class CheckVirtualMachineAnswer extends Answer { Integer vncPort; - State state; + PowerState state; protected CheckVirtualMachineAnswer() { } - public CheckVirtualMachineAnswer(CheckVirtualMachineCommand cmd, State state, Integer vncPort, String detail) { + public CheckVirtualMachineAnswer(CheckVirtualMachineCommand cmd, PowerState state, Integer vncPort, String detail) { super(cmd, true, detail); this.state = state; this.vncPort = vncPort; } - public CheckVirtualMachineAnswer(CheckVirtualMachineCommand cmd, State state, Integer vncPort) { + public CheckVirtualMachineAnswer(CheckVirtualMachineCommand cmd, PowerState state, Integer vncPort) { this(cmd, state, vncPort, null); } @@ -46,7 +46,7 @@ public class CheckVirtualMachineAnswer extends Answer { return vncPort; } - public State getState() { + public PowerState getState() { return state; } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/534345e8/core/src/com/cloud/agent/api/PingRoutingCommand.java ---------------------------------------------------------------------- diff --git a/core/src/com/cloud/agent/api/PingRoutingCommand.java b/core/src/com/cloud/agent/api/PingRoutingCommand.java index e25ac62..8b8b554 100755 --- a/core/src/com/cloud/agent/api/PingRoutingCommand.java +++ b/core/src/com/cloud/agent/api/PingRoutingCommand.java @@ -19,22 +19,22 @@ package com.cloud.agent.api; import java.util.Map; import com.cloud.host.Host; -import com.cloud.vm.VirtualMachine.State; +import com.cloud.vm.VirtualMachine.PowerState; public class PingRoutingCommand extends PingCommand { - Map newStates; + Map newStates; boolean _gatewayAccessible = true; boolean _vnetAccessible = true; protected PingRoutingCommand() { } - public PingRoutingCommand(Host.Type type, long id, Map states) { + public PingRoutingCommand(Host.Type type, long id, Map states) { super(type, id); this.newStates = states; } - public Map getNewStates() { + public Map getNewStates() { return newStates; } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/534345e8/core/src/com/cloud/agent/api/PingRoutingWithNwGroupsCommand.java ---------------------------------------------------------------------- diff --git a/core/src/com/cloud/agent/api/PingRoutingWithNwGroupsCommand.java b/core/src/com/cloud/agent/api/PingRoutingWithNwGroupsCommand.java index 51226bc..bb183bd 100644 --- a/core/src/com/cloud/agent/api/PingRoutingWithNwGroupsCommand.java +++ b/core/src/com/cloud/agent/api/PingRoutingWithNwGroupsCommand.java @@ -21,7 +21,7 @@ import java.util.Map; import com.cloud.host.Host; import com.cloud.utils.Pair; -import com.cloud.vm.VirtualMachine.State; +import com.cloud.vm.VirtualMachine.PowerState; public class PingRoutingWithNwGroupsCommand extends PingRoutingCommand { @@ -31,7 +31,7 @@ public class PingRoutingWithNwGroupsCommand extends PingRoutingCommand { super(); } - public PingRoutingWithNwGroupsCommand(Host.Type type, long id, Map states, HashMap> nwGrpStates) { + public PingRoutingWithNwGroupsCommand(Host.Type type, long id, Map states, HashMap> nwGrpStates) { super(type, id, states); newGroupStates = nwGrpStates; } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/534345e8/core/src/com/cloud/agent/api/PingRoutingWithOvsCommand.java ---------------------------------------------------------------------- diff --git a/core/src/com/cloud/agent/api/PingRoutingWithOvsCommand.java b/core/src/com/cloud/agent/api/PingRoutingWithOvsCommand.java index d44987b..f87bed8 100644 --- a/core/src/com/cloud/agent/api/PingRoutingWithOvsCommand.java +++ b/core/src/com/cloud/agent/api/PingRoutingWithOvsCommand.java @@ -21,7 +21,7 @@ import java.util.Map; import com.cloud.host.Host; import com.cloud.utils.Pair; -import com.cloud.vm.VirtualMachine.State; +import com.cloud.vm.VirtualMachine.PowerState; public class PingRoutingWithOvsCommand extends PingRoutingCommand { List> states; @@ -31,7 +31,7 @@ public class PingRoutingWithOvsCommand extends PingRoutingCommand { } public PingRoutingWithOvsCommand(Host.Type type, long id, - Map states, List> ovsStates) { + Map states, List> ovsStates) { super(type, id, states); this.states = ovsStates; } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/534345e8/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalResourceBase.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalResourceBase.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalResourceBase.java index a814530..0bc27f5 100755 --- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalResourceBase.java +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalResourceBase.java @@ -77,6 +77,7 @@ import com.cloud.utils.script.Script2; import com.cloud.utils.script.Script2.ParamType; import com.cloud.vm.VMInstanceVO; import com.cloud.vm.VirtualMachine; +import com.cloud.vm.VirtualMachine.PowerState; import com.cloud.vm.VirtualMachine.State; import com.cloud.vm.dao.VMInstanceDao; @@ -314,13 +315,13 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource } } - protected Map fullSync() { - Map states = new HashMap(); + protected Map fullSync() { + Map states = new HashMap(); if (hostId != null) { vmDao = ComponentContext.getComponent(VMInstanceDao.class); final List vms = vmDao.listByHostId(hostId); for (VMInstanceVO vm : vms) { - states.put(vm.getInstanceName(), vm.getState()); + states.put(vm.getInstanceName(), vm.getState() == State.Running ? PowerState.PowerOn : PowerState.PowerOff); } } /* @@ -411,7 +412,7 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource } protected CheckVirtualMachineAnswer execute(final CheckVirtualMachineCommand cmd) { - return new CheckVirtualMachineAnswer(cmd, State.Stopped, null); + return new CheckVirtualMachineAnswer(cmd, PowerState.PowerOff, null); } protected Answer execute(IpmiBootorResetCommand cmd) { @@ -563,8 +564,8 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource } } - protected HashMap deltaSync() { - final HashMap changes = new HashMap(); + protected HashMap deltaSync() { + final HashMap changes = new HashMap(); /* * Disable sync until we find a way that only tracks status but not does * action http://git-wip-us.apache.org/repos/asf/cloudstack/blob/534345e8/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpResourceBase.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpResourceBase.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpResourceBase.java index 2a17a43..7653b09 100755 --- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpResourceBase.java +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpResourceBase.java @@ -38,14 +38,10 @@ import com.cloud.agent.api.ReadyAnswer; import com.cloud.agent.api.ReadyCommand; import com.cloud.agent.api.StartupCommand; import com.cloud.agent.api.StartupExternalDhcpCommand; -import com.cloud.agent.api.StartupPxeServerCommand; import com.cloud.host.Host.Type; import com.cloud.resource.ServerResource; import com.cloud.utils.component.ManagerBase; -import com.cloud.utils.script.Script; -import com.cloud.utils.ssh.SSHCmdHelper; -import com.cloud.vm.VirtualMachine.State; -import com.trilead.ssh2.SCPClient; +import com.cloud.vm.VirtualMachine.PowerState; public class BaremetalDhcpResourceBase extends ManagerBase implements ServerResource { private static final Logger s_logger = Logger.getLogger(BaremetalDhcpResourceBase.class); @@ -129,7 +125,7 @@ public class BaremetalDhcpResourceBase extends ManagerBase implements ServerReso @Override public PingCommand getCurrentStatus(long id) { //TODO: check server - return new PingRoutingCommand(getType(), id, new HashMap()); + return new PingRoutingCommand(getType(), id, new HashMap()); } protected ReadyAnswer execute(ReadyCommand cmd) { http://git-wip-us.apache.org/repos/asf/cloudstack/blob/534345e8/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpdResource.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpdResource.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpdResource.java index a27a6f2..1ab89e5 100755 --- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpdResource.java +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpdResource.java @@ -36,7 +36,7 @@ import com.cloud.agent.api.PingRoutingCommand; import com.cloud.agent.api.routing.DhcpEntryCommand; import com.cloud.utils.script.Script; import com.cloud.utils.ssh.SSHCmdHelper; -import com.cloud.vm.VirtualMachine.State; +import com.cloud.vm.VirtualMachine.PowerState; import com.trilead.ssh2.SCPClient; public class BaremetalDhcpdResource extends BaremetalDhcpResourceBase { @@ -105,7 +105,7 @@ public class BaremetalDhcpdResource extends BaremetalDhcpResourceBase { return null; } else { SSHCmdHelper.releaseSshConnection(sshConnection); - return new PingRoutingCommand(getType(), id, new HashMap()); + return new PingRoutingCommand(getType(), id, new HashMap()); } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/534345e8/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDnsmasqResource.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDnsmasqResource.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDnsmasqResource.java index d0fb2b4..d9a2a3a 100755 --- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDnsmasqResource.java +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDnsmasqResource.java @@ -37,6 +37,7 @@ import com.cloud.agent.api.PingRoutingCommand; import com.cloud.agent.api.routing.DhcpEntryCommand; import com.cloud.utils.script.Script; import com.cloud.utils.ssh.SSHCmdHelper; +import com.cloud.vm.VirtualMachine.PowerState; import com.cloud.vm.VirtualMachine.State; import com.trilead.ssh2.SCPClient; @@ -98,7 +99,7 @@ public class BaremetalDnsmasqResource extends BaremetalDhcpResourceBase { return null; } else { SSHCmdHelper.releaseSshConnection(sshConnection); - return new PingRoutingCommand(getType(), id, new HashMap()); + return new PingRoutingCommand(getType(), id, new HashMap()); } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/534345e8/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartPxeResource.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartPxeResource.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartPxeResource.java index 7a7a515..cb9315e 100755 --- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartPxeResource.java +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartPxeResource.java @@ -35,7 +35,7 @@ import com.cloud.agent.api.routing.VmDataCommand; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.script.Script; import com.cloud.utils.ssh.SSHCmdHelper; -import com.cloud.vm.VirtualMachine.State; +import com.cloud.vm.VirtualMachine.PowerState; import com.trilead.ssh2.SCPClient; public class BaremetalKickStartPxeResource extends BaremetalPxeResourceBase { @@ -106,7 +106,7 @@ public class BaremetalKickStartPxeResource extends BaremetalPxeResourceBase { return null; } else { SSHCmdHelper.releaseSshConnection(sshConnection); - return new PingRoutingCommand(getType(), id, new HashMap()); + return new PingRoutingCommand(getType(), id, new HashMap()); } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/534345e8/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPingPxeResource.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPingPxeResource.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPingPxeResource.java index 2fb5415..e36d850 100755 --- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPingPxeResource.java +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPingPxeResource.java @@ -40,7 +40,7 @@ import com.cloud.agent.api.baremetal.prepareCreateTemplateCommand; import com.cloud.agent.api.routing.VmDataCommand; import com.cloud.utils.script.Script; import com.cloud.utils.ssh.SSHCmdHelper; -import com.cloud.vm.VirtualMachine.State; +import com.cloud.vm.VirtualMachine.PowerState; import com.trilead.ssh2.SCPClient; public class BaremetalPingPxeResource extends BaremetalPxeResourceBase { @@ -142,7 +142,7 @@ public class BaremetalPingPxeResource extends BaremetalPxeResourceBase { return null; } else { SSHCmdHelper.releaseSshConnection(sshConnection); - return new PingRoutingCommand(getType(), id, new HashMap()); + return new PingRoutingCommand(getType(), id, new HashMap()); } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/534345e8/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java index af31d48..08c6370 100755 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java @@ -241,6 +241,7 @@ import com.cloud.utils.script.OutputInterpreter; import com.cloud.utils.script.Script; import com.cloud.vm.DiskProfile; import com.cloud.vm.VirtualMachine; +import com.cloud.vm.VirtualMachine.PowerState; import com.cloud.vm.VirtualMachine.State; import com.ceph.rados.Rados; @@ -378,21 +379,21 @@ ServerResource { protected int _timeout; protected int _cmdsTimeout; protected int _stopTimeout; - protected static HashMap s_statesTable; + protected static HashMap s_statesTable; static { - s_statesTable = new HashMap(); + s_statesTable = new HashMap(); s_statesTable.put(DomainInfo.DomainState.VIR_DOMAIN_SHUTOFF, - State.Stopped); + PowerState.PowerOff); s_statesTable.put(DomainInfo.DomainState.VIR_DOMAIN_PAUSED, - State.Running); + PowerState.PowerOn); s_statesTable.put(DomainInfo.DomainState.VIR_DOMAIN_RUNNING, - State.Running); + PowerState.PowerOn); s_statesTable.put(DomainInfo.DomainState.VIR_DOMAIN_BLOCKED, - State.Running); + PowerState.PowerOn); s_statesTable.put(DomainInfo.DomainState.VIR_DOMAIN_NOSTATE, - State.Unknown); + PowerState.PowerUnknown); s_statesTable.put(DomainInfo.DomainState.VIR_DOMAIN_SHUTDOWN, - State.Stopping); + PowerState.PowerOff); } protected HashMap _vms = new HashMap(20); @@ -2778,18 +2779,18 @@ ServerResource { return new ReadyAnswer(cmd); } - protected State convertToState(DomainInfo.DomainState ps) { - final State state = s_statesTable.get(ps); - return state == null ? State.Unknown : state; + protected PowerState convertToState(DomainInfo.DomainState ps) { + final PowerState state = s_statesTable.get(ps); + return state == null ? PowerState.PowerUnknown : state; } - protected State getVmState(Connect conn, final String vmName) { + protected PowerState getVmState(Connect conn, final String vmName) { int retry = 3; Domain vms = null; while (retry-- > 0) { try { vms = conn.domainLookupByName(vmName); - State s = convertToState(vms.getInfo().state); + PowerState s = convertToState(vms.getInfo().state); return s; } catch (final LibvirtException e) { s_logger.warn("Can't get vm state " + vmName + e.getMessage() @@ -2804,15 +2805,15 @@ ServerResource { } } } - return State.Stopped; + return PowerState.PowerOff; } private Answer execute(CheckVirtualMachineCommand cmd) { try { Connect conn = LibvirtConnection.getConnectionByVmName(cmd.getVmName()); - final State state = getVmState(conn, cmd.getVmName()); + final PowerState state = getVmState(conn, cmd.getVmName()); Integer vncPort = null; - if (state == State.Running) { + if (state == PowerState.PowerOn) { vncPort = getVncPort(conn, cmd.getVmName()); synchronized (_vms) { @@ -3930,7 +3931,7 @@ ServerResource { @Override public PingCommand getCurrentStatus(long id) { - final HashMap newStates = sync(); + final HashMap newStates = sync(); if (!_can_bridge_firewall) { return new PingRoutingCommand(com.cloud.host.Host.Type.Routing, id, @@ -3961,7 +3962,7 @@ ServerResource { @Override public StartupCommand[] initialize() { - Map changes = null; + Map changes = null; synchronized (_vms) { _vms.clear(); @@ -4009,120 +4010,16 @@ ServerResource { return new StartupCommand[] { cmd }; } } - - protected HashMap sync() { - HashMap newStates; - HashMap oldStates = null; - - final HashMap changes = new HashMap(); - - synchronized (_vms) { - newStates = getAllVms(); - if (newStates == null) { - s_logger.debug("Unable to get the vm states so no state sync at this point."); - return changes; - } - - oldStates = new HashMap(_vms.size()); - oldStates.putAll(_vms); - - for (final Map.Entry entry : newStates.entrySet()) { - final String vm = entry.getKey(); - - State newState = entry.getValue(); - final State oldState = oldStates.remove(vm); - - if (newState == State.Stopped && oldState != State.Stopping - && oldState != null && oldState != State.Stopped) { - newState = getRealPowerState(vm); - } - - if (s_logger.isTraceEnabled()) { - s_logger.trace("VM " + vm + ": libvirt has state " - + newState + " and we have state " - + (oldState != null ? oldState.toString() : "null")); - } - - if (vm.startsWith("migrating")) { - s_logger.debug("Migration detected. Skipping"); - continue; - } - if (oldState == null) { - _vms.put(vm, newState); - s_logger.debug("Detecting a new state but couldn't find a old state so adding it to the changes: " - + vm); - changes.put(vm, newState); - } else if (oldState == State.Starting) { - if (newState == State.Running) { - _vms.put(vm, newState); - } else if (newState == State.Stopped) { - s_logger.debug("Ignoring vm " + vm - + " because of a lag in starting the vm."); - } - } else if (oldState == State.Migrating) { - if (newState == State.Running) { - s_logger.debug("Detected that an migrating VM is now running: " - + vm); - _vms.put(vm, newState); - } - } else if (oldState == State.Stopping) { - if (newState == State.Stopped) { - _vms.put(vm, newState); - } else if (newState == State.Running) { - s_logger.debug("Ignoring vm " + vm - + " because of a lag in stopping the vm. "); - } - } else if (oldState != newState) { - _vms.put(vm, newState); - if (newState == State.Stopped) { - if (_vmsKilled.remove(vm)) { - s_logger.debug("VM " + vm - + " has been killed for storage. "); - newState = State.Error; - } - } - changes.put(vm, newState); - } - } - - for (final Map.Entry entry : oldStates.entrySet()) { - final String vm = entry.getKey(); - final State oldState = entry.getValue(); - - if (s_logger.isTraceEnabled()) { - s_logger.trace("VM " - + vm - + " is now missing from libvirt so reporting stopped"); - } - - if (oldState == State.Stopping) { - s_logger.debug("Ignoring VM " + vm - + " in transition state stopping."); - _vms.remove(vm); - } else if (oldState == State.Starting) { - s_logger.debug("Ignoring VM " + vm - + " in transition state starting."); - } else if (oldState == State.Stopped) { - _vms.remove(vm); - } else if (oldState == State.Migrating) { - s_logger.debug("Ignoring VM " + vm + " in migrating state."); - } else { - _vms.remove(vm); - State state = State.Stopped; - if (_vmsKilled.remove(entry.getKey())) { - s_logger.debug("VM " + vm - + " has been killed by storage monitor"); - state = State.Error; - } - changes.put(entry.getKey(), state); - } - } - } - - return changes; + + protected HashMap sync() { + HashMap newStates = getAllVms(); + if(newStates != null) + return newStates; + + return new HashMap(); } - protected State getRealPowerState(String vm) { + protected PowerState getRealPowerState(String vm) { int i = 0; s_logger.trace("Checking on the HALTED State"); Domain dm = null; @@ -4154,7 +4051,7 @@ ServerResource { s_logger.trace("Ignoring InterruptedException.", e); } } - return State.Stopped; + return PowerState.PowerOff; } protected List getAllVmNames(Connect conn) { @@ -4197,8 +4094,8 @@ ServerResource { return la; } - private HashMap getAllVms() { - final HashMap vmStates = new HashMap(); + private HashMap getAllVms() { + final HashMap vmStates = new HashMap(); Connect conn = null; if (_hypervisorType == HypervisorType.LXC) { @@ -4222,8 +4119,8 @@ ServerResource { return vmStates; } - private HashMap getAllVms(Connect conn) { - final HashMap vmStates = new HashMap(); + private HashMap getAllVms(Connect conn) { + final HashMap vmStates = new HashMap(); String[] vms = null; int[] ids = null; @@ -4248,7 +4145,7 @@ ServerResource { DomainInfo.DomainState ps = dm.getInfo().state; - final State state = convertToState(ps); + final PowerState state = convertToState(ps); s_logger.trace("VM " + dm.getName() + ": powerstate = " + ps + "; vm state=" + state.toString()); @@ -4273,7 +4170,7 @@ ServerResource { dm = conn.domainLookupByName(vms[i]); DomainInfo.DomainState ps = dm.getInfo().state; - final State state = convertToState(ps); + final PowerState state = convertToState(ps); String vmName = dm.getName(); s_logger.trace("VM " + vmName + ": powerstate = " + ps + "; vm state=" + state.toString()); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/534345e8/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmResourceBase.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmResourceBase.java b/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmResourceBase.java index 1eddedc..81d46ec 100755 --- a/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmResourceBase.java +++ b/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmResourceBase.java @@ -131,6 +131,7 @@ import com.cloud.utils.script.Script; import com.cloud.utils.ssh.SSHCmdHelper; import com.cloud.vm.DiskProfile; import com.cloud.vm.VirtualMachine; +import com.cloud.vm.VirtualMachine.PowerState; import com.cloud.vm.VirtualMachine.State; import com.trilead.ssh2.SCPClient; @@ -154,16 +155,16 @@ public class OvmResourceBase implements ServerResource, HypervisorResource { static boolean _isHeartBeat = false; List _bridges = null; protected HashMap _vms = new HashMap(50); - static HashMap _stateMaps; + static HashMap _stateMaps; private final Map> _vmNetworkStats= new ConcurrentHashMap>(); private static String _ovsAgentPath = "/opt/ovs-agent-latest"; static { - _stateMaps = new HashMap(); - _stateMaps.put("RUNNING", State.Running); - _stateMaps.put("DOWN", State.Stopped); - _stateMaps.put("ERROR", State.Error); - _stateMaps.put("SUSPEND", State.Stopped); + _stateMaps = new HashMap(); + _stateMaps.put("RUNNING", PowerState.PowerOn); + _stateMaps.put("DOWN", PowerState.PowerOff); + _stateMaps.put("ERROR", PowerState.PowerUnknown); + _stateMaps.put("SUSPEND", PowerState.PowerOff); } @Override @@ -378,7 +379,7 @@ public class OvmResourceBase implements ServerResource, HypervisorResource { try { StartupRoutingCommand cmd = new StartupRoutingCommand(); fillHostInfo(cmd); - Map changes = null; + Map changes = null; synchronized (_vms) { _vms.clear(); changes = sync(); @@ -396,7 +397,7 @@ public class OvmResourceBase implements ServerResource, HypervisorResource { public PingCommand getCurrentStatus(long id) { try { OvmHost.ping(_conn); - HashMap newStates = sync(); + HashMap newStates = sync(); return new PingRoutingCommand(getType(), id, newStates); } catch (XmlRpcException e) { s_logger.debug("Check agent status failed", e); @@ -776,125 +777,35 @@ public class OvmResourceBase implements ServerResource, HypervisorResource { } } - private State toState(String vmName, String s) { - State state = _stateMaps.get(s); + private PowerState toState(String vmName, String s) { + PowerState state = _stateMaps.get(s); if (state == null) { s_logger.debug("Unkown state " + s + " for " + vmName); - state = State.Unknown; + state = PowerState.PowerUnknown; } return state; } - protected HashMap getAllVms() throws XmlRpcException { - final HashMap vmStates = new HashMap(); + protected HashMap getAllVms() throws XmlRpcException { + final HashMap vmStates = new HashMap(); Map vms = OvmHost.getAllVms(_conn); for (final Map.Entry entry : vms.entrySet()) { - State state = toState(entry.getKey(), entry.getValue()); + PowerState state = toState(entry.getKey(), entry.getValue()); vmStates.put(entry.getKey(), state); } return vmStates; } - protected HashMap sync() { - HashMap newStates; - HashMap oldStates = null; - - try { - final HashMap changes = new HashMap(); - newStates = getAllVms(); - if (newStates == null) { - s_logger.debug("Unable to get the vm states so no state sync at this point."); - return null; - } - - synchronized (_vms) { - oldStates = new HashMap(_vms.size()); - oldStates.putAll(_vms); - - for (final Map.Entry entry : newStates - .entrySet()) { - final String vm = entry.getKey(); - - State newState = entry.getValue(); - final State oldState = oldStates.remove(vm); - - if (s_logger.isTraceEnabled()) { - s_logger.trace("VM " + vm + ": ovm has state " + newState + " and we have state " + (oldState != null ? oldState.toString() : "null")); - } - - /* - * TODO: what is migrating ??? if - * (vm.startsWith("migrating")) { - * s_logger.debug("Migrating from xen detected. Skipping"); - * continue; } - */ - - if (oldState == null) { - _vms.put(vm, newState); - s_logger.debug("Detecting a new state but couldn't find a old state so adding it to the changes: " - + vm); - changes.put(vm, newState); - } else if (oldState == State.Starting) { - if (newState == State.Running) { - _vms.put(vm, newState); - } else if (newState == State.Stopped) { - s_logger.debug("Ignoring vm " + vm - + " because of a lag in starting the vm."); - } - } else if (oldState == State.Migrating) { - if (newState == State.Running) { - s_logger.debug("Detected that an migrating VM is now running: " - + vm); - _vms.put(vm, newState); - } - } else if (oldState == State.Stopping) { - if (newState == State.Stopped) { - _vms.put(vm, newState); - } else if (newState == State.Running) { - s_logger.debug("Ignoring vm " + vm - + " because of a lag in stopping the vm. "); - } - } else if (oldState != newState) { - _vms.put(vm, newState); - if (newState == State.Stopped) { - //TODO: need anything here? - } - changes.put(vm, newState); - } - } - - for (final Map.Entry entry : oldStates.entrySet()) { - final String vm = entry.getKey(); - final State oldState = entry.getValue(); - - if (s_logger.isTraceEnabled()) { - s_logger.trace("VM " + vm + " is now missing from ovm server so reporting stopped"); - } - - if (oldState == State.Stopping) { - s_logger.debug("Ignoring VM " + vm + " in transition state stopping."); - _vms.remove(vm); - } else if (oldState == State.Starting) { - s_logger.debug("Ignoring VM " + vm + " in transition state starting."); - } else if (oldState == State.Stopped) { - _vms.remove(vm); - } else if (oldState == State.Migrating) { - s_logger.debug("Ignoring VM " + vm + " in migrating state."); - } else { - _vms.remove(vm); - State state = State.Stopped; - // TODO: need anything here??? - changes.put(entry.getKey(), state); - } - } - } - - return changes; - } catch (Exception e) { - s_logger.debug("Ovm full sync failed", e); - return null; - } - } + protected HashMap sync() { + try { + HashMap newStates = getAllVms(); + + if(newStates != null) + return newStates; + } catch(Exception e) { + } + return new HashMap(); + } protected GetStorageStatsAnswer execute(final GetStorageStatsCommand cmd) { try { @@ -1017,14 +928,14 @@ public class OvmResourceBase implements ServerResource, HypervisorResource { try { Map res = OvmVm.register(_conn, vmName); Integer vncPort = Integer.parseInt(res.get("vncPort")); - HashMap states = getAllVms(); - State vmState = states.get(vmName); + HashMap states = getAllVms(); + PowerState vmState = states.get(vmName); if (vmState == null) { s_logger.warn("Check state of " + vmName + " return null in CheckVirtualMachineCommand"); - vmState = State.Stopped; + vmState = PowerState.PowerOff; } - if (vmState == State.Running) { + if (vmState == PowerState.PowerOn) { synchronized (_vms) { _vms.put(vmName, State.Running); } @@ -1033,7 +944,7 @@ public class OvmResourceBase implements ServerResource, HypervisorResource { return new CheckVirtualMachineAnswer(cmd, vmState, vncPort); } catch (Exception e) { s_logger.debug("Check migration for " + vmName + " failed", e); - return new CheckVirtualMachineAnswer(cmd, State.Stopped, null); + return new CheckVirtualMachineAnswer(cmd, PowerState.PowerOff, null); } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/534345e8/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockVmManagerImpl.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockVmManagerImpl.java b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockVmManagerImpl.java index 64df113..b05824d 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockVmManagerImpl.java +++ b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockVmManagerImpl.java @@ -74,6 +74,7 @@ import com.cloud.utils.Ternary; import com.cloud.utils.component.ManagerBase; import com.cloud.utils.db.Transaction; import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.vm.VirtualMachine.PowerState; import com.cloud.vm.VirtualMachine.State; import org.apache.log4j.Logger; import org.springframework.stereotype.Component; @@ -347,7 +348,7 @@ public class MockVmManagerImpl extends ManagerBase implements MockVmManager { } txn.commit(); - return new CheckVirtualMachineAnswer(cmd, vm.getState(), vm.getVncPort()); + return new CheckVirtualMachineAnswer(cmd, vm.getState() == State.Running ? PowerState.PowerOn : PowerState.PowerOff, vm.getVncPort()); } catch (Exception ex) { txn.rollback(); throw new CloudRuntimeException("unable to fetch vm state " + cmd.getVmName(), ex); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/534345e8/plugins/hypervisors/simulator/src/com/cloud/resource/AgentRoutingResource.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/simulator/src/com/cloud/resource/AgentRoutingResource.java b/plugins/hypervisors/simulator/src/com/cloud/resource/AgentRoutingResource.java index 8a03c4b..46ed870 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/resource/AgentRoutingResource.java +++ b/plugins/hypervisors/simulator/src/com/cloud/resource/AgentRoutingResource.java @@ -53,6 +53,7 @@ import com.cloud.simulator.MockVMVO; import com.cloud.storage.Storage.StorageResourceType; import com.cloud.storage.template.TemplateProp; import com.cloud.utils.Pair; +import com.cloud.vm.VirtualMachine.PowerState; import com.cloud.vm.VirtualMachine.State; public class AgentRoutingResource extends AgentStorageResource { @@ -112,17 +113,29 @@ public class AgentRoutingResource extends AgentStorageResource { _vms.putAll(_simMgr.getVmStates(hostGuid)); } } - final HashMap newStates = sync(); + final HashMap newStates = sync(); HashMap> nwGrpStates = _simMgr.syncNetworkGroups(hostGuid); return new PingRoutingWithNwGroupsCommand(getType(), id, newStates, nwGrpStates); } + private HashMap getVmStates() { + Map rawStates = _simMgr.getVmStates(this.hostGuid); + if(rawStates != null) { + HashMap states = new HashMap(); + for(Map.Entry entry : rawStates.entrySet()) { + states.put(entry.getKey(), entry.getValue() == State.Running ? PowerState.PowerOn : PowerState.PowerOff); + } + return states; + } + return new HashMap(); + } + @Override public StartupCommand[] initialize() { synchronized (_vms) { _vms.clear(); } - Map changes = _simMgr.getVmStates(this.hostGuid); + Map changes = getVmStates(); Map vmsMaps = _simMgr.getVms(this.hostGuid); totalCpu = agentHost.getCpuCount() * agentHost.getCpuSpeed(); totalMem = agentHost.getMemorySize(); @@ -251,8 +264,8 @@ public class AgentRoutingResource extends AgentStorageResource { protected CheckVirtualMachineAnswer execute(final CheckVirtualMachineCommand cmd) { final String vmName = cmd.getVmName(); CheckVirtualMachineAnswer result = (CheckVirtualMachineAnswer)_simMgr.simulate(cmd, hostGuid); - State state = result.getState(); - if (state == State.Running) { + PowerState state = result.getState(); + if (state == PowerState.PowerOn) { synchronized (_vms) { _vms.put(vmName, State.Running); } @@ -275,72 +288,9 @@ public class AgentRoutingResource extends AgentStorageResource { return info; } - - protected HashMap sync() { - Map newStates; - Map oldStates = null; - - HashMap changes = new HashMap(); - - synchronized (_vms) { - oldStates = new HashMap(_vms.size()); - oldStates.putAll(_vms); - newStates = new HashMap(_vms.size()); - newStates.putAll(_vms); - - for (Map.Entry entry : newStates.entrySet()) { - String vm = entry.getKey(); - - State newState = entry.getValue(); - State oldState = oldStates.remove(vm); - - if (s_logger.isTraceEnabled()) { - s_logger.trace("VM " + vm + ": has state " + newState + " and we have state " + (oldState != null ? oldState.toString() : "null")); - } - - if (oldState == null) { - _vms.put(vm, newState); - changes.put(vm, newState); - } else if (oldState == State.Starting) { - if (newState == State.Running) { - _vms.put(vm, newState); - } else if (newState == State.Stopped) { - s_logger.debug("Ignoring vm " + vm + " because of a lag in starting the vm."); - } - } else if (oldState == State.Stopping) { - if (newState == State.Stopped) { - _vms.put(vm, newState); - } else if (newState == State.Running) { - s_logger.debug("Ignoring vm " + vm + " because of a lag in stopping the vm. "); - } - } else if (oldState != newState) { - _vms.put(vm, newState); - changes.put(vm, newState); - } - } - - for (Map.Entry entry : oldStates.entrySet()) { - String vm = entry.getKey(); - State oldState = entry.getValue(); - - if (s_logger.isTraceEnabled()) { - s_logger.trace("VM " + vm + " is now missing from simulator agent so reporting stopped"); - } - - if (oldState == State.Stopping) { - s_logger.debug("Ignoring VM " + vm + " in transition state stopping."); - _vms.remove(vm); - } else if (oldState == State.Starting) { - s_logger.debug("Ignoring VM " + vm + " in transition state starting."); - } else if (oldState == State.Stopped) { - _vms.remove(vm); - } else { - changes.put(entry.getKey(), State.Stopped); - } - } - } - - return changes; + + protected HashMap sync() { + return this.getVmStates(); } private Answer execute(ShutdownCommand cmd) { http://git-wip-us.apache.org/repos/asf/cloudstack/blob/534345e8/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java index a35a966..cc7aadf0f 100755 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java @@ -329,6 +329,7 @@ import com.cloud.utils.net.NetUtils; import com.cloud.utils.ssh.SshHelper; import com.cloud.vm.DiskProfile; import com.cloud.vm.VirtualMachine; +import com.cloud.vm.VirtualMachine.PowerState; import com.cloud.vm.VirtualMachine.State; import com.cloud.vm.VirtualMachineName; import com.cloud.vm.VmDetailConstants; @@ -386,12 +387,12 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa protected StorageSubsystemCommandHandler storageHandler; - protected static HashMap s_statesTable; + protected static HashMap s_statesTable; static { - s_statesTable = new HashMap(); - s_statesTable.put(VirtualMachinePowerState.POWERED_ON, State.Running); - s_statesTable.put(VirtualMachinePowerState.POWERED_OFF, State.Stopped); - s_statesTable.put(VirtualMachinePowerState.SUSPENDED, State.Stopped); + s_statesTable = new HashMap(); + s_statesTable.put(VirtualMachinePowerState.POWERED_ON, PowerState.PowerOn); + s_statesTable.put(VirtualMachinePowerState.POWERED_OFF, PowerState.PowerOff); + s_statesTable.put(VirtualMachinePowerState.SUSPENDED, PowerState.PowerOn); } public Gson getGson() { @@ -2552,7 +2553,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa long requestedMaxMemoryInMb = vmSpec.getMaxRam() / (1024 * 1024); // Check if VM is really running on hypervisor host - if (getVmState(vmMo) != State.Running) { + if (getVmState(vmMo) != PowerState.PowerOn) { throw new CloudRuntimeException("Found that the VM " + vmMo.getVmName() + " is not running. Unable to scale-up this VM"); } @@ -2632,7 +2633,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa boolean hasSnapshot = false; if (vmMo != null) { s_logger.info("VM " + vmInternalCSName + " already exists, tear down devices for reconfiguration"); - if (getVmState(vmMo) != State.Stopped) + if (getVmState(vmMo) != PowerState.PowerOff) vmMo.safePowerOff(_shutdown_waitMs); // retrieve disk information before we tear down @@ -2655,7 +2656,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa takeVmFromOtherHyperHost(hyperHost, vmInternalCSName); - if (getVmState(vmMo) != State.Stopped) + if (getVmState(vmMo) != PowerState.PowerOff) vmMo.safePowerOff(_shutdown_waitMs); diskInfoBuilder = vmMo.getDiskInfoBuilder(); @@ -3773,7 +3774,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa HashMap vmStatsMap = null; try { - HashMap newStates = getVmStates(); + HashMap newStates = getVmStates(); // getVmNames should return all i-x-y values. List requestedVmNames = cmd.getVmNames(); @@ -3854,7 +3855,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa try { vmMo.setCustomFieldValue(CustomFieldConstants.CLOUD_NIC_MASK, "0"); - if (getVmState(vmMo) != State.Stopped) { + if (getVmState(vmMo) != PowerState.PowerOff) { if (vmMo.safePowerOff(_shutdown_waitMs)) { state = State.Stopped; return new StopAnswer(cmd, "Stop VM " + cmd.getVmName() + " Succeed", 0, true); @@ -3965,7 +3966,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } final String vmName = cmd.getVmName(); - State state = State.Unknown; + PowerState state = PowerState.PowerUnknown; Integer vncPort = null; VmwareContext context = getServiceContext(); @@ -3975,7 +3976,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa VirtualMachineMO vmMo = hyperHost.findVmOnHyperHost(vmName); if (vmMo != null) { state = getVmState(vmMo); - if (state == State.Running) { + if (state == PowerState.PowerOn) { synchronized (_vms) { _vms.put(vmName, State.Running); } @@ -5428,7 +5429,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa List networks = vmMo.getNetworksWithDetails(); // tear down all devices first before we destroy the VM to avoid accidently delete disk backing files - if (getVmState(vmMo) != State.Stopped) + if (getVmState(vmMo) != PowerState.PowerOff) vmMo.safePowerOff(_shutdown_waitMs); vmMo.tearDownDevices(new Class[] { /* VirtualDisk.class, */ VirtualEthernetCard.class }); vmMo.destroy(); @@ -5754,7 +5755,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa @Override public PingCommand getCurrentStatus(long id) { try { - HashMap newStates = sync(); + HashMap newStates = sync(); if (newStates == null) { return null; } @@ -5868,7 +5869,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa StartupRoutingCommand cmd = new StartupRoutingCommand(); fillHostInfo(cmd); - Map changes = null; + Map changes = null; synchronized (_vms) { _vms.clear(); changes = sync(); @@ -6029,112 +6030,13 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa details.put("NativeHA", "true"); } } - - protected HashMap sync() { - HashMap changes = new HashMap(); - HashMap oldStates = null; - - try { - synchronized (_vms) { - HashMap newStates = getVmStates(); - oldStates = new HashMap(_vms.size()); - oldStates.putAll(_vms); - - for (final Map.Entry entry : newStates.entrySet()) { - final String vm = entry.getKey(); - - State newState = entry.getValue(); - final State oldState = oldStates.remove(vm); - - if (s_logger.isTraceEnabled()) { - s_logger.trace("VM " + vm + ": vSphere has state " + newState + " and we have state " + (oldState != null ? oldState.toString() : "null")); - } - - if (vm.startsWith("migrating")) { - s_logger.debug("Migrating detected. Skipping"); - continue; - } - - if (oldState == null) { - _vms.put(vm, newState); - s_logger.debug("Detecting a new state but couldn't find a old state so adding it to the changes: " + vm); - changes.put(vm, newState); - } else if (oldState == State.Starting) { - if (newState == State.Running) { - _vms.put(vm, newState); - } else if (newState == State.Stopped) { - s_logger.debug("Ignoring vm " + vm + " because of a lag in starting the vm."); - } - } else if (oldState == State.Migrating) { - if (newState == State.Running) { - s_logger.debug("Detected that an migrating VM is now running: " + vm); - _vms.put(vm, newState); - } - } else if (oldState == State.Stopping) { - if (newState == State.Stopped) { - _vms.put(vm, newState); - } else if (newState == State.Running) { - s_logger.debug("Ignoring vm " + vm + " because of a lag in stopping the vm. "); - } - } else if (oldState != newState) { - _vms.put(vm, newState); - if (newState == State.Stopped) { - /* - * if (_vmsKilled.remove(vm)) { s_logger.debug("VM " + vm + " has been killed for storage. "); - * newState = State.Error; } - */ - } - changes.put(vm, newState); - } - } - - for (final Map.Entry entry : oldStates.entrySet()) { - final String vm = entry.getKey(); - final State oldState = entry.getValue(); - - if (isVmInCluster(vm)) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("VM " + vm + " is now missing from host report but we detected that it might be migrated to other host by vCenter"); - } - - if(oldState != State.Starting && oldState != State.Migrating) { - s_logger.debug("VM " + vm + " is now missing from host report and VM is not at starting/migrating state, remove it from host VM-sync map, oldState: " + oldState); - _vms.remove(vm); - } else { - s_logger.debug("VM " + vm + " is missing from host report, but we will ignore VM " + vm + " in transition state " + oldState); - } - continue; - } - - if (s_logger.isDebugEnabled()) { - s_logger.debug("VM " + vm + " is now missing from host report"); - } - - if (oldState == State.Stopping) { - s_logger.debug("Ignoring VM " + vm + " in transition state stopping."); - _vms.remove(vm); - } else if (oldState == State.Starting) { - s_logger.debug("Ignoring VM " + vm + " in transition state starting."); - } else if (oldState == State.Stopped) { - _vms.remove(vm); - } else if (oldState == State.Migrating) { - s_logger.debug("Ignoring VM " + vm + " in migrating state."); - } else { - State state = State.Stopped; - changes.put(entry.getKey(), state); - } - } - } - } catch (Throwable e) { - if (e instanceof RemoteException) { - s_logger.warn("Encounter remote exception to vCenter, invalidate VMware session context"); - invalidateServiceContext(); - } - - s_logger.error("Unable to perform sync information collection process at this point due to " + VmwareHelper.getExceptionMessage(e), e); - return null; - } - return changes; + + protected HashMap sync() { + try { + return getVmStates(); + } catch(Exception e) { + return new HashMap(); + } } private boolean isVmInCluster(String vmName) throws Exception { @@ -6234,7 +6136,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa return VirtualMachineGuestOsIdentifier.OTHER_GUEST; } - private HashMap getVmStates() throws Exception { + private HashMap getVmStates() throws Exception { VmwareHypervisorHost hyperHost = getHyperHost(getServiceContext()); int key = ((HostMO)hyperHost).getCustomFieldKey("VirtualMachine", CustomFieldConstants.CLOUD_VM_INTERNAL_NAME); @@ -6247,7 +6149,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa // the internal CS name, but the custom field CLOUD_VM_INTERNAL_NAME always stores the internal CS name. ObjectContent[] ocs = hyperHost.getVmPropertiesOnHyperHost(new String[] { "name", "runtime.powerState", "config.template", instanceNameCustomField }); - HashMap newStates = new HashMap(); + HashMap newStates = new HashMap(); if (ocs != null && ocs.length > 0) { for (ObjectContent oc : ocs) { List objProps = oc.getPropSet(); @@ -6511,11 +6413,11 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa return connect(vmname, ipAddress, 3922); } - private static State convertState(VirtualMachinePowerState powerState) { + private static PowerState convertState(VirtualMachinePowerState powerState) { return s_statesTable.get(powerState); } - public static State getVmState(VirtualMachineMO vmMo) throws Exception { + public static PowerState getVmState(VirtualMachineMO vmMo) throws Exception { VirtualMachineRuntimeInfo runtimeInfo = vmMo.getRuntimeInfo(); return convertState(runtimeInfo.getPowerState()); } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/534345e8/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java index 34bfe18..f1483a0 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java +++ b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java @@ -75,6 +75,7 @@ import com.cloud.storage.template.VmdkProcessor; import com.cloud.utils.Pair; import com.cloud.utils.Ternary; import com.cloud.utils.script.Script; +import com.cloud.vm.VirtualMachine.PowerState; import com.cloud.vm.VirtualMachine.State; import com.google.gson.Gson; import com.vmware.vim25.ManagedObjectReference; @@ -1491,7 +1492,7 @@ public class VmwareStorageProcessor implements StorageProcessor { List networks = vmMo.getNetworksWithDetails(); // tear down all devices first before we destroy the VM to avoid accidently delete disk backing files - if (this.resource.getVmState(vmMo) != State.Stopped) { + if (this.resource.getVmState(vmMo) != PowerState.PowerOff) { vmMo.safePowerOff(_shutdown_waitMs); } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/534345e8/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 92fbab2..80b4b7d 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 @@ -214,6 +214,7 @@ import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.net.NetUtils; import com.cloud.vm.DiskProfile; import com.cloud.vm.VirtualMachine; +import com.cloud.vm.VirtualMachine.PowerState; import com.cloud.vm.VirtualMachine.State; import com.cloud.vm.snapshot.VMSnapshot; import com.google.gson.Gson; @@ -372,14 +373,14 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } } - protected static HashMap s_statesTable; + protected static HashMap s_statesTable; static { - s_statesTable = new HashMap(); - s_statesTable.put(Types.VmPowerState.HALTED, State.Stopped); - s_statesTable.put(Types.VmPowerState.PAUSED, State.Running); - s_statesTable.put(Types.VmPowerState.RUNNING, State.Running); - s_statesTable.put(Types.VmPowerState.SUSPENDED, State.Running); - s_statesTable.put(Types.VmPowerState.UNRECOGNIZED, State.Unknown); + s_statesTable = new HashMap(); + s_statesTable.put(Types.VmPowerState.HALTED, PowerState.PowerOff); + s_statesTable.put(Types.VmPowerState.PAUSED, PowerState.PowerOn); + s_statesTable.put(Types.VmPowerState.RUNNING, PowerState.PowerOn); + s_statesTable.put(Types.VmPowerState.SUSPENDED, PowerState.PowerOn); + s_statesTable.put(Types.VmPowerState.UNRECOGNIZED, PowerState.PowerUnknown); } public XsHost getHost() { @@ -2861,13 +2862,13 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe .valueOf(_pollingIntervalInSeconds), "startTime", startTime); } - protected State convertToState(Types.VmPowerState ps) { - final State state = s_statesTable.get(ps); - return state == null ? State.Unknown : state; + protected PowerState convertToState(Types.VmPowerState ps) { + final PowerState state = s_statesTable.get(ps); + return state == null ? PowerState.PowerUnknown : state; } - protected HashMap> getAllVms(Connection conn) { - final HashMap> vmStates = new HashMap>(); + protected HashMap> getAllVms(Connection conn) { + final HashMap> vmStates = new HashMap>(); Map vm_map = null; for (int i = 0; i < 2; i++) { try { @@ -2892,7 +2893,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } VmPowerState ps = record.powerState; - final State state = convertToState(ps); + final PowerState state = convertToState(ps); if (s_logger.isTraceEnabled()) { s_logger.trace("VM " + record.nameLabel + ": powerstate = " + ps + "; vm state=" + state.toString()); } @@ -2908,14 +2909,14 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } catch (XmlRpcException e) { s_logger.error("Failed to get host uuid for host " + host.toWireString(), e); } - vmStates.put(record.nameLabel, new Pair(host_uuid, state)); + vmStates.put(record.nameLabel, new Pair(host_uuid, state)); } } return vmStates; } - protected State getVmState(Connection conn, final String vmName) { + protected PowerState getVmState(Connection conn, final String vmName) { int retry = 3; while (retry-- > 0) { try { @@ -2952,15 +2953,15 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } } - return State.Stopped; + return PowerState.PowerOff; } protected CheckVirtualMachineAnswer execute(final CheckVirtualMachineCommand cmd) { Connection conn = getConnection(); final String vmName = cmd.getVmName(); - final State state = getVmState(conn, vmName); + final PowerState state = getVmState(conn, vmName); Integer vncPort = null; - if (state == State.Running) { + if (state == PowerState.PowerOn) { synchronized (_cluster.intern()) { s_vms.put(_cluster, _name, vmName, State.Running); } @@ -3280,7 +3281,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } - protected State getRealPowerState(Connection conn, String label) { + protected PowerState getRealPowerState(Connection conn, String label) { int i = 0; s_logger.trace("Checking on the HALTED State"); for (; i < 20; i++) { @@ -3309,7 +3310,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } catch (InterruptedException e) { } } - return State.Stopped; + return PowerState.PowerOff; } protected Pair getControlDomain(Connection conn) throws XenAPIException, XmlRpcException { @@ -4877,7 +4878,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe Host.Record hostr = poolr.master.getRecord(conn); if (_host.uuid.equals(hostr.uuid)) { - HashMap> allStates=fullClusterSync(conn); + HashMap> allStates=fullClusterSync(conn); cmd.setClusterVMStateChanges(allStates); } } catch (Throwable e) { @@ -8004,12 +8005,14 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe s_logger.warn("Check for master failed, failing the Cluster sync command"); return new Answer(cmd); } - HashMap> newStates = deltaClusterSync(conn); + + HashMap> newStates = new HashMap>(); + // HashMap> newStates = deltaClusterSync(conn); return new ClusterSyncAnswer(cmd.getClusterId(), newStates); } - protected HashMap> fullClusterSync(Connection conn) { + protected HashMap> fullClusterSync(Connection conn) { synchronized (_cluster.intern()) { s_vms.clear(_cluster); } @@ -8021,13 +8024,13 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } String vm_name = record.nameLabel; VmPowerState ps = record.powerState; - final State state = convertToState(ps); + final PowerState state = convertToState(ps); Host host = record.residentOn; String host_uuid = null; if( ! isRefNull(host) ) { host_uuid = host.getUuid(conn); synchronized (_cluster.intern()) { - s_vms.put(_cluster, host_uuid, vm_name, state); + s_vms.put(_cluster, host_uuid, vm_name, state == PowerState.PowerOn ? State.Running : State.Stopped); } } if (s_logger.isTraceEnabled()) { @@ -8039,117 +8042,19 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe s_logger.warn(msg, e); throw new CloudRuntimeException(msg); } - return s_vms.getClusterVmState(_cluster); - } - - - protected HashMap> deltaClusterSync(Connection conn) { - final HashMap> changes = new HashMap>(); - - - synchronized (_cluster.intern()) { - HashMap> newStates = getAllVms(conn); - if (newStates == null) { - s_logger.warn("Unable to get the vm states so no state sync at this point."); - return null; - } - HashMap> oldStates = new HashMap>(s_vms.size(_cluster)); - oldStates.putAll(s_vms.getClusterVmState(_cluster)); - - for (final Map.Entry> entry : newStates.entrySet()) { - final String vm = entry.getKey(); - - State newState = entry.getValue().second(); - String host_uuid = entry.getValue().first(); - final Pair oldState = oldStates.remove(vm); - - //check if host is changed - if (host_uuid != null && oldState != null){ - if (!host_uuid.equals(oldState.first()) && newState != State.Stopped && newState != State.Stopping){ - s_logger.warn("Detecting a change in host for " + vm); - changes.put(vm, new Pair(host_uuid, newState)); - - s_logger.debug("11. The VM " + vm + " is in " + newState + " state"); - s_vms.put(_cluster, host_uuid, vm, newState); - continue; - } - } - - if (newState == State.Stopped && oldState != null && oldState.second() != State.Stopping && oldState.second() != State.Stopped) { - newState = getRealPowerState(conn, vm); - } - - if (s_logger.isTraceEnabled()) { - s_logger.trace("VM " + vm + ": xen has state " + newState + " and we have state " + (oldState != null ? oldState.toString() : "null")); - } - - if (vm.startsWith("migrating")) { - s_logger.warn("Migrating from xen detected. Skipping"); - continue; - } - if (oldState == null) { - s_vms.put(_cluster, host_uuid, vm, newState); - s_logger.warn("Detecting a new state but couldn't find a old state so adding it to the changes: " + vm); - changes.put(vm, new Pair(host_uuid, newState)); - } else if (oldState.second() == State.Starting) { - if (newState == State.Running) { - s_logger.debug("12. The VM " + vm + " is in " + State.Running + " state"); - s_vms.put(_cluster, host_uuid, vm, newState); - } else if (newState == State.Stopped) { - s_logger.warn("Ignoring vm " + vm + " because of a lag in starting the vm."); - } - } else if (oldState.second() == State.Migrating) { - if (newState == State.Running) { - s_logger.debug("Detected that an migrating VM is now running: " + vm); - s_vms.put(_cluster, host_uuid, vm, newState); - } - } else if (oldState.second() == State.Stopping) { - if (newState == State.Stopped) { - s_logger.debug("13. The VM " + vm + " is in " + State.Stopped + " state"); - s_vms.put(_cluster, host_uuid, vm, newState); - } else if (newState == State.Running) { - s_logger.warn("Ignoring vm " + vm + " because of a lag in stopping the vm. "); - } - } else if (oldState.second() != newState) { - s_logger.debug("14. The VM " + vm + " is in " + newState + " state was " + oldState.second()); - s_vms.put(_cluster, host_uuid, vm, newState); - if (newState == State.Stopped) { - /* - * if (s_vmsKilled.remove(vm)) { s_logger.debug("VM " + vm + " has been killed for storage. "); - * newState = State.Error; } - */ - } - changes.put(vm, new Pair(host_uuid, newState)); - } - } - - for (final Map.Entry> entry : oldStates.entrySet()) { - final String vm = entry.getKey(); - final State oldState = entry.getValue().second(); - String host_uuid = entry.getValue().first(); - - if (s_logger.isTraceEnabled()) { - s_logger.trace("VM " + vm + " is now missing from xen so reporting stopped"); - } - - if (oldState == State.Stopping) { - s_logger.warn("Ignoring VM " + vm + " in transition state stopping."); - s_vms.remove(_cluster, host_uuid, vm); - } else if (oldState == State.Starting) { - s_logger.warn("Ignoring VM " + vm + " in transition state starting."); - } else if (oldState == State.Stopped) { - s_logger.debug("VM missing " + vm + " old state stopped so removing."); - s_vms.remove(_cluster, host_uuid, vm); - } else if (oldState == State.Migrating) { - s_logger.warn("Ignoring VM " + vm + " in migrating state."); - } else { - State newState = State.Stopped; - s_logger.warn("The VM is now missing marking it as Stopped " + vm); - changes.put(vm, new Pair(host_uuid, newState)); - } - } - } - return changes; + + HashMap> states = new HashMap> (); + + HashMap> rawStates = s_vms.getClusterVmState(_cluster); + if(rawStates != null) { + for(Map.Entry> entry : rawStates.entrySet()) { + states.put(entry.getKey(), new Pair( + entry.getValue().first(), + entry.getValue().second() == State.Running ? PowerState.PowerOn : PowerState.PowerOff)); + } + } + + return states; } /** http://git-wip-us.apache.org/repos/asf/cloudstack/blob/534345e8/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerPoolVms.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerPoolVms.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerPoolVms.java index 33f2bf9..095844d 100644 --- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerPoolVms.java +++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerPoolVms.java @@ -23,7 +23,6 @@ import java.util.concurrent.ConcurrentHashMap; import com.cloud.utils.Pair; import com.cloud.vm.VirtualMachine.State; - public class XenServerPoolVms { private static final Logger s_logger = Logger.getLogger(XenServerPoolVms.class); private final Map>> _cluster_vms = @@ -83,4 +82,3 @@ public class XenServerPoolVms { } } - http://git-wip-us.apache.org/repos/asf/cloudstack/blob/534345e8/server/src/com/cloud/ha/CheckOnAgentInvestigator.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/ha/CheckOnAgentInvestigator.java b/server/src/com/cloud/ha/CheckOnAgentInvestigator.java index 0df324c..afb2882 100644 --- a/server/src/com/cloud/ha/CheckOnAgentInvestigator.java +++ b/server/src/com/cloud/ha/CheckOnAgentInvestigator.java @@ -30,6 +30,7 @@ import com.cloud.host.Host; import com.cloud.host.Status; import com.cloud.utils.component.AdapterBase; import com.cloud.vm.VirtualMachine; +import com.cloud.vm.VirtualMachine.PowerState; import com.cloud.vm.VirtualMachine.State; @Local(value=Investigator.class) @@ -57,7 +58,7 @@ public class CheckOnAgentInvestigator extends AdapterBase implements Investigato } s_logger.debug("Agent responded with state " + answer.getState().toString()); - return answer.getState() == State.Running; + return answer.getState() == PowerState.PowerOn; } catch (AgentUnavailableException e) { s_logger.debug("Unable to reach the agent for " + vm.toString() + ": " + e.getMessage()); return null; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/534345e8/server/src/com/cloud/hypervisor/kvm/discoverer/KvmDummyResourceBase.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/hypervisor/kvm/discoverer/KvmDummyResourceBase.java b/server/src/com/cloud/hypervisor/kvm/discoverer/KvmDummyResourceBase.java index 240ea6c..e930f6b 100644 --- a/server/src/com/cloud/hypervisor/kvm/discoverer/KvmDummyResourceBase.java +++ b/server/src/com/cloud/hypervisor/kvm/discoverer/KvmDummyResourceBase.java @@ -23,10 +23,10 @@ import javax.naming.ConfigurationException; import com.cloud.agent.api.Answer; import com.cloud.agent.api.Command; +import com.cloud.agent.api.HostVmStateReportEntry; import com.cloud.agent.api.PingCommand; import com.cloud.agent.api.StartupCommand; import com.cloud.agent.api.StartupRoutingCommand; -import com.cloud.agent.api.StartupRoutingCommand.VmState; import com.cloud.host.Host.Type; import com.cloud.hypervisor.Hypervisor; import com.cloud.resource.ServerResource; @@ -46,7 +46,7 @@ public class KvmDummyResourceBase extends ServerResourceBase implements ServerRe @Override public StartupCommand[] initialize() { - StartupRoutingCommand cmd = new StartupRoutingCommand(0, 0, 0, 0, null, Hypervisor.HypervisorType.KVM, new HashMap(), new HashMap()); + StartupRoutingCommand cmd = new StartupRoutingCommand(0, 0, 0, 0, null, Hypervisor.HypervisorType.KVM, new HashMap(), new HashMap()); cmd.setDataCenter(_zoneId); cmd.setPod(_podId); cmd.setCluster(_clusterId); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/534345e8/server/src/com/cloud/resource/DummyHostServerResource.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/resource/DummyHostServerResource.java b/server/src/com/cloud/resource/DummyHostServerResource.java index 977dbbf..49b2ccf 100644 --- a/server/src/com/cloud/resource/DummyHostServerResource.java +++ b/server/src/com/cloud/resource/DummyHostServerResource.java @@ -31,6 +31,7 @@ import com.cloud.host.Host.Type; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.utils.net.MacAddress; import com.cloud.vm.VirtualMachine; +import com.cloud.vm.VirtualMachine.PowerState; public class DummyHostServerResource extends ServerResourceBase { @@ -56,7 +57,7 @@ public class DummyHostServerResource extends ServerResourceBase { @Override public PingCommand getCurrentStatus(long id) { - HashMap newStates = new HashMap(); + HashMap newStates = new HashMap(); return new PingRoutingCommand(com.cloud.host.Host.Type.Routing, id, newStates); }