use of com.cloud.resource.ResourceState in project cosmic by MissionCriticalCloud.
the class CheckOnHostCommandTest method testGetResourceState.
@Test
public void testGetResourceState() {
final ResourceState r = host.getResourceState();
assertTrue(r == ResourceState.Enabled);
}
use of com.cloud.resource.ResourceState in project cosmic by MissionCriticalCloud.
the class AgentManagerImpl method agentStatusTransitTo.
@Override
public boolean agentStatusTransitTo(final HostVO host, final Status.Event e, final long msId) {
try {
_agentStatusLock.lock();
if (status_logger.isDebugEnabled()) {
final ResourceState state = host.getResourceState();
final StringBuilder msg = new StringBuilder("Transition:");
msg.append("[Resource state = ").append(state);
msg.append(", Agent event = ").append(e.toString());
msg.append(", Host id = ").append(host.getId()).append(", name = " + host.getName()).append("]");
status_logger.debug(msg.toString());
}
host.setManagementServerId(msId);
try {
return _statusStateMachine.transitTo(host, e, host.getId(), _hostDao);
} catch (final NoTransitionException e1) {
status_logger.debug("Cannot transit agent status with event " + e + " for host " + host.getId() + ", name=" + host.getName() + ", mangement server id is " + msId);
throw new CloudRuntimeException("Cannot transit agent status with event " + e + " for host " + host.getId() + ", mangement server id is " + msId + "," + e1.getMessage());
}
} finally {
_agentStatusLock.unlock();
}
}
use of com.cloud.resource.ResourceState in project cloudstack by apache.
the class AgentManagerImpl method agentStatusTransitTo.
@Override
public boolean agentStatusTransitTo(final HostVO host, final Status.Event e, final long msId) {
try {
_agentStatusLock.lock();
if (s_logger.isDebugEnabled()) {
final ResourceState state = host.getResourceState();
final StringBuilder msg = new StringBuilder("Transition:");
msg.append("[Resource state = ").append(state);
msg.append(", Agent event = ").append(e.toString());
msg.append(", Host id = ").append(host.getId()).append(", name = " + host.getName()).append("]");
s_logger.debug(msg);
}
host.setManagementServerId(msId);
try {
return _statusStateMachine.transitTo(host, e, host.getId(), _hostDao);
} catch (final NoTransitionException e1) {
s_logger.debug("Cannot transit agent status with event " + e + " for host " + host.getId() + ", name=" + host.getName() + ", mangement server id is " + msId);
throw new CloudRuntimeException("Cannot transit agent status with event " + e + " for host " + host.getId() + ", mangement server id is " + msId + "," + e1.getMessage());
}
} finally {
_agentStatusLock.unlock();
}
}
use of com.cloud.resource.ResourceState in project cloudstack by apache.
the class CheckOnHostCommandTest method testGetResourceState.
@Test
public void testGetResourceState() {
ResourceState r = host.getResourceState();
assertTrue(r == ResourceState.Enabled);
}
Aggregations