Search in sources :

Example 56 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 57 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)

Example 58 with StartupCommand

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

the class KvmDummyResourceBase method initialize.

@Override
public StartupCommand[] initialize() {
    StartupRoutingCommand cmd = new StartupRoutingCommand(0, 0, 0, 0, null, Hypervisor.HypervisorType.KVM, new HashMap<String, String>());
    cmd.setDataCenter(_zoneId);
    cmd.setPod(_podId);
    cmd.setCluster(_clusterId);
    cmd.setGuid(_guid);
    cmd.setName(_agentIp);
    cmd.setPrivateIpAddress(_agentIp);
    cmd.setStorageIpAddress(_agentIp);
    cmd.setVersion(KvmDummyResourceBase.class.getPackage().getImplementationVersion());
    return new StartupCommand[] { cmd };
}
Also used : StartupCommand(com.cloud.agent.api.StartupCommand) StartupRoutingCommand(com.cloud.agent.api.StartupRoutingCommand)

Example 59 with StartupCommand

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

the class LibvirtServerDiscoverer method createHostVOForConnectedAgent.

@Override
public HostVO createHostVOForConnectedAgent(HostVO host, StartupCommand[] cmd) {
    StartupCommand firstCmd = cmd[0];
    if (!(firstCmd instanceof StartupRoutingCommand)) {
        return null;
    }
    StartupRoutingCommand ssCmd = ((StartupRoutingCommand) firstCmd);
    if (ssCmd.getHypervisorType() != getHypervisorType()) {
        return null;
    }
    /* KVM requires host are the same in cluster */
    ClusterVO clusterVO = _clusterDao.findById(host.getClusterId());
    if (clusterVO == null) {
        s_logger.debug("cannot find cluster: " + host.getClusterId());
        throw new IllegalArgumentException("cannot add host, due to can't find cluster: " + host.getClusterId());
    }
    List<HostVO> hostsInCluster = _resourceMgr.listAllHostsInCluster(clusterVO.getId());
    if (!hostsInCluster.isEmpty()) {
        HostVO oneHost = hostsInCluster.get(0);
        _hostDao.loadDetails(oneHost);
        String hostOsInCluster = oneHost.getDetail("Host.OS");
        String hostOs = ssCmd.getHostDetails().get("Host.OS");
        if (!hostOsInCluster.equalsIgnoreCase(hostOs)) {
            throw new IllegalArgumentException("Can't add host: " + firstCmd.getPrivateIpAddress() + " with hostOS: " + hostOs + " into a cluster," + "in which there are " + hostOsInCluster + " hosts added");
        }
    }
    _hostDao.loadDetails(host);
    return _resourceMgr.fillRoutingHostVO(host, ssCmd, getHypervisorType(), host.getDetails(), null);
}
Also used : StartupCommand(com.cloud.agent.api.StartupCommand) ClusterVO(com.cloud.dc.ClusterVO) StartupRoutingCommand(com.cloud.agent.api.StartupRoutingCommand) HostVO(com.cloud.host.HostVO)

Example 60 with StartupCommand

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

the class LocalSecondaryStorageResource method initialize.

@Override
public StartupCommand[] initialize() {
    final StartupStorageCommand cmd = new StartupStorageCommand(_parent, StoragePoolType.Filesystem, 1024l * 1024l * 1024l * 1024l, _dlMgr.gatherTemplateInfo(_parent));
    cmd.setResourceType(Storage.StorageResourceType.LOCAL_SECONDARY_STORAGE);
    cmd.setIqn("local://");
    fillNetworkInformation(cmd);
    cmd.setDataCenter(_dc);
    cmd.setPod(_pod);
    cmd.setGuid(_guid);
    cmd.setName(_guid);
    cmd.setVersion(LocalSecondaryStorageResource.class.getPackage().getImplementationVersion());
    return new StartupCommand[] { cmd };
}
Also used : StartupCommand(com.cloud.agent.api.StartupCommand) StartupStorageCommand(com.cloud.agent.api.StartupStorageCommand)

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