Search in sources :

Example 1 with StartupSecondaryStorageCommand

use of com.cloud.agent.api.StartupSecondaryStorageCommand in project CloudStack-archive by CloudStack-extras.

the class SimulatorSecondaryDiscoverer method createHostVOForDirectConnectAgent.

@Override
public HostVO createHostVOForDirectConnectAgent(HostVO host, StartupCommand[] startup, ServerResource resource, Map<String, String> details, List<String> hostTags) {
    //for detecting SSVM dispatch
    StartupCommand firstCmd = startup[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 2 with StartupSecondaryStorageCommand

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

the class AgentManagerImpl method connectAgent.

protected void connectAgent(final Link link, final Command[] cmds, final Request request) {
    // send startupanswer to agent in the very beginning, so agent can move on without waiting for the answer for an undetermined time, if we put this logic into another
    // thread pool.
    final StartupAnswer[] answers = new StartupAnswer[cmds.length];
    Command cmd;
    for (int i = 0; i < cmds.length; i++) {
        cmd = cmds[i];
        if (cmd instanceof StartupRoutingCommand || cmd instanceof StartupProxyCommand || cmd instanceof StartupSecondaryStorageCommand || cmd instanceof StartupStorageCommand) {
            answers[i] = new StartupAnswer((StartupCommand) cmds[i], 0, getPingInterval());
            break;
        }
    }
    Response response = null;
    response = new Response(request, answers[0], _nodeId, -1);
    try {
        link.send(response.toBytes());
    } catch (final ClosedChannelException e) {
        s_logger.debug("Failed to send startupanswer: " + e.toString());
    }
    _connectExecutor.execute(new HandleAgentConnectTask(link, cmds, request));
}
Also used : StartupAnswer(com.cloud.agent.api.StartupAnswer) StartupProxyCommand(com.cloud.agent.api.StartupProxyCommand) StartupCommand(com.cloud.agent.api.StartupCommand) Response(com.cloud.agent.transport.Response) ClosedChannelException(java.nio.channels.ClosedChannelException) StartupStorageCommand(com.cloud.agent.api.StartupStorageCommand) StartupCommand(com.cloud.agent.api.StartupCommand) AgentControlCommand(com.cloud.agent.api.AgentControlCommand) PingCommand(com.cloud.agent.api.PingCommand) PingRoutingCommand(com.cloud.agent.api.PingRoutingCommand) SetHostParamsCommand(com.cloud.agent.api.SetHostParamsCommand) StartupSecondaryStorageCommand(com.cloud.agent.api.StartupSecondaryStorageCommand) StartupRoutingCommand(com.cloud.agent.api.StartupRoutingCommand) ShutdownCommand(com.cloud.agent.api.ShutdownCommand) StartupProxyCommand(com.cloud.agent.api.StartupProxyCommand) CheckHealthCommand(com.cloud.agent.api.CheckHealthCommand) Command(com.cloud.agent.api.Command) ReadyCommand(com.cloud.agent.api.ReadyCommand) StartupSecondaryStorageCommand(com.cloud.agent.api.StartupSecondaryStorageCommand) StartupStorageCommand(com.cloud.agent.api.StartupStorageCommand) StartupRoutingCommand(com.cloud.agent.api.StartupRoutingCommand)

Example 3 with StartupSecondaryStorageCommand

use of com.cloud.agent.api.StartupSecondaryStorageCommand 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 4 with StartupSecondaryStorageCommand

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

the class SimulatorSecondaryDiscoverer method createHostVOForDirectConnectAgent.

@Override
public HostVO createHostVOForDirectConnectAgent(HostVO host, StartupCommand[] startup, ServerResource resource, Map<String, String> details, List<String> hostTags) {
    //for detecting SSVM dispatch
    StartupCommand firstCmd = startup[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 5 with StartupSecondaryStorageCommand

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

the class NfsSecondaryStorageResource method initialize.

@Override
public StartupCommand[] initialize() {
    final StartupSecondaryStorageCommand cmd = new StartupSecondaryStorageCommand();
    fillNetworkInformation(cmd);
    if (_publicIp != null) {
        cmd.setPublicIpAddress(_publicIp);
    }
    if (_inSystemVM) {
        Script command = new Script("/bin/bash", s_logger);
        command.add("-c");
        command.add("ln -sf " + _parent + " /var/www/html/copy");
        String result = command.execute();
        if (result != null) {
            s_logger.warn("Error in linking  err=" + result);
            return null;
        }
    }
    return new StartupCommand[] { cmd };
}
Also used : StartupCommand(com.cloud.agent.api.StartupCommand) Script(com.cloud.utils.script.Script) StartupSecondaryStorageCommand(com.cloud.agent.api.StartupSecondaryStorageCommand)

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