Search in sources :

Example 1 with Command

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

the class Agent method processRequest.

protected void processRequest(final Request request, final Link link) {
    boolean requestLogged = false;
    Response response = null;
    try {
        final Command[] cmds = request.getCommands();
        final Answer[] answers = new Answer[cmds.length];
        for (int i = 0; i < cmds.length; i++) {
            final Command cmd = cmds[i];
            Answer answer;
            try {
                if (s_logger.isDebugEnabled()) {
                    // this is a hack to make sure we do NOT log the ssh keys
                    if ((cmd instanceof ModifySshKeysCommand)) {
                        s_logger.debug("Received the request for command: ModifySshKeysCommand");
                    } else {
                        if (// ensures request is logged only once per method call
                        !requestLogged) {
                            s_logger.debug("Request:" + request.toString());
                            requestLogged = true;
                        }
                    }
                    s_logger.debug("Processing command: " + cmd.toString());
                }
                if (cmd instanceof CronCommand) {
                    final CronCommand watch = (CronCommand) cmd;
                    scheduleWatch(link, request, watch.getInterval() * 1000, watch.getInterval() * 1000);
                    answer = new Answer(cmd, true, null);
                } else if (cmd instanceof UpgradeCommand) {
                    final UpgradeCommand upgrade = (UpgradeCommand) cmd;
                    answer = upgradeAgent(upgrade.getUpgradeUrl(), upgrade);
                } else if (cmd instanceof ShutdownCommand) {
                    ShutdownCommand shutdown = (ShutdownCommand) cmd;
                    s_logger.debug("Received shutdownCommand, due to: " + shutdown.getReason());
                    cancelTasks();
                    _reconnectAllowed = false;
                    answer = new Answer(cmd, true, null);
                } else if (cmd instanceof MaintainCommand) {
                    s_logger.debug("Received maintainCommand");
                    cancelTasks();
                    _reconnectAllowed = false;
                    answer = new MaintainAnswer((MaintainCommand) cmd);
                } else if (cmd instanceof AgentControlCommand) {
                    answer = null;
                    synchronized (_controlListeners) {
                        for (IAgentControlListener listener : _controlListeners) {
                            answer = listener.processControlRequest(request, (AgentControlCommand) cmd);
                            if (answer != null) {
                                break;
                            }
                        }
                    }
                    if (answer == null) {
                        s_logger.warn("No handler found to process cmd: " + cmd.toString());
                        answer = new AgentControlAnswer(cmd);
                    }
                } else {
                    _inProgress.incrementAndGet();
                    try {
                        answer = _resource.executeRequest(cmd);
                    } finally {
                        _inProgress.decrementAndGet();
                    }
                    if (answer == null) {
                        s_logger.debug("Response: unsupported command" + cmd.toString());
                        answer = Answer.createUnsupportedCommandAnswer(cmd);
                    }
                }
            } catch (final Throwable th) {
                s_logger.warn("Caught: ", th);
                final StringWriter writer = new StringWriter();
                th.printStackTrace(new PrintWriter(writer));
                answer = new Answer(cmd, false, writer.toString());
            }
            answers[i] = answer;
            if (!answer.getResult() && request.stopOnError()) {
                for (i++; i < cmds.length; i++) {
                    answers[i] = new Answer(cmds[i], false, "Stopped by previous failure");
                }
                break;
            }
        }
        response = new Response(request, answers);
    } finally {
        if (s_logger.isDebugEnabled()) {
            s_logger.debug(response != null ? response.toString() : "response is null");
        }
        if (response != null) {
            try {
                link.send(response.toBytes());
            } catch (final ClosedChannelException e) {
                s_logger.warn("Unable to send response: " + response.toString());
            }
        }
    }
}
Also used : MaintainCommand(com.cloud.agent.api.MaintainCommand) ClosedChannelException(java.nio.channels.ClosedChannelException) UpgradeCommand(com.cloud.agent.api.UpgradeCommand) MaintainAnswer(com.cloud.agent.api.MaintainAnswer) CronCommand(com.cloud.agent.api.CronCommand) AgentControlAnswer(com.cloud.agent.api.AgentControlAnswer) ShutdownCommand(com.cloud.agent.api.ShutdownCommand) Response(com.cloud.agent.transport.Response) UpgradeAnswer(com.cloud.agent.api.UpgradeAnswer) StartupAnswer(com.cloud.agent.api.StartupAnswer) AgentControlAnswer(com.cloud.agent.api.AgentControlAnswer) Answer(com.cloud.agent.api.Answer) MaintainAnswer(com.cloud.agent.api.MaintainAnswer) AgentControlCommand(com.cloud.agent.api.AgentControlCommand) StringWriter(java.io.StringWriter) MaintainCommand(com.cloud.agent.api.MaintainCommand) StartupCommand(com.cloud.agent.api.StartupCommand) AgentControlCommand(com.cloud.agent.api.AgentControlCommand) ShutdownCommand(com.cloud.agent.api.ShutdownCommand) Command(com.cloud.agent.api.Command) PingCommand(com.cloud.agent.api.PingCommand) ModifySshKeysCommand(com.cloud.agent.api.ModifySshKeysCommand) UpgradeCommand(com.cloud.agent.api.UpgradeCommand) CronCommand(com.cloud.agent.api.CronCommand) ModifySshKeysCommand(com.cloud.agent.api.ModifySshKeysCommand) PrintWriter(java.io.PrintWriter)

