Search in sources :

Example 21 with StartupCommand

use of com.cloud.agent.api.StartupCommand in project cloudstack by apache.

the class JuniperSrxResource method initialize.

@Override
public StartupCommand[] initialize() {
    StartupExternalFirewallCommand cmd = new StartupExternalFirewallCommand();
    cmd.setName(_name);
    cmd.setDataCenter(_zoneId);
    cmd.setPod("");
    cmd.setPrivateIpAddress(_ip);
    cmd.setStorageIpAddress("");
    cmd.setVersion(JuniperSrxResource.class.getPackage().getImplementationVersion());
    cmd.setGuid(_guid);
    return new StartupCommand[] { cmd };
}
Also used : StartupCommand(com.cloud.agent.api.StartupCommand) StartupExternalFirewallCommand(com.cloud.agent.api.StartupExternalFirewallCommand)

Example 22 with StartupCommand

use of com.cloud.agent.api.StartupCommand in project cloudstack by apache.

the class VmwareResource method initialize.

@Override
public StartupCommand[] initialize() {
    try {
        String hostApiVersion = "4.1";
        VmwareContext context = getServiceContext();
        try {
            VmwareHypervisorHost hyperHost = getHyperHost(context);
            assert (hyperHost instanceof HostMO);
            if (!((HostMO) hyperHost).isHyperHostConnected()) {
                s_logger.info("Host " + hyperHost.getHyperHostName() + " is not in connected state");
                return null;
            }
            ((HostMO) hyperHost).enableVncOnHostFirewall();
            AboutInfo aboutInfo = ((HostMO) hyperHost).getHostAboutInfo();
            hostApiVersion = aboutInfo.getApiVersion();
        } catch (Exception e) {
            String msg = "VmwareResource intialize() failed due to : " + VmwareHelper.getExceptionMessage(e);
            s_logger.error(msg);
            invalidateServiceContext();
            return null;
        }
        StartupRoutingCommand cmd = new StartupRoutingCommand();
        fillHostInfo(cmd);
        cmd.setHypervisorType(HypervisorType.VMware);
        cmd.setCluster(_cluster);
        cmd.setHypervisorVersion(hostApiVersion);
        List<StartupStorageCommand> storageCmds = initializeLocalStorage();
        StartupCommand[] answerCmds = new StartupCommand[1 + storageCmds.size()];
        answerCmds[0] = cmd;
        for (int i = 0; i < storageCmds.size(); i++) {
            answerCmds[i + 1] = storageCmds.get(i);
        }
        return answerCmds;
    } finally {
        recycleServiceContext();
    }
}
Also used : StartupCommand(com.cloud.agent.api.StartupCommand) VmwareContext(com.cloud.hypervisor.vmware.util.VmwareContext) HostMO(com.cloud.hypervisor.vmware.mo.HostMO) StartupStorageCommand(com.cloud.agent.api.StartupStorageCommand) AboutInfo(com.vmware.vim25.AboutInfo) VmwareHypervisorHost(com.cloud.hypervisor.vmware.mo.VmwareHypervisorHost) StartupRoutingCommand(com.cloud.agent.api.StartupRoutingCommand) ConnectException(java.net.ConnectException) IOException(java.io.IOException) RemoteException(java.rmi.RemoteException) InternalErrorException(com.cloud.exception.InternalErrorException) CloudException(com.cloud.exception.CloudException) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) ConfigurationException(javax.naming.ConfigurationException)

Example 23 with StartupCommand

use of com.cloud.agent.api.StartupCommand in project cloudstack by apache.

the class NiciraNvpResource method initialize.

@Override
public StartupCommand[] initialize() {
    final StartupNiciraNvpCommand sc = new StartupNiciraNvpCommand();
    sc.setGuid(guid);
    sc.setName(name);
    sc.setDataCenter(zoneId);
    sc.setPod("");
    sc.setPrivateIpAddress("");
    sc.setStorageIpAddress("");
    sc.setVersion(NiciraNvpResource.class.getPackage().getImplementationVersion());
    return new StartupCommand[] { sc };
}
Also used : StartupCommand(com.cloud.agent.api.StartupCommand) StartupNiciraNvpCommand(com.cloud.agent.api.StartupNiciraNvpCommand)

Example 24 with StartupCommand

use of com.cloud.agent.api.StartupCommand in project cloudstack by apache.

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 25 with StartupCommand

use of com.cloud.agent.api.StartupCommand in project cloudstack by apache.

the class SimulatorDiscoverer 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.Simulator) {
        return null;
    }
    return _resourceMgr.fillRoutingHostVO(host, ssCmd, HypervisorType.Simulator, details, hostTags);
}
Also used : StartupCommand(com.cloud.agent.api.StartupCommand) StartupRoutingCommand(com.cloud.agent.api.StartupRoutingCommand)

Aggregations

StartupCommand (com.cloud.agent.api.StartupCommand)60 StartupRoutingCommand (com.cloud.agent.api.StartupRoutingCommand)28 StartupStorageCommand (com.cloud.agent.api.StartupStorageCommand)16 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)9 ConfigurationException (javax.naming.ConfigurationException)7 Command (com.cloud.agent.api.Command)6 StartupSecondaryStorageCommand (com.cloud.agent.api.StartupSecondaryStorageCommand)6 PingCommand (com.cloud.agent.api.PingCommand)5 HostVO (com.cloud.host.HostVO)5 URISyntaxException (java.net.URISyntaxException)5 Request (com.cloud.agent.transport.Request)4 AgentControlCommand (com.cloud.agent.api.AgentControlCommand)3 PingRoutingCommand (com.cloud.agent.api.PingRoutingCommand)3 ShutdownCommand (com.cloud.agent.api.ShutdownCommand)3 StartCommand (com.cloud.agent.api.StartCommand)3 StartupProxyCommand (com.cloud.agent.api.StartupProxyCommand)3 StoragePoolHostVO (com.cloud.storage.StoragePoolHostVO)3 CheckRouterCommand (com.cloud.agent.api.CheckRouterCommand)2 CheckS2SVpnConnectionsCommand (com.cloud.agent.api.CheckS2SVpnConnectionsCommand)2 CronCommand (com.cloud.agent.api.CronCommand)2