use of com.cloud.agent.api.StartupRoutingCommand in project cloudstack by apache.
the class AgentManagerImplTest method setUp.
@Before
public void setUp() throws Exception {
host = new HostVO("some-Uuid");
host.setDataCenterId(1L);
cmds = new StartupCommand[] { new StartupRoutingCommand() };
attache = new ConnectedAgentAttache(null, 1L, "kvm-attache", null, false);
hostDao = Mockito.mock(HostDao.class);
storagePoolMonitor = Mockito.mock(Listener.class);
mgr._hostDao = hostDao;
mgr._hostMonitors = new ArrayList<>();
mgr._hostMonitors.add(new Pair<>(0, storagePoolMonitor));
}
use of com.cloud.agent.api.StartupRoutingCommand in project cloudstack by apache.
the class XcpServerDiscoverer method createHostVOForDirectConnectAgent.
@Override
public HostVO createHostVOForDirectConnectAgent(HostVO host, StartupCommand[] startup, ServerResource resource, Map<String, String> details, List<String> hostTags) {
StartupCommand firstCmd = startup[0];
if (!(firstCmd instanceof StartupRoutingCommand)) {
return null;
}
StartupRoutingCommand ssCmd = ((StartupRoutingCommand) firstCmd);
if (ssCmd.getHypervisorType() != HypervisorType.XenServer) {
return null;
}
HostPodVO pod = _podDao.findById(host.getPodId());
DataCenterVO dc = _dcDao.findById(host.getDataCenterId());
s_logger.info("Host: " + host.getName() + " connected with hypervisor type: " + HypervisorType.XenServer + ". Checking CIDR...");
_resourceMgr.checkCIDR(pod, dc, ssCmd.getPrivateIpAddress(), ssCmd.getPrivateNetmask());
return _resourceMgr.fillRoutingHostVO(host, ssCmd, HypervisorType.XenServer, details, hostTags);
}
use of com.cloud.agent.api.StartupRoutingCommand in project cloudstack by apache.
the class OvmDiscoverer method createHostVOForDirectConnectAgent.
@Override
public HostVO createHostVOForDirectConnectAgent(HostVO host, StartupCommand[] startup, ServerResource resource, Map<String, String> details, List<String> hostTags) {
StartupCommand firstCmd = startup[0];
if (!(firstCmd instanceof StartupRoutingCommand)) {
return null;
}
StartupRoutingCommand ssCmd = ((StartupRoutingCommand) firstCmd);
if (ssCmd.getHypervisorType() != HypervisorType.Ovm) {
return null;
}
return _resourceMgr.fillRoutingHostVO(host, ssCmd, HypervisorType.Ovm, details, hostTags);
}
use of com.cloud.agent.api.StartupRoutingCommand in project cloudstack by apache.
the class DownloadListener method processConnect.
@Override
public void processConnect(Host agent, StartupCommand cmd, boolean forRebalance) throws ConnectionException {
if (cmd instanceof StartupRoutingCommand) {
List<HypervisorType> hypers = _resourceMgr.listAvailHypervisorInZone(agent.getId(), agent.getDataCenterId());
HypervisorType hostHyper = agent.getHypervisorType();
if (hypers.contains(hostHyper)) {
return;
}
_imageSrv.handleSysTemplateDownload(hostHyper, agent.getDataCenterId());
// update template_zone_ref for cross-zone templates
_imageSrv.associateCrosszoneTemplatesToZone(agent.getDataCenterId());
} else /* This can be removed
else if ( cmd instanceof StartupStorageCommand) {
StartupStorageCommand storage = (StartupStorageCommand)cmd;
if( storage.getResourceType() == Storage.StorageResourceType.SECONDARY_STORAGE ||
storage.getResourceType() == Storage.StorageResourceType.LOCAL_SECONDARY_STORAGE ) {
downloadMonitor.addSystemVMTemplatesToHost(agent, storage.getTemplateInfo());
downloadMonitor.handleTemplateSync(agent);
downloadMonitor.handleVolumeSync(agent);
}
}*/
if (cmd instanceof StartupSecondaryStorageCommand) {
try {
List<DataStore> imageStores = _storeMgr.getImageStoresByScope(new ZoneScope(agent.getDataCenterId()));
for (DataStore store : imageStores) {
_volumeSrv.handleVolumeSync(store);
_imageSrv.handleTemplateSync(store);
}
} catch (Exception e) {
s_logger.error("Caught exception while doing template/volume sync ", e);
}
}
}
use of com.cloud.agent.api.StartupRoutingCommand in project cloudstack by apache.
the class BareMetalDiscoverer method createHostVOForDirectConnectAgent.
@Override
public HostVO createHostVOForDirectConnectAgent(HostVO host, StartupCommand[] startup, ServerResource resource, Map<String, String> details, List<String> hostTags) {
StartupCommand firstCmd = startup[0];
if (!(firstCmd instanceof StartupRoutingCommand)) {
return null;
}
StartupRoutingCommand ssCmd = ((StartupRoutingCommand) firstCmd);
if (ssCmd.getHypervisorType() != HypervisorType.BareMetal) {
return null;
}
return _resourceMgr.fillRoutingHostVO(host, ssCmd, HypervisorType.BareMetal, details, hostTags);
}
Aggregations