Search in sources :

Example 51 with StartupCommand

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

the class HypervDirectConnectResourceTest method testStartupCommand.

public final void testStartupCommand() {
    StartupRoutingCommand defaultStartRoutCmd = new StartupRoutingCommand(0, 0, 0, 0, null, Hypervisor.HypervisorType.Hyperv, RouterPrivateIpStrategy.HostLocal);
    // Identity within the data centre is decided by CloudStack kernel,
    // and passed via ServerResource.configure()
    defaultStartRoutCmd.setDataCenter("1");
    defaultStartRoutCmd.setPod("1");
    defaultStartRoutCmd.setCluster("1");
    defaultStartRoutCmd.setGuid("1");
    defaultStartRoutCmd.setName("1");
    defaultStartRoutCmd.setPrivateIpAddress("1");
    defaultStartRoutCmd.setStorageIpAddress("1");
    defaultStartRoutCmd.setCpus(12);
    // TODO: does version need to be hard coded.
    defaultStartRoutCmd.setVersion("4.2.0");
    StartupCommand scmd = defaultStartRoutCmd;
    Command[] cmds = { scmd };
    String cmdsStr = s_gson.toJson(cmds);
    s_logger.debug("Commands[] toJson is " + cmdsStr);
    Command[] result = s_gson.fromJson(cmdsStr, Command[].class);
    s_logger.debug("Commands[] fromJson is " + s_gson.toJson(result));
    s_logger.debug("Commands[] first element has type" + result[0].toString());
}
Also used : StartupCommand(com.cloud.agent.api.StartupCommand) DeleteStoragePoolCommand(com.cloud.agent.api.DeleteStoragePoolCommand) StartCommand(com.cloud.agent.api.StartCommand) StartupStorageCommand(com.cloud.agent.api.StartupStorageCommand) PrimaryStorageDownloadCommand(com.cloud.agent.api.storage.PrimaryStorageDownloadCommand) StartupCommand(com.cloud.agent.api.StartupCommand) GetVmStatsCommand(com.cloud.agent.api.GetVmStatsCommand) StopCommand(com.cloud.agent.api.StopCommand) CreateCommand(com.cloud.agent.api.storage.CreateCommand) DestroyCommand(com.cloud.agent.api.storage.DestroyCommand) GetStorageStatsCommand(com.cloud.agent.api.GetStorageStatsCommand) StartupRoutingCommand(com.cloud.agent.api.StartupRoutingCommand) CreateStoragePoolCommand(com.cloud.agent.api.CreateStoragePoolCommand) Command(com.cloud.agent.api.Command) GetHostStatsCommand(com.cloud.agent.api.GetHostStatsCommand) ModifyStoragePoolCommand(com.cloud.agent.api.ModifyStoragePoolCommand) StartupRoutingCommand(com.cloud.agent.api.StartupRoutingCommand)

Example 52 with StartupCommand

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

the class VmwareServerDiscoverer 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.VMware) {
        return null;
    }
    return _resourceMgr.fillRoutingHostVO(host, ssCmd, HypervisorType.VMware, details, hostTags);
}
Also used : StartupCommand(com.cloud.agent.api.StartupCommand) StartupRoutingCommand(com.cloud.agent.api.StartupRoutingCommand)

Example 53 with StartupCommand

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

the class BrocadeVcsResource method initialize.

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

Example 54 with StartupCommand

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

the class NetscalerResource method initialize.

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

Example 55 with StartupCommand

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

the class Ovm3HypervisorResource method initialize.

/*
     * configure is called before this, does setup of the connection and
     * gets the params.
     *
     * @see com.cloud.resource.ServerResource#initialize()
     */
@Override
public StartupCommand[] initialize() {
    LOGGER.debug("Ovm3 resource intializing");
    try {
        StartupRoutingCommand srCmd = new StartupRoutingCommand();
        StartupStorageCommand ssCmd = new StartupStorageCommand();
        /* here stuff gets completed, but where should state live ? */
        hypervisorsupport.fillHostInfo(srCmd);
        hypervisorsupport.vmStateMapClear();
        LOGGER.debug("Ovm3 pool " + ssCmd + " " + srCmd);
        return new StartupCommand[] { srCmd, ssCmd };
    } catch (Exception e) {
        LOGGER.debug("Ovm3 resource initializes failed", e);
        return new StartupCommand[] {};
    }
}
Also used : StartupCommand(com.cloud.agent.api.StartupCommand) StartupStorageCommand(com.cloud.agent.api.StartupStorageCommand) StartupRoutingCommand(com.cloud.agent.api.StartupRoutingCommand) ConfigurationException(javax.naming.ConfigurationException) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) Ovm3ResourceException(com.cloud.hypervisor.ovm3.objects.Ovm3ResourceException)

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