mirror of https://github.com/apache/cloudstack.git
clean out various interface from agent manager to decent managers
This commit is contained in:
parent
05560d2222
commit
9e88c40ab0
|
|
@ -17,34 +17,19 @@
|
|||
*/
|
||||
package com.cloud.agent;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.cloud.agent.api.Answer;
|
||||
import com.cloud.agent.api.Command;
|
||||
import com.cloud.agent.api.StartupCommand;
|
||||
import com.cloud.agent.manager.AgentAttache;
|
||||
import com.cloud.agent.manager.Commands;
|
||||
import com.cloud.api.commands.UpdateHostPasswordCmd;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.HostPodVO;
|
||||
import com.cloud.dc.PodCluster;
|
||||
import com.cloud.exception.AgentUnavailableException;
|
||||
import com.cloud.exception.ConnectionException;
|
||||
import com.cloud.exception.OperationTimedoutException;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.host.Host.Type;
|
||||
import com.cloud.host.HostStats;
|
||||
import com.cloud.host.HostVO;
|
||||
import com.cloud.host.Status;
|
||||
import com.cloud.host.Status.Event;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.resource.ServerResource;
|
||||
import com.cloud.service.ServiceOfferingVO;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
import com.cloud.user.User;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.component.Manager;
|
||||
|
||||
/**
|
||||
|
|
@ -101,19 +86,6 @@ public interface AgentManager extends Manager {
|
|||
|
||||
Answer[] send(Long hostId, Commands cmds, int timeout) throws AgentUnavailableException, OperationTimedoutException;
|
||||
|
||||
/**
|
||||
* Asynchronous sending of a command to the agent.
|
||||
*
|
||||
* @param hostId
|
||||
* id of the agent on the host.
|
||||
* @param cmd
|
||||
* Command to send.
|
||||
* @param listener
|
||||
* the listener to process the answer.
|
||||
* @return sequence number.
|
||||
*/
|
||||
long gatherStats(Long hostId, Command cmd, Listener listener);
|
||||
|
||||
/**
|
||||
* Asynchronous sending of a command to the agent.
|
||||
*
|
||||
|
|
@ -160,44 +132,13 @@ public interface AgentManager extends Manager {
|
|||
*/
|
||||
void unregisterForHostEvents(int id);
|
||||
|
||||
/**
|
||||
* @return hosts currently connected.
|
||||
*/
|
||||
Set<Long> getConnectedHosts();
|
||||
|
||||
HostStats getHostStatistics(long hostId);
|
||||
|
||||
Long getGuestOSCategoryId(long hostId);
|
||||
|
||||
String getHostTags(long hostId);
|
||||
|
||||
List<PodCluster> listByDataCenter(long dcId);
|
||||
|
||||
List<PodCluster> listByPod(long podId);
|
||||
|
||||
/**
|
||||
* Find a pod based on the user id, template, and data center.
|
||||
*
|
||||
* @param template
|
||||
* @param dc
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
Pair<HostPodVO, Long> findPod(VirtualMachineTemplate template, ServiceOfferingVO offering, DataCenterVO dc, long userId, Set<Long> avoids);
|
||||
|
||||
public boolean executeUserRequest(long hostId, Event event) throws AgentUnavailableException;
|
||||
|
||||
boolean isHostNativeHAEnabled(long hostId);
|
||||
|
||||
Answer sendTo(Long dcId, HypervisorType type, Command cmd);
|
||||
|
||||
void notifyAnswersToMonitors(long agentId, long seq, Answer[] answers);
|
||||
|
||||
long sendToSecStorage(HostVO ssHost, Command cmd, Listener listener);
|
||||
void sendToSecStorage(HostVO ssHost, Command cmd, Listener listener) throws AgentUnavailableException;
|
||||
|
||||
Answer sendToSecStorage(HostVO ssHost, Command cmd);
|
||||
|
||||
HostVO getSSAgent(HostVO ssHost);
|
||||
|
||||
/* working as a lock while agent is being loaded */
|
||||
public boolean tapLoadingAgents(Long hostId, TapAgentsAction action);
|
||||
|
|
@ -210,10 +151,6 @@ public interface AgentManager extends Manager {
|
|||
|
||||
void disconnectWithoutInvestigation(long hostId, Status.Event event);
|
||||
|
||||
void disconnectWithInvestigation(long hostId, Status.Event event);
|
||||
|
||||
public boolean disconnectAgent(HostVO host, Status.Event e, long msId);
|
||||
|
||||
public void pullAgentToMaintenance(long hostId);
|
||||
|
||||
public void pullAgentOutMaintenance(long hostId);
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ public abstract class AgentAttache {
|
|||
protected boolean _maintenance;
|
||||
protected long _nextSequence;
|
||||
|
||||
protected AgentManager _agentMgr;
|
||||
protected AgentManagerImpl _agentMgr;
|
||||
|
||||
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(), ShutdownCommand.class.toString() };
|
||||
|
|
@ -116,7 +116,7 @@ public abstract class AgentAttache {
|
|||
}
|
||||
|
||||
|
||||
protected AgentAttache(AgentManager agentMgr, final long id, boolean maintenance) {
|
||||
protected AgentAttache(AgentManagerImpl agentMgr, final long id, boolean maintenance) {
|
||||
_id = id;
|
||||
_waitForList = new ConcurrentHashMap<Long, Listener>();
|
||||
_currentSequence = null;
|
||||
|
|
|
|||
|
|
@ -22,13 +22,10 @@ import java.lang.reflect.InvocationTargetException;
|
|||
import java.nio.channels.ClosedChannelException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
|
|
@ -48,38 +45,22 @@ import com.cloud.agent.api.AgentControlCommand;
|
|||
import com.cloud.agent.api.Answer;
|
||||
import com.cloud.agent.api.CheckHealthCommand;
|
||||
import com.cloud.agent.api.Command;
|
||||
import com.cloud.agent.api.GetHostStatsAnswer;
|
||||
import com.cloud.agent.api.GetHostStatsCommand;
|
||||
import com.cloud.agent.api.MaintainAnswer;
|
||||
import com.cloud.agent.api.MaintainCommand;
|
||||
import com.cloud.agent.api.PingAnswer;
|
||||
import com.cloud.agent.api.PingCommand;
|
||||
import com.cloud.agent.api.PingRoutingCommand;
|
||||
import com.cloud.agent.api.PoolEjectCommand;
|
||||
import com.cloud.agent.api.ReadyAnswer;
|
||||
import com.cloud.agent.api.ReadyCommand;
|
||||
import com.cloud.agent.api.ShutdownCommand;
|
||||
import com.cloud.agent.api.StartupAnswer;
|
||||
import com.cloud.agent.api.StartupCommand;
|
||||
import com.cloud.agent.api.StartupExternalDhcpCommand;
|
||||
import com.cloud.agent.api.StartupExternalFirewallCommand;
|
||||
import com.cloud.agent.api.StartupExternalLoadBalancerCommand;
|
||||
import com.cloud.agent.api.StartupProxyCommand;
|
||||
import com.cloud.agent.api.StartupPxeServerCommand;
|
||||
import com.cloud.agent.api.StartupRoutingCommand;
|
||||
import com.cloud.agent.api.StartupSecondaryStorageCommand;
|
||||
import com.cloud.agent.api.StartupStorageCommand;
|
||||
import com.cloud.agent.api.StartupTrafficMonitorCommand;
|
||||
import com.cloud.agent.api.UnsupportedAnswer;
|
||||
import com.cloud.agent.api.UpdateHostPasswordCommand;
|
||||
import com.cloud.agent.manager.allocator.PodAllocator;
|
||||
import com.cloud.agent.transport.Request;
|
||||
import com.cloud.agent.transport.Response;
|
||||
import com.cloud.alert.AlertManager;
|
||||
import com.cloud.api.ApiConstants;
|
||||
import com.cloud.api.commands.UpdateHostPasswordCmd;
|
||||
import com.cloud.capacity.Capacity;
|
||||
import com.cloud.capacity.CapacityVO;
|
||||
import com.cloud.capacity.dao.CapacityDao;
|
||||
import com.cloud.cluster.ManagementServerNode;
|
||||
import com.cloud.cluster.StackMaid;
|
||||
|
|
@ -88,7 +69,6 @@ import com.cloud.configuration.dao.ConfigurationDao;
|
|||
import com.cloud.dc.ClusterDetailsDao;
|
||||
import com.cloud.dc.ClusterDetailsVO;
|
||||
import com.cloud.dc.ClusterVO;
|
||||
import com.cloud.dc.DataCenterIpAddressVO;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.HostPodVO;
|
||||
import com.cloud.dc.PodCluster;
|
||||
|
|
@ -98,15 +78,11 @@ import com.cloud.dc.dao.DataCenterIpAddressDao;
|
|||
import com.cloud.dc.dao.HostPodDao;
|
||||
import com.cloud.exception.AgentUnavailableException;
|
||||
import com.cloud.exception.ConnectionException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.OperationTimedoutException;
|
||||
import com.cloud.exception.UnsupportedVersionException;
|
||||
import com.cloud.ha.HighAvailabilityManager;
|
||||
import com.cloud.ha.HighAvailabilityManager.WorkType;
|
||||
import com.cloud.host.DetailVO;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.host.Host.Type;
|
||||
import com.cloud.host.HostStats;
|
||||
import com.cloud.host.HostVO;
|
||||
import com.cloud.host.Status;
|
||||
import com.cloud.host.Status.Event;
|
||||
|
|
@ -116,52 +92,36 @@ import com.cloud.host.dao.HostTagsDao;
|
|||
import com.cloud.hypervisor.HypervisorGuruManager;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.hypervisor.kvm.resource.KvmDummyResourceBase;
|
||||
import com.cloud.network.IPAddressVO;
|
||||
import com.cloud.network.dao.IPAddressDao;
|
||||
import com.cloud.resource.ResourceManager;
|
||||
import com.cloud.resource.ResourceState;
|
||||
import com.cloud.resource.ServerResource;
|
||||
import com.cloud.service.ServiceOfferingVO;
|
||||
import com.cloud.storage.Storage;
|
||||
import com.cloud.storage.StorageManager;
|
||||
import com.cloud.storage.StoragePool;
|
||||
import com.cloud.storage.StoragePoolHostVO;
|
||||
import com.cloud.storage.StoragePoolStatus;
|
||||
import com.cloud.storage.StoragePoolVO;
|
||||
import com.cloud.storage.StorageService;
|
||||
import com.cloud.storage.dao.StoragePoolDao;
|
||||
import com.cloud.storage.dao.StoragePoolHostDao;
|
||||
import com.cloud.storage.dao.VolumeDao;
|
||||
import com.cloud.storage.resource.DummySecondaryStorageResource;
|
||||
import com.cloud.storage.secondary.SecondaryStorageVmManager;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
import com.cloud.user.AccountManager;
|
||||
import com.cloud.user.User;
|
||||
import com.cloud.utils.ActionDelegate;
|
||||
import com.cloud.utils.NumbersUtil;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.StringUtils;
|
||||
import com.cloud.utils.component.Adapters;
|
||||
import com.cloud.utils.component.ComponentLocator;
|
||||
import com.cloud.utils.component.Inject;
|
||||
import com.cloud.utils.component.Manager;
|
||||
import com.cloud.utils.concurrency.NamedThreadFactory;
|
||||
import com.cloud.utils.db.DB;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
import com.cloud.utils.db.Transaction;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.exception.HypervisorVersionChangedException;
|
||||
import com.cloud.utils.fsm.NoTransitionException;
|
||||
import com.cloud.utils.fsm.StateMachine2;
|
||||
import com.cloud.utils.net.Ip;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
import com.cloud.utils.nio.HandlerFactory;
|
||||
import com.cloud.utils.nio.Link;
|
||||
import com.cloud.utils.nio.NioServer;
|
||||
import com.cloud.utils.nio.Task;
|
||||
import com.cloud.utils.time.InaccurateClock;
|
||||
import com.cloud.vm.VMInstanceVO;
|
||||
import com.cloud.vm.VirtualMachine.State;
|
||||
import com.cloud.vm.VirtualMachineManager;
|
||||
import com.cloud.vm.dao.VMInstanceDao;
|
||||
|
||||
|
|
@ -206,8 +166,6 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, Manager {
|
|||
protected IPAddressDao _publicIPAddressDao = null;
|
||||
@Inject
|
||||
protected HostPodDao _podDao = null;
|
||||
@Inject(adapter = PodAllocator.class)
|
||||
protected Adapters<PodAllocator> _podAllocators = null;
|
||||
@Inject
|
||||
protected VMInstanceDao _vmDao = null;
|
||||
@Inject
|
||||
|
|
@ -329,16 +287,6 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, Manager {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHostNativeHAEnabled(long hostId) {
|
||||
HostVO host = _hostDao.findById(hostId);
|
||||
if (host.getClusterId() != null) {
|
||||
ClusterDetailsVO detail = _clusterDetailsDao.findDetail(host.getClusterId(), "NativeHA");
|
||||
return detail == null ? false : Boolean.parseBoolean(detail.getValue());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Task create(Task.Type type, Link link, byte[] data) {
|
||||
return new AgentHandler(type, link, data);
|
||||
|
|
@ -416,7 +364,6 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, Manager {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyAnswersToMonitors(long agentId, long seq, Answer[] answers) {
|
||||
for (Pair<Integer, Listener> listener : _cmdMonitors) {
|
||||
listener.second().processAnswers(agentId, seq, answers);
|
||||
|
|
@ -432,55 +379,6 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, Manager {
|
|||
return attache;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Long> getConnectedHosts() {
|
||||
// make the returning set be safe for concurrent iteration
|
||||
final HashSet<Long> result = new HashSet<Long>();
|
||||
|
||||
synchronized (_agents) {
|
||||
final Set<Long> s = _agents.keySet();
|
||||
for (final Long id : s) {
|
||||
result.add(id);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PodCluster> listByDataCenter(long dcId) {
|
||||
List<HostPodVO> pods = _podDao.listByDataCenterId(dcId);
|
||||
ArrayList<PodCluster> pcs = new ArrayList<PodCluster>();
|
||||
for (HostPodVO pod : pods) {
|
||||
List<ClusterVO> clusters = _clusterDao.listByPodId(pod.getId());
|
||||
if (clusters.size() == 0) {
|
||||
pcs.add(new PodCluster(pod, null));
|
||||
} else {
|
||||
for (ClusterVO cluster : clusters) {
|
||||
pcs.add(new PodCluster(pod, cluster));
|
||||
}
|
||||
}
|
||||
}
|
||||
return pcs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PodCluster> listByPod(long podId) {
|
||||
ArrayList<PodCluster> pcs = new ArrayList<PodCluster>();
|
||||
HostPodVO pod = _podDao.findById(podId);
|
||||
if (pod == null) {
|
||||
return pcs;
|
||||
}
|
||||
List<ClusterVO> clusters = _clusterDao.listByPodId(pod.getId());
|
||||
if (clusters.size() == 0) {
|
||||
pcs.add(new PodCluster(pod, null));
|
||||
} else {
|
||||
for (ClusterVO cluster : clusters) {
|
||||
pcs.add(new PodCluster(pod, cluster));
|
||||
}
|
||||
}
|
||||
return pcs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Answer sendToSecStorage(HostVO ssHost, Command cmd) {
|
||||
if( ssHost.getType() == Host.Type.LocalSecondaryStorage ) {
|
||||
|
|
@ -494,50 +392,28 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, Manager {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public HostVO getSSAgent(HostVO ssHost) {
|
||||
public void sendToSecStorage(HostVO ssHost, Command cmd, Listener listener) throws AgentUnavailableException {
|
||||
if( ssHost.getType() == Host.Type.LocalSecondaryStorage ) {
|
||||
return ssHost;
|
||||
send(ssHost.getId(), new Commands(cmd), listener);
|
||||
} else if ( ssHost.getType() == Host.Type.SecondaryStorage) {
|
||||
Long dcId = ssHost.getDataCenterId();
|
||||
List<HostVO> ssAHosts = _ssvmMgr.listUpSecondaryStorageVmHost(dcId);
|
||||
if (ssAHosts == null || ssAHosts.isEmpty() ) {
|
||||
return null;
|
||||
}
|
||||
Collections.shuffle(ssAHosts);
|
||||
return ssAHosts.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public long sendToSecStorage(HostVO ssHost, Command cmd, Listener listener) {
|
||||
if( ssHost.getType() == Host.Type.LocalSecondaryStorage ) {
|
||||
return gatherStats(ssHost.getId(), cmd, listener);
|
||||
} else if ( ssHost.getType() == Host.Type.SecondaryStorage) {
|
||||
return sendToSSVM(ssHost.getDataCenterId(), cmd, listener);
|
||||
sendToSSVM(ssHost.getDataCenterId(), cmd, listener);
|
||||
} else {
|
||||
s_logger.warn("do not support Secondary Storage type " + ssHost.getType());
|
||||
String err = "do not support Secondary Storage type " + ssHost.getType();
|
||||
s_logger.warn(err);
|
||||
throw new CloudRuntimeException(err);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
private long sendToSSVM(final long dcId, final Command cmd, final Listener listener) {
|
||||
private void sendToSSVM(final long dcId, final Command cmd, final Listener listener) throws AgentUnavailableException {
|
||||
List<HostVO> ssAHosts = _ssvmMgr.listUpSecondaryStorageVmHost(dcId);
|
||||
if (ssAHosts == null || ssAHosts.isEmpty() ) {
|
||||
return -1;
|
||||
throw new AgentUnavailableException("No ssvm host found", -1);
|
||||
}
|
||||
Collections.shuffle(ssAHosts);
|
||||
HostVO ssAhost = ssAHosts.get(0);
|
||||
try {
|
||||
return send(ssAhost.getId(), new Commands(cmd), listener);
|
||||
} catch (final AgentUnavailableException e) {
|
||||
return -1;
|
||||
}
|
||||
send(ssAhost.getId(), new Commands(cmd), listener);
|
||||
}
|
||||
|
||||
private Answer sendToSSVM(final long dcId, final Command cmd) {
|
||||
|
|
@ -673,14 +549,14 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, Manager {
|
|||
public long send(Long hostId, Commands commands, Listener listener) throws AgentUnavailableException {
|
||||
final AgentAttache agent = getAttache(hostId);
|
||||
if (agent.isClosed()) {
|
||||
return -1;
|
||||
throw new AgentUnavailableException("Agent " + agent.getId() + " is closed", agent.getId());
|
||||
}
|
||||
|
||||
Command[] cmds = commands.toCommands();
|
||||
|
||||
assert cmds.length > 0 : "Why are you sending zero length commands?";
|
||||
if (cmds.length == 0) {
|
||||
return -1;
|
||||
throw new AgentUnavailableException("Empty command set for agent " + agent.getId(), agent.getId());
|
||||
}
|
||||
Request req = new Request(hostId, _nodeId, cmds, commands.stopOnError(), true);
|
||||
req.setSequence(agent.getNextSequence());
|
||||
|
|
@ -688,18 +564,6 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, Manager {
|
|||
return req.getSequence();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public long gatherStats(Long hostId, Command cmd, Listener listener) {
|
||||
try {
|
||||
return send(hostId, new Commands(cmd), listener);
|
||||
} catch (final AgentUnavailableException e) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public void removeAgent(AgentAttache attache, Status nextState) {
|
||||
if (attache == null) {
|
||||
return;
|
||||
|
|
@ -948,67 +812,6 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, Manager {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pair<HostPodVO, Long> findPod(final VirtualMachineTemplate template, ServiceOfferingVO offering, final DataCenterVO dc, final long accountId, Set<Long> avoids) {
|
||||
final Enumeration en = _podAllocators.enumeration();
|
||||
while (en.hasMoreElements()) {
|
||||
final PodAllocator allocator = (PodAllocator) en.nextElement();
|
||||
final Pair<HostPodVO, Long> pod = allocator.allocateTo(template, offering, dc, accountId, avoids);
|
||||
if (pod != null) {
|
||||
return pod;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HostStats getHostStatistics(long hostId) {
|
||||
Answer answer = easySend(hostId, new GetHostStatsCommand(_hostDao.findById(hostId).getGuid(), _hostDao.findById(hostId).getName(), hostId));
|
||||
|
||||
if (answer != null && (answer instanceof UnsupportedAnswer)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (answer == null || !answer.getResult()) {
|
||||
String msg = "Unable to obtain host " + hostId + " statistics. ";
|
||||
s_logger.warn(msg);
|
||||
return null;
|
||||
} else {
|
||||
|
||||
// now construct the result object
|
||||
if (answer instanceof GetHostStatsAnswer) {
|
||||
return ((GetHostStatsAnswer) answer).getHostStats();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getGuestOSCategoryId(long hostId) {
|
||||
HostVO host = _hostDao.findById(hostId);
|
||||
if (host == null) {
|
||||
return null;
|
||||
} else {
|
||||
_hostDao.loadDetails(host);
|
||||
DetailVO detail = _hostDetailsDao.findDetail(hostId, "guest.os.category.id");
|
||||
if (detail == null) {
|
||||
return null;
|
||||
} else {
|
||||
return Long.parseLong(detail.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHostTags(long hostId) {
|
||||
List<String> hostTags = _hostTagsDao.gethostTags(hostId);
|
||||
if (hostTags == null) {
|
||||
return null;
|
||||
} else {
|
||||
return StringUtils.listToCsvTags(hostTags);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return _name;
|
||||
|
|
@ -1608,8 +1411,6 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, Manager {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean disconnectAgent(HostVO host, Status.Event e, long msId) {
|
||||
host.setDisconnectedOn(new Date());
|
||||
if (e.equals(Status.Event.Remove)) {
|
||||
|
|
@ -1651,7 +1452,6 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, Manager {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disconnectWithInvestigation(final long hostId, final Status.Event event) {
|
||||
disconnectInternal(hostId, event, true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,13 +39,13 @@ public class ClusteredAgentAttache extends ConnectedAgentAttache implements Rout
|
|||
s_clusteredAgentMgr = agentMgr;
|
||||
}
|
||||
|
||||
public ClusteredAgentAttache(AgentManager agentMgr, long id) {
|
||||
public ClusteredAgentAttache(AgentManagerImpl agentMgr, long id) {
|
||||
super(agentMgr, id, null, false);
|
||||
_forward = true;
|
||||
_transferRequests = new LinkedList<Request>();
|
||||
}
|
||||
|
||||
public ClusteredAgentAttache(AgentManager agentMgr, long id, Link link, boolean maintenance) {
|
||||
public ClusteredAgentAttache(AgentManagerImpl agentMgr, long id, Link link, boolean maintenance) {
|
||||
super(agentMgr, id, link, maintenance);
|
||||
_forward = link == null;
|
||||
_transferRequests = new LinkedList<Request>();
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public class ClusteredDirectAgentAttache extends DirectAgentAttache implements R
|
|||
private final ClusteredAgentManagerImpl _mgr;
|
||||
private final long _nodeId;
|
||||
|
||||
public ClusteredDirectAgentAttache(AgentManager agentMgr, long id, long mgmtId, ServerResource resource, boolean maintenance, ClusteredAgentManagerImpl mgr) {
|
||||
public ClusteredDirectAgentAttache(AgentManagerImpl agentMgr, long id, long mgmtId, ServerResource resource, boolean maintenance, ClusteredAgentManagerImpl mgr) {
|
||||
super(agentMgr, id, resource, maintenance, mgr);
|
||||
_mgr = mgr;
|
||||
_nodeId = mgmtId;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public class ConnectedAgentAttache extends AgentAttache {
|
|||
|
||||
protected Link _link;
|
||||
|
||||
public ConnectedAgentAttache(AgentManager agentMgr, final long id, final Link link, boolean maintenance) {
|
||||
public ConnectedAgentAttache(AgentManagerImpl agentMgr, final long id, final Link link, boolean maintenance) {
|
||||
super(agentMgr, id, maintenance);
|
||||
_link = link;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ public class DirectAgentAttache extends AgentAttache {
|
|||
AgentManagerImpl _mgr;
|
||||
long _seq = 0;
|
||||
|
||||
public DirectAgentAttache(AgentManager agentMgr, long id, ServerResource resource, boolean maintenance, AgentManagerImpl mgr) {
|
||||
public DirectAgentAttache(AgentManagerImpl agentMgr, long id, ServerResource resource, boolean maintenance, AgentManagerImpl mgr) {
|
||||
super(agentMgr, id, maintenance);
|
||||
_resource = resource;
|
||||
_mgr = mgr;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import com.cloud.host.Status;
|
|||
|
||||
public class DummyAttache extends AgentAttache {
|
||||
|
||||
public DummyAttache(AgentManager agentMgr, long id, boolean maintenance) {
|
||||
public DummyAttache(AgentManagerImpl agentMgr, long id, boolean maintenance) {
|
||||
super(agentMgr, id, maintenance);
|
||||
}
|
||||
|
||||
|
|
|
|||
5
server/src/com/cloud/agent/manager/allocator/impl/RecreateHostAllocator.java
Normal file → Executable file
5
server/src/com/cloud/agent/manager/allocator/impl/RecreateHostAllocator.java
Normal file → Executable file
|
|
@ -46,6 +46,7 @@ import com.cloud.host.Host;
|
|||
import com.cloud.host.Host.Type;
|
||||
import com.cloud.host.dao.HostDao;
|
||||
import com.cloud.org.Grouping;
|
||||
import com.cloud.resource.ResourceManager;
|
||||
import com.cloud.storage.VolumeVO;
|
||||
import com.cloud.storage.dao.StoragePoolDao;
|
||||
import com.cloud.storage.dao.VolumeDao;
|
||||
|
|
@ -61,10 +62,10 @@ public class RecreateHostAllocator extends FirstFitRoutingAllocator {
|
|||
@Inject HostPodDao _podDao;
|
||||
@Inject StoragePoolDao _poolDao;
|
||||
@Inject ClusterDao _clusterDao;
|
||||
@Inject AgentManager _agentMgr;
|
||||
@Inject VolumeDao _volsDao;
|
||||
@Inject DataCenterDao _dcDao;
|
||||
@Inject HostDao _hostDao;
|
||||
@Inject ResourceManager _resourceMgr;
|
||||
|
||||
@Override
|
||||
public List<Host> allocateTo(VirtualMachineProfile<? extends VirtualMachine> vm,DeploymentPlan plan, Type type,
|
||||
|
|
@ -83,7 +84,7 @@ public class RecreateHostAllocator extends FirstFitRoutingAllocator {
|
|||
}
|
||||
|
||||
DataCenter dc = _dcDao.findById(plan.getDataCenterId());
|
||||
List<PodCluster> pcs = _agentMgr.listByDataCenter(dc.getId());
|
||||
List<PodCluster> pcs = _resourceMgr.listByDataCenter(dc.getId());
|
||||
//getting rid of direct.attached.untagged.vlan.enabled config param: Bug 7204
|
||||
//basic network type for zone maps to direct untagged case
|
||||
if (dc.getNetworkType().equals(NetworkType.Basic)) {
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ import com.cloud.offerings.NetworkOfferingVO;
|
|||
import com.cloud.offerings.dao.NetworkOfferingDao;
|
||||
import com.cloud.projects.Project;
|
||||
import com.cloud.projects.ProjectService;
|
||||
import com.cloud.resource.ResourceManager;
|
||||
import com.cloud.server.Criteria;
|
||||
import com.cloud.server.ManagementServer;
|
||||
import com.cloud.server.StatsCollector;
|
||||
|
|
@ -129,7 +130,6 @@ import com.cloud.vm.dao.VMInstanceDao;
|
|||
|
||||
public class ApiDBUtils {
|
||||
private static ManagementServer _ms;
|
||||
private static AgentManager _agentMgr;
|
||||
public static AsyncJobManager _asyncMgr;
|
||||
private static SecurityGroupManager _securityGroupMgr;
|
||||
private static StorageManager _storageMgr;
|
||||
|
|
@ -173,11 +173,11 @@ public class ApiDBUtils {
|
|||
private static VMInstanceDao _vmDao;
|
||||
private static ResourceLimitService _resourceLimitMgr;
|
||||
private static ProjectService _projectMgr;
|
||||
private static ResourceManager _resourceMgr;
|
||||
|
||||
static {
|
||||
_ms = (ManagementServer) ComponentLocator.getComponent(ManagementServer.Name);
|
||||
ComponentLocator locator = ComponentLocator.getLocator(ManagementServer.Name);
|
||||
_agentMgr = locator.getManager(AgentManager.class);
|
||||
_asyncMgr = locator.getManager(AsyncJobManager.class);
|
||||
_securityGroupMgr = locator.getManager(SecurityGroupManager.class);
|
||||
_storageMgr = locator.getManager(StorageManager.class);
|
||||
|
|
@ -220,6 +220,7 @@ public class ApiDBUtils {
|
|||
_vmDao = locator.getDao(VMInstanceDao.class);
|
||||
_resourceLimitMgr = locator.getManager(ResourceLimitService.class);
|
||||
_projectMgr = locator.getManager(ProjectService.class);
|
||||
_resourceMgr = locator.getManager(ResourceManager.class);
|
||||
|
||||
// Note: stats collector should already have been initialized by this time, otherwise a null instance is returned
|
||||
_statsCollector = StatsCollector.getInstance();
|
||||
|
|
@ -412,7 +413,7 @@ public class ApiDBUtils {
|
|||
}
|
||||
|
||||
public static GuestOSCategoryVO getHostGuestOSCategory(long hostId) {
|
||||
Long guestOSCategoryID = _agentMgr.getGuestOSCategoryId(hostId);
|
||||
Long guestOSCategoryID = _resourceMgr.getGuestOSCategoryId(hostId);
|
||||
|
||||
if (guestOSCategoryID != null) {
|
||||
return _guestOSCategoryDao.findById(guestOSCategoryID);
|
||||
|
|
@ -422,7 +423,7 @@ public class ApiDBUtils {
|
|||
}
|
||||
|
||||
public static String getHostTags(long hostId) {
|
||||
return _agentMgr.getHostTags(hostId);
|
||||
return _resourceMgr.getHostTags(hostId);
|
||||
}
|
||||
|
||||
public static LoadBalancerVO findLoadBalancerById(Long loadBalancerId) {
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ import com.cloud.agent.api.DirectNetworkUsageCommand;
|
|||
import com.cloud.agent.api.RecurringNetworkUsageCommand;
|
||||
import com.cloud.agent.api.StartupCommand;
|
||||
import com.cloud.agent.api.StartupTrafficMonitorCommand;
|
||||
import com.cloud.agent.manager.Commands;
|
||||
import com.cloud.api.commands.AddTrafficMonitorCmd;
|
||||
import com.cloud.api.commands.DeleteTrafficMonitorCmd;
|
||||
import com.cloud.api.commands.ListTrafficMonitorsCmd;
|
||||
|
|
@ -485,7 +486,11 @@ public class NetworkUsageManagerImpl implements NetworkUsageManager, ResourceSta
|
|||
long agentId = agent.getId();
|
||||
s_logger.debug("Sending RecurringNetworkUsageCommand to " + agentId);
|
||||
RecurringNetworkUsageCommand watch = new RecurringNetworkUsageCommand(_interval);
|
||||
_agentMgr.gatherStats(agentId, watch, this);
|
||||
try {
|
||||
_agentMgr.send(agentId, new Commands(watch), this);
|
||||
} catch (AgentUnavailableException e) {
|
||||
s_logger.debug("Can not process connect for host " + agentId, e);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,18 +19,24 @@ package com.cloud.resource;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.cloud.agent.api.StartupCommand;
|
||||
import com.cloud.agent.api.StartupRoutingCommand;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.HostPodVO;
|
||||
import com.cloud.dc.PodCluster;
|
||||
import com.cloud.exception.AgentUnavailableException;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.host.HostStats;
|
||||
import com.cloud.host.Status;
|
||||
import com.cloud.host.Host.Type;
|
||||
import com.cloud.host.HostVO;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.resource.ResourceState.Event;
|
||||
import com.cloud.service.ServiceOfferingVO;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.fsm.NoTransitionException;
|
||||
|
||||
/**
|
||||
|
|
@ -106,4 +112,22 @@ public interface ResourceManager {
|
|||
public HostVO findHostByName(String name);
|
||||
|
||||
public List<HostVO> listHostsByNameLike(String name);
|
||||
|
||||
/**
|
||||
* Find a pod based on the user id, template, and data center.
|
||||
*
|
||||
* @param template
|
||||
* @param dc
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
Pair<HostPodVO, Long> findPod(VirtualMachineTemplate template, ServiceOfferingVO offering, DataCenterVO dc, long accountId, Set<Long> avoids);
|
||||
|
||||
HostStats getHostStatistics(long hostId);
|
||||
|
||||
Long getGuestOSCategoryId(long hostId);
|
||||
|
||||
String getHostTags(long hostId);
|
||||
|
||||
List<PodCluster> listByDataCenter(long dcId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import java.util.HashMap;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
|
@ -34,12 +35,17 @@ import org.apache.log4j.Logger;
|
|||
|
||||
import com.cloud.agent.AgentManager;
|
||||
import com.cloud.agent.AgentManager.TapAgentsAction;
|
||||
import com.cloud.agent.api.Answer;
|
||||
import com.cloud.agent.api.GetHostStatsAnswer;
|
||||
import com.cloud.agent.api.GetHostStatsCommand;
|
||||
import com.cloud.agent.api.MaintainAnswer;
|
||||
import com.cloud.agent.api.MaintainCommand;
|
||||
import com.cloud.agent.api.StartupCommand;
|
||||
import com.cloud.agent.api.StartupRoutingCommand;
|
||||
import com.cloud.agent.api.UnsupportedAnswer;
|
||||
import com.cloud.agent.api.UpdateHostPasswordCommand;
|
||||
import com.cloud.agent.manager.AgentAttache;
|
||||
import com.cloud.agent.manager.allocator.PodAllocator;
|
||||
import com.cloud.agent.transport.Request;
|
||||
import com.cloud.api.ApiConstants;
|
||||
import com.cloud.api.commands.AddClusterCmd;
|
||||
|
|
@ -61,6 +67,7 @@ import com.cloud.dc.ClusterVO;
|
|||
import com.cloud.dc.DataCenterIpAddressVO;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.HostPodVO;
|
||||
import com.cloud.dc.PodCluster;
|
||||
import com.cloud.dc.dao.ClusterDao;
|
||||
import com.cloud.dc.dao.DataCenterDao;
|
||||
import com.cloud.dc.dao.DataCenterIpAddressDao;
|
||||
|
|
@ -74,6 +81,7 @@ import com.cloud.ha.HighAvailabilityManager.WorkType;
|
|||
import com.cloud.host.DetailVO;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.host.Host.Type;
|
||||
import com.cloud.host.HostStats;
|
||||
import com.cloud.host.HostVO;
|
||||
import com.cloud.host.Status;
|
||||
import com.cloud.host.dao.HostDao;
|
||||
|
|
@ -88,6 +96,7 @@ import com.cloud.org.Cluster;
|
|||
import com.cloud.org.Grouping;
|
||||
import com.cloud.org.Managed;
|
||||
import com.cloud.resource.ResourceState.Event;
|
||||
import com.cloud.service.ServiceOfferingVO;
|
||||
import com.cloud.storage.GuestOSCategoryVO;
|
||||
import com.cloud.storage.StorageManager;
|
||||
import com.cloud.storage.StoragePool;
|
||||
|
|
@ -99,11 +108,13 @@ import com.cloud.storage.dao.GuestOSCategoryDao;
|
|||
import com.cloud.storage.dao.StoragePoolDao;
|
||||
import com.cloud.storage.dao.StoragePoolHostDao;
|
||||
import com.cloud.storage.secondary.SecondaryStorageVmManager;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.AccountManager;
|
||||
import com.cloud.user.User;
|
||||
import com.cloud.user.UserContext;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.StringUtils;
|
||||
import com.cloud.utils.UriUtils;
|
||||
import com.cloud.utils.component.Adapters;
|
||||
import com.cloud.utils.component.Inject;
|
||||
|
|
@ -178,6 +189,8 @@ public class ResourceManagerImpl implements ResourceManager, ResourceService, Ma
|
|||
protected StoragePoolHostDao _storagePoolHostDao;
|
||||
@Inject
|
||||
protected HostDetailsDao _detailsDao;
|
||||
@Inject(adapter = PodAllocator.class)
|
||||
protected Adapters<PodAllocator> _podAllocators = null;
|
||||
|
||||
protected long _nodeId = ManagementServerNode.getManagementServerId();
|
||||
|
||||
|
|
@ -1926,4 +1939,82 @@ public class ResourceManagerImpl implements ResourceManager, ResourceService, Ma
|
|||
sc.addAnd(sc.getEntity().getName(), Op.LIKE, "%" + name + "%");
|
||||
return sc.list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pair<HostPodVO, Long> findPod(VirtualMachineTemplate template, ServiceOfferingVO offering, DataCenterVO dc, long accountId, Set<Long> avoids) {
|
||||
final Enumeration en = _podAllocators.enumeration();
|
||||
while (en.hasMoreElements()) {
|
||||
final PodAllocator allocator = (PodAllocator) en.nextElement();
|
||||
final Pair<HostPodVO, Long> pod = allocator.allocateTo(template, offering, dc, accountId, avoids);
|
||||
if (pod != null) {
|
||||
return pod;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HostStats getHostStatistics(long hostId) {
|
||||
Answer answer = _agentMgr.easySend(hostId, new GetHostStatsCommand(_hostDao.findById(hostId).getGuid(), _hostDao.findById(hostId).getName(), hostId));
|
||||
|
||||
if (answer != null && (answer instanceof UnsupportedAnswer)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (answer == null || !answer.getResult()) {
|
||||
String msg = "Unable to obtain host " + hostId + " statistics. ";
|
||||
s_logger.warn(msg);
|
||||
return null;
|
||||
} else {
|
||||
|
||||
// now construct the result object
|
||||
if (answer instanceof GetHostStatsAnswer) {
|
||||
return ((GetHostStatsAnswer) answer).getHostStats();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getGuestOSCategoryId(long hostId) {
|
||||
HostVO host = _hostDao.findById(hostId);
|
||||
if (host == null) {
|
||||
return null;
|
||||
} else {
|
||||
_hostDao.loadDetails(host);
|
||||
DetailVO detail = _hostDetailsDao.findDetail(hostId, "guest.os.category.id");
|
||||
if (detail == null) {
|
||||
return null;
|
||||
} else {
|
||||
return Long.parseLong(detail.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHostTags(long hostId) {
|
||||
List<String> hostTags = _hostTagsDao.gethostTags(hostId);
|
||||
if (hostTags == null) {
|
||||
return null;
|
||||
} else {
|
||||
return StringUtils.listToCsvTags(hostTags);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PodCluster> listByDataCenter(long dcId) {
|
||||
List<HostPodVO> pods = _podDao.listByDataCenterId(dcId);
|
||||
ArrayList<PodCluster> pcs = new ArrayList<PodCluster>();
|
||||
for (HostPodVO pod : pods) {
|
||||
List<ClusterVO> clusters = _clusterDao.listByPodId(pod.getId());
|
||||
if (clusters.size() == 0) {
|
||||
pcs.add(new PodCluster(pod, null));
|
||||
} else {
|
||||
for (ClusterVO cluster : clusters) {
|
||||
pcs.add(new PodCluster(pod, cluster));
|
||||
}
|
||||
}
|
||||
}
|
||||
return pcs;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import com.cloud.resource.ResourceManager;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
|
@ -86,7 +87,8 @@ public class StatsCollector {
|
|||
private final StoragePoolDao _storagePoolDao;
|
||||
private final StorageManager _storageManager;
|
||||
private final StoragePoolHostDao _storagePoolHostDao;
|
||||
private final SecondaryStorageVmManager _ssvmMgr;
|
||||
private final SecondaryStorageVmManager _ssvmMgr;
|
||||
private final ResourceManager _resourceMgr;
|
||||
|
||||
private ConcurrentHashMap<Long, HostStats> _hostStats = new ConcurrentHashMap<Long, HostStats>();
|
||||
private final ConcurrentHashMap<Long, VmStats> _VmStats = new ConcurrentHashMap<Long, VmStats>();
|
||||
|
|
@ -121,7 +123,8 @@ public class StatsCollector {
|
|||
_volsDao = locator.getDao(VolumeDao.class);
|
||||
_storagePoolDao = locator.getDao(StoragePoolDao.class);
|
||||
_storageManager = locator.getManager(StorageManager.class);
|
||||
_storagePoolHostDao = locator.getDao(StoragePoolHostDao.class);
|
||||
_storagePoolHostDao = locator.getDao(StoragePoolHostDao.class);
|
||||
_resourceMgr = locator.getManager(ResourceManager.class);
|
||||
|
||||
_executor = Executors.newScheduledThreadPool(3, new NamedThreadFactory("StatsCollector"));
|
||||
|
||||
|
|
@ -171,7 +174,7 @@ public class StatsCollector {
|
|||
List<HostVO> hosts = _hostDao.search(sc, null);
|
||||
for (HostVO host : hosts)
|
||||
{
|
||||
HostStatsEntry stats = (HostStatsEntry) _agentMgr.getHostStatistics(host.getId());
|
||||
HostStatsEntry stats = (HostStatsEntry) _resourceMgr.getHostStatistics(host.getId());
|
||||
if (stats != null)
|
||||
{
|
||||
hostStats.put(host.getId(), stats);
|
||||
|
|
@ -278,7 +281,7 @@ public class StatsCollector {
|
|||
continue;
|
||||
}
|
||||
GetStorageStatsCommand command = new GetStorageStatsCommand(host.getStorageUrl());
|
||||
HostVO ssAhost = _agentMgr.getSSAgent(host);
|
||||
HostVO ssAhost = _ssvmMgr.pickSsvmHost(host);
|
||||
if (ssAhost == null) {
|
||||
s_logger.debug("There is no secondary storage VM for secondary storage host " + host.getName());
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -528,7 +528,7 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
|
|||
|
||||
int retry = 0;
|
||||
// Determine what pod to store the volume in
|
||||
while ((pod = _agentMgr.findPod(null, null, dc, account.getId(), podsToAvoid)) != null) {
|
||||
while ((pod = _resourceMgr.findPod(null, null, dc, account.getId(), podsToAvoid)) != null) {
|
||||
podsToAvoid.add(pod.first().getId());
|
||||
// Determine what storage pool to store the volume in
|
||||
while ((pool = findStoragePool(dskCh, dc, pod.first(), null, null, poolsToAvoid)) != null) {
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ import com.cloud.agent.api.storage.DownloadAnswer;
|
|||
import com.cloud.agent.api.storage.DownloadCommand;
|
||||
import com.cloud.agent.api.storage.DownloadProgressCommand;
|
||||
import com.cloud.agent.api.storage.DownloadProgressCommand.RequestType;
|
||||
import com.cloud.exception.AgentUnavailableException;
|
||||
import com.cloud.exception.ConnectionException;
|
||||
import com.cloud.host.HostVO;
|
||||
import com.cloud.storage.Storage;
|
||||
|
|
@ -159,10 +160,12 @@ public class DownloadListener implements Listener {
|
|||
if (s_logger.isTraceEnabled()) {
|
||||
log("Sending progress command ", Level.TRACE);
|
||||
}
|
||||
long sent = downloadMonitor.send(ssAgent.getId(), new DownloadProgressCommand(getCommand(), getJobId(), reqType), this);
|
||||
if (sent == -1) {
|
||||
try {
|
||||
downloadMonitor.send(ssAgent.getId(), new DownloadProgressCommand(getCommand(), getJobId(), reqType), this);
|
||||
} catch (AgentUnavailableException e) {
|
||||
s_logger.debug("Send command failed", e);
|
||||
setDisconnected();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ import com.cloud.agent.api.storage.DownloadProgressCommand;
|
|||
import com.cloud.agent.api.storage.DownloadProgressCommand.RequestType;
|
||||
import com.cloud.agent.api.storage.ListTemplateAnswer;
|
||||
import com.cloud.agent.api.storage.ListTemplateCommand;
|
||||
import com.cloud.agent.manager.Commands;
|
||||
import com.cloud.alert.AlertManager;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
|
|
@ -48,6 +49,7 @@ import com.cloud.dc.dao.DataCenterDao;
|
|||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.event.UsageEventVO;
|
||||
import com.cloud.event.dao.UsageEventDao;
|
||||
import com.cloud.exception.AgentUnavailableException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.StorageUnavailableException;
|
||||
import com.cloud.host.Host;
|
||||
|
|
@ -141,8 +143,8 @@ public class DownloadMonitorImpl implements DownloadMonitor {
|
|||
final Map<VMTemplateHostVO, DownloadListener> _listenerMap = new ConcurrentHashMap<VMTemplateHostVO, DownloadListener>();
|
||||
|
||||
|
||||
public long send(Long hostId, Command cmd, Listener listener) {
|
||||
return _agentMgr.gatherStats(hostId, cmd, listener);
|
||||
public void send(Long hostId, Command cmd, Listener listener) throws AgentUnavailableException {
|
||||
_agentMgr.send(hostId, new Commands(cmd), listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -243,7 +245,7 @@ public class DownloadMonitorImpl implements DownloadMonitor {
|
|||
dcmd = new DownloadProgressCommand(dcmd, destTmpltHost.getJobId(), RequestType.GET_OR_RESTART);
|
||||
}
|
||||
dcmd.setChecksum(sourceChecksum); // We need to set the checksum as the source template might be a compressed url and have cksum for compressed image. Bug #10775
|
||||
HostVO ssAhost = _agentMgr.getSSAgent(destServer);
|
||||
HostVO ssAhost = _ssvmMgr.pickSsvmHost(destServer);
|
||||
if( ssAhost == null ) {
|
||||
s_logger.warn("There is no secondary storage VM for secondary storage host " + destServer.getName());
|
||||
return false;
|
||||
|
|
@ -260,15 +262,17 @@ public class DownloadMonitorImpl implements DownloadMonitor {
|
|||
old.abandon();
|
||||
}
|
||||
|
||||
long result = send(ssAhost.getId(), dcmd, dl);
|
||||
if (result == -1) {
|
||||
s_logger.warn("Unable to start /resume COPY of template " + template.getUniqueName() + " to " + destServer.getName());
|
||||
try {
|
||||
send(ssAhost.getId(), dcmd, dl);
|
||||
return true;
|
||||
} catch (AgentUnavailableException e) {
|
||||
s_logger.warn("Unable to start /resume COPY of template " + template.getUniqueName() + " to " + destServer.getName(), e);
|
||||
dl.setDisconnected();
|
||||
dl.scheduleStatusCheck(RequestType.GET_OR_RESTART);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -327,7 +331,7 @@ public class DownloadMonitorImpl implements DownloadMonitor {
|
|||
if (vmTemplateHost.isCopy()) {
|
||||
dcmd.setCreds(TemplateConstants.DEFAULT_HTTP_AUTH_USER, _copyAuthPasswd);
|
||||
}
|
||||
HostVO ssAhost = _agentMgr.getSSAgent(sserver);
|
||||
HostVO ssAhost = _ssvmMgr.pickSsvmHost(sserver);
|
||||
if( ssAhost == null ) {
|
||||
s_logger.warn("There is no secondary storage VM for secondary storage host " + sserver.getName());
|
||||
return;
|
||||
|
|
@ -344,12 +348,13 @@ public class DownloadMonitorImpl implements DownloadMonitor {
|
|||
old.abandon();
|
||||
}
|
||||
|
||||
long result = send(ssAhost.getId(), dcmd, dl);
|
||||
if (result == -1) {
|
||||
s_logger.warn("Unable to start /resume download of template " + template.getUniqueName() + " to " + sserver.getName());
|
||||
try {
|
||||
send(ssAhost.getId(), dcmd, dl);
|
||||
} catch (AgentUnavailableException e) {
|
||||
s_logger.warn("Unable to start /resume download of template " + template.getUniqueName() + " to " + sserver.getName(), e);
|
||||
dl.setDisconnected();
|
||||
dl.scheduleStatusCheck(RequestType.GET_OR_RESTART);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -654,16 +659,17 @@ public class DownloadMonitorImpl implements DownloadMonitor {
|
|||
for (String uniqueName : templateInfos.keySet()) {
|
||||
TemplateInfo tInfo = templateInfos.get(uniqueName);
|
||||
DeleteTemplateCommand dtCommand = new DeleteTemplateCommand(ssHost.getStorageUrl(), tInfo.getInstallPath());
|
||||
long result = _agentMgr.sendToSecStorage(ssHost, dtCommand, null);
|
||||
if (result == -1) {
|
||||
String description = "Failed to delete " + tInfo.getTemplateName() + " on secondary storage " + sserverId + " which isn't in the database";
|
||||
s_logger.error(description);
|
||||
try {
|
||||
_agentMgr.sendToSecStorage(ssHost, dtCommand, null);
|
||||
} catch (AgentUnavailableException e) {
|
||||
String err = "Failed to delete " + tInfo.getTemplateName() + " on secondary storage " + sserverId + " which isn't in the database";
|
||||
s_logger.error(err);
|
||||
return;
|
||||
}
|
||||
String description = "Deleted template " + tInfo.getTemplateName() + " on secondary storage " + sserverId + " since it isn't in the database, result=" + result;
|
||||
|
||||
String description = "Deleted template " + tInfo.getTemplateName() + " on secondary storage " + sserverId + " since it isn't in the database";
|
||||
s_logger.info(description);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1322,4 +1322,20 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
|
|||
sc.addAnd(sc.getEntity().getType(), Op.EQ, Host.Type.SecondaryStorageVM);
|
||||
return sc.list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HostVO pickSsvmHost(HostVO ssHost) {
|
||||
if( ssHost.getType() == Host.Type.LocalSecondaryStorage ) {
|
||||
return ssHost;
|
||||
} else if ( ssHost.getType() == Host.Type.SecondaryStorage) {
|
||||
Long dcId = ssHost.getDataCenterId();
|
||||
List<HostVO> ssAHosts = listUpSecondaryStorageVmHost(dcId);
|
||||
if (ssAHosts == null || ssAHosts.isEmpty() ) {
|
||||
return null;
|
||||
}
|
||||
Collections.shuffle(ssAHosts);
|
||||
return ssAHosts.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,5 +52,6 @@ public interface SecondaryStorageVmManager extends Manager {
|
|||
public List<HostVO> listSecondaryStorageHostsInOneZone(long dataCenterId);
|
||||
public List<HostVO> listLocalSecondaryStorageHostsInOneZone(long dataCenterId);
|
||||
public List<HostVO> listAllTypesSecondaryStorageHostsInOneZone(long dataCenterId);
|
||||
public List<HostVO> listUpSecondaryStorageVmHost(long dcId);
|
||||
public List<HostVO> listUpSecondaryStorageVmHost(long dcId);
|
||||
public HostVO pickSsvmHost(HostVO ssHost);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ import com.cloud.async.AsyncJobManager;
|
|||
import com.cloud.async.AsyncJobResult;
|
||||
import com.cloud.async.executor.ExtractJobResultObject;
|
||||
import com.cloud.event.EventVO;
|
||||
import com.cloud.exception.AgentUnavailableException;
|
||||
import com.cloud.host.HostVO;
|
||||
import com.cloud.storage.Storage;
|
||||
import com.cloud.storage.Upload.Status;
|
||||
|
|
@ -421,10 +422,12 @@ public class UploadListener implements Listener {
|
|||
if (s_logger.isTraceEnabled()) {
|
||||
log("Sending progress command ", Level.TRACE);
|
||||
}
|
||||
long sent = uploadMonitor.send(sserver.getId(), new UploadProgressCommand(getCommand(), getJobId(), reqType), this);
|
||||
if (sent == -1) {
|
||||
try {
|
||||
uploadMonitor.send(sserver.getId(), new UploadProgressCommand(getCommand(), getJobId(), reqType), this);
|
||||
} catch (AgentUnavailableException e) {
|
||||
s_logger.debug("Send command failed", e);
|
||||
setDisconnected();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,9 +42,11 @@ import com.cloud.agent.api.storage.CreateEntityDownloadURLCommand;
|
|||
import com.cloud.agent.api.storage.DeleteEntityDownloadURLCommand;
|
||||
import com.cloud.agent.api.storage.UploadCommand;
|
||||
import com.cloud.agent.api.storage.UploadProgressCommand.RequestType;
|
||||
import com.cloud.agent.manager.Commands;
|
||||
import com.cloud.api.ApiDBUtils;
|
||||
import com.cloud.async.AsyncJobManager;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.exception.AgentUnavailableException;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.host.HostVO;
|
||||
import com.cloud.host.dao.HostDao;
|
||||
|
|
@ -61,6 +63,7 @@ import com.cloud.storage.VolumeVO;
|
|||
import com.cloud.storage.dao.UploadDao;
|
||||
import com.cloud.storage.dao.VMTemplateDao;
|
||||
import com.cloud.storage.dao.VMTemplateHostDao;
|
||||
import com.cloud.storage.secondary.SecondaryStorageVmManager;
|
||||
import com.cloud.utils.NumbersUtil;
|
||||
import com.cloud.utils.component.Inject;
|
||||
import com.cloud.utils.concurrency.NamedThreadFactory;
|
||||
|
|
@ -98,6 +101,8 @@ public class UploadMonitorImpl implements UploadMonitor {
|
|||
ConfigurationDao _configDao;
|
||||
@Inject
|
||||
ResourceManager _resourceMgr;
|
||||
@Inject
|
||||
SecondaryStorageVmManager _ssvmMgr;
|
||||
|
||||
private String _name;
|
||||
private Boolean _sslCopy = new Boolean(false);
|
||||
|
|
@ -153,13 +158,13 @@ public class UploadMonitorImpl implements UploadMonitor {
|
|||
UploadListener ul = new UploadListener(sserver, _timer, _uploadDao, uploadVolumeObj, this, ucmd, volume.getAccountId(), volume.getName(), Type.VOLUME, eventId, asyncJobId, asyncMgr);
|
||||
_listenerMap.put(uploadVolumeObj, ul);
|
||||
|
||||
long result = send(sserver.getId(), ucmd, ul);
|
||||
if (result == -1) {
|
||||
s_logger.warn("Unable to start upload of volume " + volume.getName() + " from " + sserver.getName() + " to " +url);
|
||||
try {
|
||||
send(sserver.getId(), ucmd, ul);
|
||||
} catch (AgentUnavailableException e) {
|
||||
s_logger.warn("Unable to start upload of volume " + volume.getName() + " from " + sserver.getName() + " to " +url, e);
|
||||
ul.setDisconnected();
|
||||
ul.scheduleStatusCheck(RequestType.GET_OR_RESTART);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -181,12 +186,13 @@ public class UploadMonitorImpl implements UploadMonitor {
|
|||
UploadListener ul = new UploadListener(sserver, _timer, _uploadDao, uploadTemplateObj, this, ucmd, template.getAccountId(), template.getName(), type, eventId, asyncJobId, asyncMgr);
|
||||
_listenerMap.put(uploadTemplateObj, ul);
|
||||
|
||||
long result = send(sserver.getId(), ucmd, ul);
|
||||
if (result == -1) {
|
||||
s_logger.warn("Unable to start upload of " + template.getUniqueName() + " from " + sserver.getName() + " to " +url);
|
||||
try {
|
||||
send(sserver.getId(), ucmd, ul);
|
||||
} catch (AgentUnavailableException e) {
|
||||
s_logger.warn("Unable to start upload of " + template.getUniqueName() + " from " + sserver.getName() + " to " +url, e);
|
||||
ul.setDisconnected();
|
||||
ul.scheduleStatusCheck(RequestType.GET_OR_RESTART);
|
||||
}
|
||||
}
|
||||
return uploadTemplateObj.getId();
|
||||
}
|
||||
return null;
|
||||
|
|
@ -201,7 +207,7 @@ public class UploadMonitorImpl implements UploadMonitor {
|
|||
Type type = (template.getFormat() == ImageFormat.ISO) ? Type.ISO : Type.TEMPLATE ;
|
||||
|
||||
//Check if ssvm is up
|
||||
HostVO ssvm = _agentMgr.getSSAgent(ApiDBUtils.findHostById(vmTemplateHost.getHostId()));
|
||||
HostVO ssvm = _ssvmMgr.pickSsvmHost(ApiDBUtils.findHostById(vmTemplateHost.getHostId()));
|
||||
if( ssvm == null ) {
|
||||
throw new CloudRuntimeException("There is no secondary storage VM for secondary storage host " + secStorage.getId());
|
||||
}
|
||||
|
|
@ -222,13 +228,14 @@ public class UploadMonitorImpl implements UploadMonitor {
|
|||
String path = vmTemplateHost.getInstallPath();
|
||||
String uuid = UUID.randomUUID().toString() + path.substring(path.length() - 4) ; // last 4 characters of the path specify the format like .vhd
|
||||
CreateEntityDownloadURLCommand cmd = new CreateEntityDownloadURLCommand(secStorage.getParent(), path, uuid);
|
||||
long result = send(ssvm.getId(), cmd, null);
|
||||
if (result == -1){
|
||||
errorString = "Unable to create a link for " +type+ " id:"+template.getId();
|
||||
s_logger.error(errorString);
|
||||
try {
|
||||
send(ssvm.getId(), cmd, null);
|
||||
} catch (AgentUnavailableException e) {
|
||||
errorString = "Unable to create a link for " +type+ " id:"+template.getId() + "," + e.getMessage();
|
||||
s_logger.error(errorString, e);
|
||||
throw new CloudRuntimeException(errorString);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Construct actual URL locally now that the symlink exists at SSVM
|
||||
List<SecondaryStorageVmVO> ssVms = _secStorageVmDao.getSecStorageVmListInStates(SecondaryStorageVm.Role.templateProcessor, dataCenterId, State.Running);
|
||||
if (ssVms.size() > 0) {
|
||||
|
|
@ -287,20 +294,21 @@ public class UploadMonitorImpl implements UploadMonitor {
|
|||
// Create Symlink at ssvm
|
||||
String uuid = UUID.randomUUID().toString() + path.substring(path.length() - 4) ; // last 4 characters of the path specify the format like .vhd
|
||||
HostVO secStorage = ApiDBUtils.findHostById(ApiDBUtils.findUploadById(uploadId).getHostId());
|
||||
HostVO ssvm = _agentMgr.getSSAgent(secStorage);
|
||||
HostVO ssvm = _ssvmMgr.pickSsvmHost(secStorage);
|
||||
if( ssvm == null ) {
|
||||
errorString = "There is no secondary storage VM for secondary storage host " + secStorage.getName();
|
||||
throw new CloudRuntimeException(errorString);
|
||||
}
|
||||
|
||||
CreateEntityDownloadURLCommand cmd = new CreateEntityDownloadURLCommand(secStorage.getParent(), path, uuid);
|
||||
long result = send(ssvm.getId(), cmd, null);
|
||||
if (result == -1){
|
||||
errorString = "Unable to create a link for " +type+ " id:"+entityId;
|
||||
s_logger.warn(errorString);
|
||||
try {
|
||||
send(ssvm.getId(), cmd, null);
|
||||
} catch (AgentUnavailableException e) {
|
||||
errorString = "Unable to create a link for " +type+ " id:"+entityId + "," + e.getMessage();
|
||||
s_logger.warn(errorString, e);
|
||||
throw new CloudRuntimeException(errorString);
|
||||
}
|
||||
|
||||
|
||||
//Construct actual URL locally now that the symlink exists at SSVM
|
||||
String extractURL = generateCopyUrl(ssvm.getPublicIpAddress(), uuid);
|
||||
UploadVO vo = _uploadDao.createForUpdate();
|
||||
|
|
@ -335,8 +343,8 @@ public class UploadMonitorImpl implements UploadMonitor {
|
|||
|
||||
|
||||
|
||||
public long send(Long hostId, Command cmd, Listener listener) {
|
||||
return _agentMgr.gatherStats(hostId, cmd, listener);
|
||||
public void send(Long hostId, Command cmd, Listener listener) throws AgentUnavailableException {
|
||||
_agentMgr.send(hostId, new Commands(cmd), listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -468,16 +476,17 @@ public class UploadMonitorImpl implements UploadMonitor {
|
|||
s_logger.debug("Sending deletion of extract URL "+extractJob.getUploadUrl());
|
||||
// Would delete the symlink for the Type and if Type == VOLUME then also the volume
|
||||
DeleteEntityDownloadURLCommand cmd = new DeleteEntityDownloadURLCommand(path, extractJob.getType(),extractJob.getUploadUrl(), secStorage.getParent());
|
||||
HostVO ssvm = _agentMgr.getSSAgent(secStorage);
|
||||
HostVO ssvm = _ssvmMgr.pickSsvmHost(secStorage);
|
||||
if( ssvm == null ) {
|
||||
s_logger.warn("There is no secondary storage VM for secondary storage host " + extractJob.getHostId());
|
||||
continue;
|
||||
}
|
||||
long result = send(ssvm.getId(), cmd, null);
|
||||
if (result == -1){
|
||||
s_logger.warn("Unable to delete the link for " +extractJob.getType()+ " id=" +extractJob.getTypeId()+ " url="+extractJob.getUploadUrl());
|
||||
}else{
|
||||
|
||||
try {
|
||||
send(ssvm.getId(), cmd, null);
|
||||
_uploadDao.remove(extractJob.getId());
|
||||
} catch (AgentUnavailableException e) {
|
||||
s_logger.warn("Unable to delete the link for " +extractJob.getType()+ " id=" +extractJob.getTypeId()+ " url="+extractJob.getUploadUrl(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,12 +81,6 @@ public class MockAgentManagerImpl implements AgentManager {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long gatherStats(Long hostId, Command cmd, Listener listener) {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long send(Long hostId, Commands cmds, Listener listener) throws AgentUnavailableException {
|
||||
// TODO Auto-generated method stub
|
||||
|
|
@ -111,48 +105,6 @@ public class MockAgentManagerImpl implements AgentManager {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Long> getConnectedHosts() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HostStats getHostStatistics(long hostId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getGuestOSCategoryId(long hostId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHostTags(long hostId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PodCluster> listByDataCenter(long dcId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PodCluster> listByPod(long podId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pair<HostPodVO, Long> findPod(VirtualMachineTemplate template, ServiceOfferingVO offering, DataCenterVO dc, long userId, Set<Long> avoids) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean executeUserRequest(long hostId, Event event) throws AgentUnavailableException {
|
||||
// TODO Auto-generated method stub
|
||||
|
|
@ -165,12 +117,6 @@ public class MockAgentManagerImpl implements AgentManager {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHostNativeHAEnabled(long hostId) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Answer sendTo(Long dcId, HypervisorType type, Command cmd) {
|
||||
// TODO Auto-generated method stub
|
||||
|
|
@ -178,15 +124,7 @@ public class MockAgentManagerImpl implements AgentManager {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void notifyAnswersToMonitors(long agentId, long seq, Answer[] answers) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public long sendToSecStorage(HostVO ssHost, Command cmd, Listener listener) {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
public void sendToSecStorage(HostVO ssHost, Command cmd, Listener listener) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -195,12 +133,6 @@ public class MockAgentManagerImpl implements AgentManager {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HostVO getSSAgent(HostVO ssHost) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean tapLoadingAgents(Long hostId, TapAgentsAction action) {
|
||||
// TODO Auto-generated method stub
|
||||
|
|
@ -225,12 +157,6 @@ public class MockAgentManagerImpl implements AgentManager {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean disconnectAgent(HostVO host, Event e, long msId) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pullAgentToMaintenance(long hostId) {
|
||||
// TODO Auto-generated method stub
|
||||
|
|
@ -244,7 +170,7 @@ public class MockAgentManagerImpl implements AgentManager {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void disconnectWithInvestigation(long hostId, Event event) {
|
||||
public void pullAgentOutMaintenance(long hostId) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue