Search in sources :

Example 31 with StartupCommand

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

the class LibvirtComputingResource method initialize.

@Override
public StartupCommand[] initialize() {
    Map<String, State> changes = null;
    synchronized (_vms) {
        _vms.clear();
        changes = sync();
    }
    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);
    cmd.setStateChanges(changes);
    fillNetworkInformation(cmd);
    _privateIp = cmd.getPrivateIpAddress();
    cmd.getHostDetails().putAll(getVersionStrings());
    cmd.setPool(_pool);
    cmd.setCluster(_clusterId);
    cmd.setGatewayIpAddress(_localGateway);
    StartupStorageCommand sscmd = null;
    try {
        KVMStoragePool localStoragePool = _storagePoolMgr.createStoragePool(_localStorageUUID, "localhost", _localStoragePath, StoragePoolType.Filesystem);
        com.cloud.agent.api.StoragePoolInfo pi = new com.cloud.agent.api.StoragePoolInfo(localStoragePool.getUuid(), cmd.getPrivateIpAddress(), _localStoragePath, _localStoragePath, StoragePoolType.Filesystem, localStoragePool.getCapacity(), localStoragePool.getUsed());
        sscmd = new StartupStorageCommand();
        sscmd.setPoolInfo(pi);
        sscmd.setGuid(pi.getUuid());
        sscmd.setDataCenter(_dcId);
        sscmd.setResourceType(Storage.StorageResourceType.STORAGE_POOL);
    } catch (CloudRuntimeException 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.agent.storage.KVMStoragePool) State(com.cloud.vm.VirtualMachine.State) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) StartupRoutingCommand(com.cloud.agent.api.StartupRoutingCommand)

Example 32 with StartupCommand

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

the class NuageVspResource method initialize.

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

Example 33 with StartupCommand

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

the class OpenDaylightControllerResource method initialize.

@Override
public StartupCommand[] initialize() {
    StartupOpenDaylightControllerCommand sc = new StartupOpenDaylightControllerCommand();
    sc.setGuid((String) configuration.get("guid"));
    sc.setName(getName());
    sc.setDataCenter((String) configuration.get("zoneId"));
    sc.setPod("");
    sc.setPrivateIpAddress("");
    sc.setStorageIpAddress("");
    sc.setVersion(OpenDaylightControllerResource.class.getPackage().getImplementationVersion());
    return new StartupCommand[] { sc };
}
Also used : StartupOpenDaylightControllerCommand(org.apache.cloudstack.network.opendaylight.agent.commands.StartupOpenDaylightControllerCommand) StartupCommand(com.cloud.agent.api.StartupCommand)

Example 34 with StartupCommand

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

the class BaremetalDhcpResourceBase method initialize.

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

Example 35 with StartupCommand

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

the class Ovm3HypervisorResourceTest method initializeTest.

/* gives an IOException on ssh */
@Test
public void initializeTest() throws Exception {
    Ovm3Configuration config = new Ovm3Configuration(configTest.getParams());
    con = support.prepConnectionResults();
    hypervisor.setConnection(con);
    results.basicBooleanTest(hypervisor.configure(config.getAgentName(), configTest.getParams()));
    con.setIp(config.getAgentIp());
    for (StartupCommand start : hypervisor.initialize()) {
        assertNotNull(start);
    }
}
Also used : StartupCommand(com.cloud.agent.api.StartupCommand) Ovm3Configuration(com.cloud.hypervisor.ovm3.resources.helpers.Ovm3Configuration) ConnectionTest(com.cloud.hypervisor.ovm3.objects.ConnectionTest) Test(org.junit.Test) CloudStackPluginTest(com.cloud.hypervisor.ovm3.objects.CloudStackPluginTest) NetworkTest(com.cloud.hypervisor.ovm3.objects.NetworkTest) XenTest(com.cloud.hypervisor.ovm3.objects.XenTest) Ovm3SupportTest(com.cloud.hypervisor.ovm3.support.Ovm3SupportTest) XmlTestResultTest(com.cloud.hypervisor.ovm3.objects.XmlTestResultTest) Ovm3ConfigurationTest(com.cloud.hypervisor.ovm3.resources.helpers.Ovm3ConfigurationTest)

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