use of com.cloud.agent.api.StartupSecondaryStorageCommand in project cloudstack by apache.
the class SecondaryStorageManagerImpl method createHostVOForConnectedAgent.
@Override
public HostVO createHostVOForConnectedAgent(HostVO host, StartupCommand[] cmd) {
/* Called when Secondary Storage VM connected */
StartupCommand firstCmd = cmd[0];
if (!(firstCmd instanceof StartupSecondaryStorageCommand)) {
return null;
}
host.setType(com.cloud.host.Host.Type.SecondaryStorageVM);
return host;
}
use of com.cloud.agent.api.StartupSecondaryStorageCommand in project CloudStack-archive by CloudStack-extras.
the class AgentStorageResource method initialize.
@Override
public StartupCommand[] initialize() {
StartupSecondaryStorageCommand cmd = new StartupSecondaryStorageCommand();
cmd.setPrivateIpAddress(agentHost.getPrivateIpAddress());
cmd.setPrivateNetmask(agentHost.getPrivateNetMask());
cmd.setPrivateMacAddress(agentHost.getPrivateMacAddress());
cmd.setStorageIpAddress(agentHost.getStorageIpAddress());
cmd.setStorageNetmask(agentHost.getStorageNetMask());
cmd.setStorageMacAddress(agentHost.getStorageMacAddress());
cmd.setPublicIpAddress(agentHost.getPublicIpAddress());
cmd.setName(agentHost.getName());
cmd.setAgentTag("agent-simulator");
cmd.setVersion(agentHost.getVersion());
cmd.setDataCenter(String.valueOf(agentHost.getDataCenterId()));
cmd.setPod(String.valueOf(agentHost.getPodId()));
cmd.setGuid(agentHost.getGuid());
return new StartupCommand[] { cmd };
}
use of com.cloud.agent.api.StartupSecondaryStorageCommand 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);
}
}
}
Aggregations