Example 2 with Command

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

the class ResourceManagerImpl method propagateResourceEvent.

public Boolean propagateResourceEvent(final long agentId, final ResourceState.Event event) throws AgentUnavailableException {
    final String msPeer = getPeerName(agentId);
    if (msPeer == null) {
        return null;
    }
    if (s_logger.isDebugEnabled()) {
        s_logger.debug("Propagating agent change request event:" + event.toString() + " to agent:" + agentId);
    }
    final Command[] cmds = new Command[1];
    cmds[0] = new PropagateResourceEventCommand(agentId, event);
    final String AnsStr = _clusterMgr.execute(msPeer, agentId, _gson.toJson(cmds), true);
    if (AnsStr == null) {
        throw new AgentUnavailableException(agentId);
    }
    final Answer[] answers = _gson.fromJson(AnsStr, Answer[].class);
    if (s_logger.isDebugEnabled()) {
        s_logger.debug("Result for agent change is " + answers[0].getResult());
    }
    return answers[0].getResult();
}
Also used : UnsupportedAnswer(com.cloud.agent.api.UnsupportedAnswer) GetGPUStatsAnswer(com.cloud.agent.api.GetGPUStatsAnswer) MaintainAnswer(com.cloud.agent.api.MaintainAnswer) GetHostStatsAnswer(com.cloud.agent.api.GetHostStatsAnswer) Answer(com.cloud.agent.api.Answer) PropagateResourceEventCommand(com.cloud.agent.api.PropagateResourceEventCommand) MaintainCommand(com.cloud.agent.api.MaintainCommand) StartupRoutingCommand(com.cloud.agent.api.StartupRoutingCommand) Command(com.cloud.agent.api.Command) StartupCommand(com.cloud.agent.api.StartupCommand) PropagateResourceEventCommand(com.cloud.agent.api.PropagateResourceEventCommand) GetGPUStatsCommand(com.cloud.agent.api.GetGPUStatsCommand) UpdateHostPasswordCommand(com.cloud.agent.api.UpdateHostPasswordCommand) GetHostStatsCommand(com.cloud.agent.api.GetHostStatsCommand) AgentUnavailableException(com.cloud.exception.AgentUnavailableException)

Example 3 with Command

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

the class VMwareGuru method finalizeExpungeNics.

