Search in sources :

Example 1 with StartupRoutingCommand

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

the class DummyResource 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 2 with StartupRoutingCommand

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

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)

Example 3 with StartupRoutingCommand

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

the class OvmResourceBase method initialize.

@Override
public StartupCommand[] initialize() {
    try {
        StartupRoutingCommand cmd = new StartupRoutingCommand();
        fillHostInfo(cmd);
        cmd.setCaps("hvm");
        return new StartupCommand[] { cmd };
    } catch (Exception e) {
        s_logger.debug("Ovm resource initializes failed", e);
        return null;
    }
}
Also used : StartupCommand(com.cloud.agent.api.StartupCommand) StartupRoutingCommand(com.cloud.agent.api.StartupRoutingCommand) XmlRpcException(org.apache.xmlrpc.XmlRpcException) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) IOException(java.io.IOException) URISyntaxException(java.net.URISyntaxException) ConfigurationException(javax.naming.ConfigurationException)

Example 4 with StartupRoutingCommand

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

the class DummyResource method initialize.

@Override
public StartupCommand[] initialize() {
    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);
    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) StartupStorageCommand(com.cloud.agent.api.StartupStorageCommand) StoragePoolInfo(com.cloud.agent.api.StoragePoolInfo) StartupRoutingCommand(com.cloud.agent.api.StartupRoutingCommand)

Example 5 with StartupRoutingCommand

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

the class LibvirtComputingResource method initialize.

@Override
public StartupCommand[] initialize() {
    final List<Object> info = getHostInfo();
    _totalMemory = (Long) info.get(2);
    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, RouterPrivateIpStrategy.HostLocal);
    cmd.setCpuSockets((Integer) info.get(5));
    fillNetworkInformation(cmd);
    _privateIp = cmd.getPrivateIpAddress();
    cmd.getHostDetails().putAll(getVersionStrings());
    cmd.setPool(_pool);
    cmd.setCluster(_clusterId);
    cmd.setGatewayIpAddress(_localGateway);
    cmd.setIqn(getIqn());
    StartupStorageCommand sscmd = null;
    try {
        final KVMStoragePool localStoragePool = _storagePoolMgr.createStoragePool(_localStorageUUID, "localhost", -1, _localStoragePath, "", StoragePoolType.Filesystem);
        final com.cloud.agent.api.StoragePoolInfo pi = new com.cloud.agent.api.StoragePoolInfo(localStoragePool.getUuid(), cmd.getPrivateIpAddress(), _localStoragePath, _localStoragePath, StoragePoolType.Filesystem, localStoragePool.getCapacity(), localStoragePool.getAvailable());
        sscmd = new StartupStorageCommand();
        sscmd.setPoolInfo(pi);
        sscmd.setGuid(pi.getUuid());
        sscmd.setDataCenter(_dcId);
        sscmd.setResourceType(Storage.StorageResourceType.STORAGE_POOL);
    } catch (final CloudRuntimeException e) {
        s_logger.debug("Unable to initialize local storage pool: " + e);
    }
    if (sscmd != null) {
        return new StartupCommand[] { cmd, sscmd };
    } else {
        return new StartupCommand[] { cmd };
    }
}
Also used : StartupStorageCommand(com.cloud.agent.api.StartupStorageCommand) StartupCommand(com.cloud.agent.api.StartupCommand) KVMStoragePool(com.cloud.hypervisor.kvm.storage.KVMStoragePool) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) StartupRoutingCommand(com.cloud.agent.api.StartupRoutingCommand)

Aggregations

StartupRoutingCommand (com.cloud.agent.api.StartupRoutingCommand)40 StartupCommand (com.cloud.agent.api.StartupCommand)27 StartupStorageCommand (com.cloud.agent.api.StartupStorageCommand)13 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)9 ClusterVO (com.cloud.dc.ClusterVO)6 AgentUnavailableException (com.cloud.exception.AgentUnavailableException)6 ConnectionException (com.cloud.exception.ConnectionException)6 HostVO (com.cloud.host.HostVO)6 DataCenterVO (com.cloud.dc.DataCenterVO)5 ConfigurationException (javax.naming.ConfigurationException)5 HostPodVO (com.cloud.dc.HostPodVO)4 Command (com.cloud.agent.api.Command)3 Commands (com.cloud.agent.manager.Commands)3 HypervisorType (com.cloud.hypervisor.Hypervisor.HypervisorType)3 PingCommand (com.cloud.agent.api.PingCommand)2 PingRoutingCommand (com.cloud.agent.api.PingRoutingCommand)2 SetupAnswer (com.cloud.agent.api.SetupAnswer)2 SetupCommand (com.cloud.agent.api.SetupCommand)2 StartCommand (com.cloud.agent.api.StartCommand)2 StoragePoolInfo (com.cloud.agent.api.StoragePoolInfo)2