Search in sources :

Example 26 with StartupCommand

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

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

the class FakeComputingResource method initialize.

@Override
public StartupCommand[] initialize() {
    Map<String, VmState> changes = null;
    final List<Object> info = getHostInfo();
    final StartupRoutingCommand cmd = new StartupRoutingCommand((Integer) info.get(0), (Long) info.get(1), (Long) info.get(2), (Long) info.get(4), (String) info.get(3), HypervisorType.KVM, RouterPrivateIpStrategy.HostLocal, changes);
    fillNetworkInformation(cmd);
    cmd.getHostDetails().putAll(getVersionStrings());
    cmd.setCluster(getConfiguredProperty("cluster", "1"));
    StoragePoolInfo pi = initializeLocalStorage();
    StartupStorageCommand sscmd = new StartupStorageCommand();
    sscmd.setPoolInfo(pi);
    sscmd.setGuid(pi.getUuid());
    sscmd.setDataCenter((String) _params.get("zone"));
    sscmd.setResourceType(Storage.StorageResourceType.STORAGE_POOL);
    return new StartupCommand[] { cmd, sscmd };
}
Also used : StartupCommand(com.cloud.agent.api.StartupCommand) VmState(com.cloud.agent.api.StartupRoutingCommand.VmState) StartupStorageCommand(com.cloud.agent.api.StartupStorageCommand) StoragePoolInfo(com.cloud.agent.api.StoragePoolInfo) StartupRoutingCommand(com.cloud.agent.api.StartupRoutingCommand)

Example 28 with StartupCommand

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

the class AgentRoutingResource method initialize.

@Override
public StartupCommand[] initialize() {
    synchronized (_vms) {
        _vms.clear();
    }
    Map<String, State> changes = _simMgr.getVmStates(this.hostGuid);
    Map<String, MockVMVO> vmsMaps = _simMgr.getVms(this.hostGuid);
    totalCpu = agentHost.getCpuCount() * agentHost.getCpuSpeed();
    totalMem = agentHost.getMemorySize();
    for (Map.Entry<String, MockVMVO> entry : vmsMaps.entrySet()) {
        MockVMVO vm = entry.getValue();
        usedCpu += vm.getCpu();
        usedMem += vm.getMemory();
        _runningVms.put(entry.getKey(), new Pair<Long, Long>(Long.valueOf(vm.getCpu()), vm.getMemory()));
    }
    List<Object> info = getHostInfo();
    StartupRoutingCommand cmd = new StartupRoutingCommand((Integer) info.get(0), (Long) info.get(1), (Long) info.get(2), (Long) info.get(4), (String) info.get(3), HypervisorType.Simulator, RouterPrivateIpStrategy.HostLocal);
    cmd.setStateChanges(changes);
    Map<String, String> hostDetails = new HashMap<String, String>();
    hostDetails.put(RouterPrivateIpStrategy.class.getCanonicalName(), RouterPrivateIpStrategy.DcGlobal.toString());
    cmd.setHostDetails(hostDetails);
    cmd.setAgentTag("agent-simulator");
    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.setStorageIpAddressDeux(agentHost.getStorageIpAddress());
    cmd.setStorageNetmaskDeux(agentHost.getStorageNetMask());
    cmd.setStorageMacAddressDeux(agentHost.getStorageIpAddress());
    cmd.setName(agentHost.getName());
    cmd.setGuid(agentHost.getGuid());
    cmd.setVersion(agentHost.getVersion());
    cmd.setAgentTag("agent-simulator");
    cmd.setDataCenter(String.valueOf(agentHost.getDataCenterId()));
    cmd.setPod(String.valueOf(agentHost.getPodId()));
    cmd.setCluster(String.valueOf(agentHost.getClusterId()));
    StartupStorageCommand ssCmd = initializeLocalSR();
    return new StartupCommand[] { cmd, ssCmd };
}
Also used : HashMap(java.util.HashMap) StartupStorageCommand(com.cloud.agent.api.StartupStorageCommand) RouterPrivateIpStrategy(com.cloud.network.Networks.RouterPrivateIpStrategy) MockVMVO(com.cloud.simulator.MockVMVO) StartupCommand(com.cloud.agent.api.StartupCommand) State(com.cloud.vm.VirtualMachine.State) StartupRoutingCommand(com.cloud.agent.api.StartupRoutingCommand) HashMap(java.util.HashMap) Map(java.util.Map)

Example 29 with StartupCommand

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

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

the class Agent method sendStartup.

public void sendStartup(Link link) {
    final StartupCommand[] startup = _resource.initialize();
    final Command[] commands = new Command[startup.length];
    for (int i = 0; i < startup.length; i++) {
        setupStartupCommand(startup[i]);
        commands[i] = startup[i];
    }
    final Request request = new Request(_id != null ? _id : -1, -1, commands, false, false);
    request.setSequence(getNextSequence());
    if (s_logger.isDebugEnabled()) {
        s_logger.debug("Sending Startup: " + request.toString());
    }
    synchronized (this) {
        _startup = new StartupTask(link);
        _timer.schedule(_startup, _startupWait);
    }
    try {
        link.send(request.toBytes());
    } catch (final ClosedChannelException e) {
        s_logger.warn("Unable to send reques: " + request.toString());
    }
}
Also used : StartupCommand(com.cloud.agent.api.StartupCommand) ClosedChannelException(java.nio.channels.ClosedChannelException) MaintainCommand(com.cloud.agent.api.MaintainCommand) StartupCommand(com.cloud.agent.api.StartupCommand) AgentControlCommand(com.cloud.agent.api.AgentControlCommand) ShutdownCommand(com.cloud.agent.api.ShutdownCommand) Command(com.cloud.agent.api.Command) PingCommand(com.cloud.agent.api.PingCommand) ModifySshKeysCommand(com.cloud.agent.api.ModifySshKeysCommand) UpgradeCommand(com.cloud.agent.api.UpgradeCommand) CronCommand(com.cloud.agent.api.CronCommand) Request(com.cloud.agent.transport.Request)

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