@Override
public List<Command> finalizeExpungeNics(VirtualMachine vm, List<NicProfile> nics) {
    List<Command> commands = new ArrayList<Command>();
    List<NicVO> nicVOs = _nicDao.listByVmId(vm.getId());
    for (NicVO nic : nicVOs) {
        NetworkVO network = _networkDao.findById(nic.getNetworkId());
        if (network.getBroadcastDomainType() == BroadcastDomainType.Lswitch) {
            s_logger.debug("Nic " + nic.toString() + " is connected to an lswitch, cleanup required");
            NetworkVO networkVO = _networkDao.findById(nic.getNetworkId());
            // We need the traffic label to figure out which vSwitch has the
            // portgroup
            PhysicalNetworkTrafficTypeVO trafficTypeVO = _physicalNetworkTrafficTypeDao.findBy(networkVO.getPhysicalNetworkId(), networkVO.getTrafficType());
            UnregisterNicCommand unregisterNicCommand = new UnregisterNicCommand(vm.getInstanceName(), trafficTypeVO.getVmwareNetworkLabel(), UUID.fromString(nic.getUuid()));
            commands.add(unregisterNicCommand);
        }
    }
    return commands;
}
Also used : UnregisterNicCommand(com.cloud.agent.api.UnregisterNicCommand) NetworkVO(com.cloud.network.dao.NetworkVO) DeleteCommand(org.apache.cloudstack.storage.command.DeleteCommand) BackupSnapshotCommand(com.cloud.agent.api.BackupSnapshotCommand) CreateVolumeOVACommand(com.cloud.agent.api.storage.CreateVolumeOVACommand) CreatePrivateTemplateFromSnapshotCommand(com.cloud.agent.api.CreatePrivateTemplateFromSnapshotCommand) PrepareOVAPackingCommand(com.cloud.agent.api.storage.PrepareOVAPackingCommand) CopyCommand(org.apache.cloudstack.storage.command.CopyCommand) UnregisterNicCommand(com.cloud.agent.api.UnregisterNicCommand) CopyVolumeCommand(com.cloud.agent.api.storage.CopyVolumeCommand) StorageSubSystemCommand(org.apache.cloudstack.storage.command.StorageSubSystemCommand) CreateVolumeFromSnapshotCommand(com.cloud.agent.api.CreateVolumeFromSnapshotCommand) CreateEntityDownloadURLCommand(com.cloud.agent.api.storage.CreateEntityDownloadURLCommand) Command(com.cloud.agent.api.Command) CreatePrivateTemplateFromVolumeCommand(com.cloud.agent.api.CreatePrivateTemplateFromVolumeCommand) ArrayList(java.util.ArrayList) PhysicalNetworkTrafficTypeVO(com.cloud.network.dao.PhysicalNetworkTrafficTypeVO) NicVO(com.cloud.vm.NicVO)

Example 4 with Command

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

the class VpcVirtualNetworkApplianceManagerImpl method finalizeCommandsOnStart.

