mirror of https://github.com/apache/cloudstack.git
Bug 11522 - New agent manager
move maintanenceFailed to ResourceManager
This commit is contained in:
parent
bb4237336f
commit
e8c3ff653d
|
|
@ -185,8 +185,6 @@ public interface AgentManager extends Manager {
|
|||
*/
|
||||
Pair<HostPodVO, Long> findPod(VirtualMachineTemplate template, ServiceOfferingVO offering, DataCenterVO dc, long userId, Set<Long> avoids);
|
||||
|
||||
boolean maintenanceFailed(long hostId);
|
||||
|
||||
public boolean executeUserRequest(long hostId, Event event) throws AgentUnavailableException;
|
||||
|
||||
boolean isHostNativeHAEnabled(long hostId);
|
||||
|
|
|
|||
|
|
@ -1515,20 +1515,6 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, Manager {
|
|||
return attache;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean maintenanceFailed(long hostId) {
|
||||
HostVO host = _hostDao.findById(hostId);
|
||||
if (host == null) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Cant not find host " + hostId);
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return _hostDao.updateStatus(host, Event.UnableToMigrate, _nodeId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void updateHost(final HostVO host, final StartupCommand startup, final Host.Type type, final long msId) throws IllegalArgumentException {
|
||||
s_logger.debug("updateHost() called");
|
||||
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ import com.cloud.host.HostVO;
|
|||
import com.cloud.host.Status;
|
||||
import com.cloud.host.dao.HostDao;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.resource.ResourceManager;
|
||||
import com.cloud.server.ManagementServer;
|
||||
import com.cloud.storage.StorageManager;
|
||||
import com.cloud.storage.dao.GuestOSCategoryDao;
|
||||
|
|
@ -135,6 +136,8 @@ public class HighAvailabilityManagerImpl implements HighAvailabilityManager, Clu
|
|||
VirtualMachineManager _itMgr;
|
||||
@Inject
|
||||
AccountManager _accountMgr;
|
||||
@Inject
|
||||
ResourceManager _resourceMgr;
|
||||
|
||||
String _instance;
|
||||
ScheduledExecutorService _executor;
|
||||
|
|
@ -548,16 +551,16 @@ public class HighAvailabilityManagerImpl implements HighAvailabilityManager, Clu
|
|||
|
||||
if (!_itMgr.migrateAway(work.getType(), vmId, srcHostId)) {
|
||||
s_logger.warn("Unable to migrate vm from " + srcHostId);
|
||||
_agentMgr.maintenanceFailed(srcHostId);
|
||||
_resourceMgr.maintenanceFailed(srcHostId);
|
||||
}
|
||||
return null;
|
||||
} catch (InsufficientServerCapacityException e) {
|
||||
s_logger.warn("Insufficient capacity for migrating a VM.");
|
||||
_agentMgr.maintenanceFailed(srcHostId);
|
||||
_resourceMgr.maintenanceFailed(srcHostId);
|
||||
return (System.currentTimeMillis() >> 10) + _migrateRetryInterval;
|
||||
} catch (VirtualMachineMigrationException e) {
|
||||
s_logger.warn("Looks like VM is still starting, we need to retry migrating the VM later.");
|
||||
_agentMgr.maintenanceFailed(srcHostId);
|
||||
_resourceMgr.maintenanceFailed(srcHostId);
|
||||
return (System.currentTimeMillis() >> 10) + _migrateRetryInterval;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,4 +77,6 @@ public interface ResourceManager {
|
|||
boolean updateResourceState(Host host, Event event, long msId) throws NoTransitionException;
|
||||
|
||||
boolean umanageHost(long hostId);
|
||||
|
||||
boolean maintenanceFailed(long hostId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1734,5 +1734,23 @@ public class ResourceManagerImpl implements ResourceManager, ResourceService, Ma
|
|||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean maintenanceFailed(long hostId) {
|
||||
HostVO host = _hostDao.findById(hostId);
|
||||
if (host == null) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Cant not find host " + hostId);
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
try {
|
||||
return updateResourceState(host, ResourceState.Event.UnableToMigrate, _nodeId);
|
||||
} catch (NoTransitionException e) {
|
||||
s_logger.debug("No next resource state for host " + host.getId() + " while current state is " + host.getResourceState() + " with event " + ResourceState.Event.UnableToMigrate, e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,12 +153,6 @@ public class MockAgentManagerImpl implements AgentManager {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean maintenanceFailed(long hostId) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean executeUserRequest(long hostId, Event event) throws AgentUnavailableException {
|
||||
// TODO Auto-generated method stub
|
||||
|
|
@ -166,7 +160,7 @@ public class MockAgentManagerImpl implements AgentManager {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean reconnect(long hostId) throws AgentUnavailableException {
|
||||
public boolean reconnect(long hostId) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue