Search in sources :

Example 16 with StartupCommand

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

Example 17 with StartupCommand

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

the class TrafficSentinelResource method initialize.

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

Example 18 with StartupCommand

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

the class DummySecondaryStorageResource method initialize.

@Override
public StartupCommand[] initialize() {
    final StartupStorageCommand cmd = new StartupStorageCommand("dummy", StoragePoolType.NetworkFilesystem, 1024 * 1024 * 1024 * 100L, new HashMap<String, TemplateProp>());
    cmd.setResourceType(Storage.StorageResourceType.SECONDARY_STORAGE);
    cmd.setIqn(null);
    cmd.setNfsShare(_guid);
    fillNetworkInformation(cmd);
    cmd.setDataCenter(_dc);
    cmd.setPod(_pod);
    cmd.setGuid(_guid);
    cmd.setName(_guid);
    cmd.setVersion(DummySecondaryStorageResource.class.getPackage().getImplementationVersion());
    /* gather TemplateInfo in second storage */
    cmd.setTemplateInfo(getDefaultSystemVmTemplateInfo());
    cmd.getHostDetails().put("mount.parent", "dummy");
    cmd.getHostDetails().put("mount.path", "dummy");
    cmd.getHostDetails().put("orig.url", _guid);
    String[] tok = _dummyPath.split(":");
    cmd.setPrivateIpAddress(tok[0]);
    return new StartupCommand[] { cmd };
}
Also used : TemplateProp(com.cloud.storage.template.TemplateProp) StartupCommand(com.cloud.agent.api.StartupCommand) StartupStorageCommand(com.cloud.agent.api.StartupStorageCommand)

Example 19 with StartupCommand

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

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

the class CiscoVnmcResource 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(CiscoVnmcResource.class.getPackage().getImplementationVersion());
    cmd.setGuid(_guid);
    return new StartupCommand[] { cmd };
}
Also used : StartupCommand(com.cloud.agent.api.StartupCommand) StartupExternalFirewallCommand(com.cloud.agent.api.StartupExternalFirewallCommand)

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