@Override
public boolean finalizeCommandsOnStart(final Commands cmds, final VirtualMachineProfile profile) {
    final DomainRouterVO domainRouterVO = _routerDao.findById(profile.getId());
    Map<String, String> details = new HashMap<String, String>();
    if (profile.getHypervisorType() == Hypervisor.HypervisorType.VMware) {
        HypervisorGuru hvGuru = _hvGuruMgr.getGuru(profile.getHypervisorType());
        VirtualMachineTO vmTO = hvGuru.implement(profile);
        if (vmTO.getDetails() != null) {
            details = vmTO.getDetails();
        }
    }
    final boolean isVpc = domainRouterVO.getVpcId() != null;
    if (!isVpc) {
        return super.finalizeCommandsOnStart(cmds, profile);
    }
    if (domainRouterVO.getState() == State.Starting || domainRouterVO.getState() == State.Running) {
        // 1) FORM SSH CHECK COMMAND
        final NicProfile controlNic = getControlNic(profile);
        if (controlNic == null) {
            s_logger.error("Control network doesn't exist for the router " + domainRouterVO);
            return false;
        }
        finalizeSshAndVersionAndNetworkUsageOnStart(cmds, profile, domainRouterVO, controlNic);
        // 2) FORM PLUG NIC COMMANDS
        final List<Pair<Nic, Network>> guestNics = new ArrayList<Pair<Nic, Network>>();
        final List<Pair<Nic, Network>> publicNics = new ArrayList<Pair<Nic, Network>>();
        final Map<String, String> vlanMacAddress = new HashMap<String, String>();
        final List<? extends Nic> routerNics = _nicDao.listByVmId(profile.getId());
        for (final Nic routerNic : routerNics) {
            final Network network = _networkModel.getNetwork(routerNic.getNetworkId());
            if (network.getTrafficType() == TrafficType.Guest) {
                final Pair<Nic, Network> guestNic = new Pair<Nic, Network>(routerNic, network);
                guestNics.add(guestNic);
            } else if (network.getTrafficType() == TrafficType.Public) {
                final Pair<Nic, Network> publicNic = new Pair<Nic, Network>(routerNic, network);
                publicNics.add(publicNic);
                final String vlanTag = BroadcastDomainType.getValue(routerNic.getBroadcastUri());
                vlanMacAddress.put(vlanTag, routerNic.getMacAddress());
            }
        }
        final List<Command> usageCmds = new ArrayList<Command>();
        // 3) PREPARE PLUG NIC COMMANDS
        try {
            // add VPC router to public networks
            final List<PublicIp> sourceNat = new ArrayList<PublicIp>(1);
            for (final Pair<Nic, Network> nicNtwk : publicNics) {
                final Nic publicNic = nicNtwk.first();
                final Network publicNtwk = nicNtwk.second();
                final IPAddressVO userIp = _ipAddressDao.findByIpAndSourceNetworkId(publicNtwk.getId(), publicNic.getIPv4Address());
                if (userIp.isSourceNat()) {
                    final PublicIp publicIp = PublicIp.createFromAddrAndVlan(userIp, _vlanDao.findById(userIp.getVlanId()));
                    sourceNat.add(publicIp);
                    if (domainRouterVO.getPublicIpAddress() == null) {
                        final DomainRouterVO routerVO = _routerDao.findById(domainRouterVO.getId());
                        routerVO.setPublicIpAddress(publicNic.getIPv4Address());
                        routerVO.setPublicNetmask(publicNic.getIPv4Netmask());
                        routerVO.setPublicMacAddress(publicNic.getMacAddress());
                        _routerDao.update(routerVO.getId(), routerVO);
                    }
                }
                final PlugNicCommand plugNicCmd = new PlugNicCommand(_nwHelper.getNicTO(domainRouterVO, publicNic.getNetworkId(), publicNic.getBroadcastUri().toString()), domainRouterVO.getInstanceName(), domainRouterVO.getType(), details);
                cmds.addCommand(plugNicCmd);
                final VpcVO vpc = _vpcDao.findById(domainRouterVO.getVpcId());
                final NetworkUsageCommand netUsageCmd = new NetworkUsageCommand(domainRouterVO.getPrivateIpAddress(), domainRouterVO.getInstanceName(), true, publicNic.getIPv4Address(), vpc.getCidr());
                usageCmds.add(netUsageCmd);
                UserStatisticsVO stats = _userStatsDao.findBy(domainRouterVO.getAccountId(), domainRouterVO.getDataCenterId(), publicNtwk.getId(), publicNic.getIPv4Address(), domainRouterVO.getId(), domainRouterVO.getType().toString());
                if (stats == null) {
                    stats = new UserStatisticsVO(domainRouterVO.getAccountId(), domainRouterVO.getDataCenterId(), publicNic.getIPv4Address(), domainRouterVO.getId(), domainRouterVO.getType().toString(), publicNtwk.getId());
                    _userStatsDao.persist(stats);
                }
            }
            // create ip assoc for source nat
            if (!sourceNat.isEmpty()) {
                _commandSetupHelper.createVpcAssociatePublicIPCommands(domainRouterVO, sourceNat, cmds, vlanMacAddress);
            }
            // add VPC router to guest networks
            for (final Pair<Nic, Network> nicNtwk : guestNics) {
                final Nic guestNic = nicNtwk.first();
                // plug guest nic
                final PlugNicCommand plugNicCmd = new PlugNicCommand(_nwHelper.getNicTO(domainRouterVO, guestNic.getNetworkId(), null), domainRouterVO.getInstanceName(), domainRouterVO.getType(), details);
                cmds.addCommand(plugNicCmd);
                if (!_networkModel.isPrivateGateway(guestNic.getNetworkId())) {
                    // set guest network
                    final VirtualMachine vm = _vmDao.findById(domainRouterVO.getId());
                    final NicProfile nicProfile = _networkModel.getNicProfile(vm, guestNic.getNetworkId(), null);
                    final SetupGuestNetworkCommand setupCmd = _commandSetupHelper.createSetupGuestNetworkCommand(domainRouterVO, true, nicProfile);
                    cmds.addCommand(setupCmd);
                } else {
                    // set private network
                    final PrivateIpVO ipVO = _privateIpDao.findByIpAndSourceNetworkId(guestNic.getNetworkId(), guestNic.getIPv4Address());
                    final Network network = _networkDao.findById(guestNic.getNetworkId());
                    BroadcastDomainType.getValue(network.getBroadcastUri());
                    final String netmask = NetUtils.getCidrNetmask(network.getCidr());
                    final PrivateIpAddress ip = new PrivateIpAddress(ipVO, network.getBroadcastUri().toString(), network.getGateway(), netmask, guestNic.getMacAddress());
                    final List<PrivateIpAddress> privateIps = new ArrayList<PrivateIpAddress>(1);
                    privateIps.add(ip);
                    _commandSetupHelper.createVpcAssociatePrivateIPCommands(domainRouterVO, privateIps, cmds, true);
                    final Long privateGwAclId = _vpcGatewayDao.getNetworkAclIdForPrivateIp(ipVO.getVpcId(), ipVO.getNetworkId(), ipVO.getIpAddress());
                    if (privateGwAclId != null) {
                        // set network acl on private gateway
                        final List<NetworkACLItemVO> networkACLs = _networkACLItemDao.listByACL(privateGwAclId);
                        s_logger.debug("Found " + networkACLs.size() + " network ACLs to apply as a part of VPC VR " + domainRouterVO + " start for private gateway ip = " + ipVO.getIpAddress());
                        _commandSetupHelper.createNetworkACLsCommands(networkACLs, domainRouterVO, cmds, ipVO.getNetworkId(), true);
                    }
                }
            }
        } catch (final Exception ex) {
            s_logger.warn("Failed to add router " + domainRouterVO + " to network due to exception ", ex);
            return false;
        }
        // 4) RE-APPLY ALL STATIC ROUTE RULES
        final List<? extends StaticRoute> routes = _staticRouteDao.listByVpcId(domainRouterVO.getVpcId());
        final List<StaticRouteProfile> staticRouteProfiles = new ArrayList<StaticRouteProfile>(routes.size());
        final Map<Long, VpcGateway> gatewayMap = new HashMap<Long, VpcGateway>();
        for (final StaticRoute route : routes) {
            VpcGateway gateway = gatewayMap.get(route.getVpcGatewayId());
            if (gateway == null) {
                gateway = _entityMgr.findById(VpcGateway.class, route.getVpcGatewayId());
                gatewayMap.put(gateway.getId(), gateway);
            }
            staticRouteProfiles.add(new StaticRouteProfile(route, gateway));
        }
        s_logger.debug("Found " + staticRouteProfiles.size() + " static routes to apply as a part of vpc route " + domainRouterVO + " start");
        if (!staticRouteProfiles.isEmpty()) {
            _commandSetupHelper.createStaticRouteCommands(staticRouteProfiles, domainRouterVO, cmds);
        }
        // 5) RE-APPLY ALL REMOTE ACCESS VPNs
        final RemoteAccessVpnVO vpn = _vpnDao.findByAccountAndVpc(domainRouterVO.getAccountId(), domainRouterVO.getVpcId());
        if (vpn != null) {
            _commandSetupHelper.createApplyVpnCommands(true, vpn, domainRouterVO, cmds);
        }
        // 6) REPROGRAM GUEST NETWORK
        boolean reprogramGuestNtwks = true;
        if (profile.getParameter(Param.ReProgramGuestNetworks) != null && (Boolean) profile.getParameter(Param.ReProgramGuestNetworks) == false) {
            reprogramGuestNtwks = false;
        }
        final VirtualRouterProvider vrProvider = _vrProviderDao.findById(domainRouterVO.getElementId());
        if (vrProvider == null) {
            throw new CloudRuntimeException("Cannot find related virtual router provider of router: " + domainRouterVO.getHostName());
        }
        final Provider provider = Network.Provider.getProvider(vrProvider.getType().toString());
        if (provider == null) {
            throw new CloudRuntimeException("Cannot find related provider of virtual router provider: " + vrProvider.getType().toString());
        }
        for (final Pair<Nic, Network> nicNtwk : guestNics) {
            final Nic guestNic = nicNtwk.first();
            final AggregationControlCommand startCmd = new AggregationControlCommand(Action.Start, domainRouterVO.getInstanceName(), controlNic.getIPv4Address(), _routerControlHelper.getRouterIpInNetwork(guestNic.getNetworkId(), domainRouterVO.getId()));
            cmds.addCommand(startCmd);
            if (reprogramGuestNtwks) {
                finalizeIpAssocForNetwork(cmds, domainRouterVO, provider, guestNic.getNetworkId(), vlanMacAddress);
                finalizeNetworkRulesForNetwork(cmds, domainRouterVO, provider, guestNic.getNetworkId());
            }
            finalizeUserDataAndDhcpOnStart(cmds, domainRouterVO, provider, guestNic.getNetworkId());
            final AggregationControlCommand finishCmd = new AggregationControlCommand(Action.Finish, domainRouterVO.getInstanceName(), controlNic.getIPv4Address(), _routerControlHelper.getRouterIpInNetwork(guestNic.getNetworkId(), domainRouterVO.getId()));
            cmds.addCommand(finishCmd);
        }
        // Add network usage commands
        cmds.addCommands(usageCmds);
    }
    return true;
}
Also used : RemoteAccessVpnVO(com.cloud.network.dao.RemoteAccessVpnVO) PrivateIpAddress(com.cloud.network.vpc.PrivateIpAddress) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) PrivateIpVO(com.cloud.network.vpc.PrivateIpVO) VirtualMachineTO(com.cloud.agent.api.to.VirtualMachineTO) NetworkACLItemVO(com.cloud.network.vpc.NetworkACLItemVO) HypervisorGuru(com.cloud.hypervisor.HypervisorGuru) StaticRouteProfile(com.cloud.network.vpc.StaticRouteProfile) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) Network(com.cloud.network.Network) AggregationControlCommand(com.cloud.agent.api.routing.AggregationControlCommand) VpcGateway(com.cloud.network.vpc.VpcGateway) PlugNicCommand(com.cloud.agent.api.PlugNicCommand) Pair(com.cloud.utils.Pair) StaticRoute(com.cloud.network.vpc.StaticRoute) PublicIp(com.cloud.network.addr.PublicIp) Nic(com.cloud.vm.Nic) NetworkUsageCommand(com.cloud.agent.api.NetworkUsageCommand) NicProfile(com.cloud.vm.NicProfile) AgentUnavailableException(com.cloud.exception.AgentUnavailableException) OperationTimedoutException(com.cloud.exception.OperationTimedoutException) ConcurrentOperationException(com.cloud.exception.ConcurrentOperationException) InsufficientCapacityException(com.cloud.exception.InsufficientCapacityException) ResourceUnavailableException(com.cloud.exception.ResourceUnavailableException) ConfigurationException(javax.naming.ConfigurationException) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) VirtualRouterProvider(com.cloud.network.VirtualRouterProvider) Provider(com.cloud.network.Network.Provider) VpcVO(com.cloud.network.vpc.VpcVO) PlugNicCommand(com.cloud.agent.api.PlugNicCommand) SetupGuestNetworkCommand(com.cloud.agent.api.SetupGuestNetworkCommand) AggregationControlCommand(com.cloud.agent.api.routing.AggregationControlCommand) Command(com.cloud.agent.api.Command) NetworkUsageCommand(com.cloud.agent.api.NetworkUsageCommand) VirtualRouterProvider(com.cloud.network.VirtualRouterProvider) IPAddressVO(com.cloud.network.dao.IPAddressVO) DomainRouterVO(com.cloud.vm.DomainRouterVO) UserStatisticsVO(com.cloud.user.UserStatisticsVO) SetupGuestNetworkCommand(com.cloud.agent.api.SetupGuestNetworkCommand) VirtualMachine(com.cloud.vm.VirtualMachine)

