Search in sources :

Example 6 with StartupSecondaryStorageCommand

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;
}
Also used : StartupCommand(com.cloud.agent.api.StartupCommand) StartupSecondaryStorageCommand(com.cloud.agent.api.StartupSecondaryStorageCommand)

Example 7 with StartupSecondaryStorageCommand

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 };
}
Also used : StartupCommand(com.cloud.agent.api.StartupCommand) StartupSecondaryStorageCommand(com.cloud.agent.api.StartupSecondaryStorageCommand)

Example 8 with StartupSecondaryStorageCommand

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);
        }
    }
}
Also used : HypervisorType(com.cloud.hypervisor.Hypervisor.HypervisorType) ZoneScope(org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope) StartupSecondaryStorageCommand(com.cloud.agent.api.StartupSecondaryStorageCommand) DataStore(org.apache.cloudstack.engine.subsystem.api.storage.DataStore) List(java.util.List) StartupRoutingCommand(com.cloud.agent.api.StartupRoutingCommand) ConnectionException(com.cloud.exception.ConnectionException) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException)

Aggregations

StartupSecondaryStorageCommand (com.cloud.agent.api.StartupSecondaryStorageCommand)8 StartupCommand (com.cloud.agent.api.StartupCommand)7 StartupRoutingCommand (com.cloud.agent.api.StartupRoutingCommand)2 AgentControlCommand (com.cloud.agent.api.AgentControlCommand)1 CheckHealthCommand (com.cloud.agent.api.CheckHealthCommand)1 Command (com.cloud.agent.api.Command)1 PingCommand (com.cloud.agent.api.PingCommand)1 PingRoutingCommand (com.cloud.agent.api.PingRoutingCommand)1 ReadyCommand (com.cloud.agent.api.ReadyCommand)1 SetHostParamsCommand (com.cloud.agent.api.SetHostParamsCommand)1 ShutdownCommand (com.cloud.agent.api.ShutdownCommand)1 StartupAnswer (com.cloud.agent.api.StartupAnswer)1 StartupProxyCommand (com.cloud.agent.api.StartupProxyCommand)1 StartupStorageCommand (com.cloud.agent.api.StartupStorageCommand)1 Response (com.cloud.agent.transport.Response)1 ConnectionException (com.cloud.exception.ConnectionException)1 HypervisorType (com.cloud.hypervisor.Hypervisor.HypervisorType)1 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)1 Script (com.cloud.utils.script.Script)1 ClosedChannelException (java.nio.channels.ClosedChannelException)1