Example 5 with Command

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

the class Request method getCommands.

public Command[] getCommands() {
    if (_cmds == null) {
        try {
            StringReader reader = new StringReader(_content);
            JsonReader jsonReader = new JsonReader(reader);
            jsonReader.setLenient(true);
            _cmds = s_gson.fromJson(jsonReader, (Type) Command[].class);
        } catch (RuntimeException e) {
            s_logger.error("Caught problem with " + _content, e);
            throw e;
        }
    }
    return _cmds;
}
Also used : Type(java.lang.reflect.Type) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) Command(com.cloud.agent.api.Command) StringReader(java.io.StringReader) JsonReader(com.google.gson.stream.JsonReader)

Aggregations

Command (com.cloud.agent.api.Command)33 Answer (com.cloud.agent.api.Answer)17 StartupCommand (com.cloud.agent.api.StartupCommand)17 AgentControlCommand (com.cloud.agent.api.AgentControlCommand)13 PingCommand (com.cloud.agent.api.PingCommand)13 StartupRoutingCommand (com.cloud.agent.api.StartupRoutingCommand)11 ShutdownCommand (com.cloud.agent.api.ShutdownCommand)10 PingRoutingCommand (com.cloud.agent.api.PingRoutingCommand)8 ReadyCommand (com.cloud.agent.api.ReadyCommand)8 AgentUnavailableException (com.cloud.exception.AgentUnavailableException)8 MaintainCommand (com.cloud.agent.api.MaintainCommand)7 StartupAnswer (com.cloud.agent.api.StartupAnswer)7 StartupStorageCommand (com.cloud.agent.api.StartupStorageCommand)7 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)7 AgentControlAnswer (com.cloud.agent.api.AgentControlAnswer)6 CronCommand (com.cloud.agent.api.CronCommand)6 MaintainAnswer (com.cloud.agent.api.MaintainAnswer)5 PlugNicCommand (com.cloud.agent.api.PlugNicCommand)5 StartCommand (com.cloud.agent.api.StartCommand)5 Request (com.cloud.agent.transport.Request)5