Package com.cloud.agent.manager

Examples of com.cloud.agent.manager.Commands


            String netmask = NetUtils.getCidrNetmask(network.getCidr());
            PrivateIpAddress ip = new PrivateIpAddress(ipVO, network.getBroadcastUri().toString(), network.getGateway(), netmask, privateNic.getMacAddress());
           
            List<PrivateIpAddress> privateIps = new ArrayList<PrivateIpAddress>(1);
            privateIps.add(ip);
            Commands cmds = new Commands(Command.OnError.Stop);
            createVpcAssociatePrivateIPCommands(router, privateIps, cmds, add);

            try{
                if (sendCommandsToRouter(router, cmds)) {
                    s_logger.debug("Successfully applied ip association for ip " + ip + " in vpc network " + network);
View Full Code Here


        return result;
    }
   
    protected boolean sendStaticRoutes(List<StaticRouteProfile> staticRoutes, DomainRouterVO router)
            throws ResourceUnavailableException {
        Commands cmds = new Commands(Command.OnError.Continue);
        createStaticRouteCommands(staticRoutes, router, cmds);
        return sendCommandsToRouter(router, cmds);
    }
View Full Code Here

        return applySite2SiteVpn(false, router, conn);
    }

    protected boolean applySite2SiteVpn(boolean isCreate, VirtualRouter router, Site2SiteVpnConnection conn) throws ResourceUnavailableException {
        Commands cmds = new Commands(Command.OnError.Continue);
        createSite2SiteVpnCfgCommands(conn, isCreate, router, cmds);
        return sendCommandsToRouter(router, cmds);
    }
View Full Code Here

          s_logger.warn("Failed to add/remove Remote Access VPN users: router not in running state");
          throw new ResourceUnavailableException("Failed to add/remove Remote Access VPN users: router not in running state: " +
              router.getState(), DataCenter.class, vpc.getZoneId());
        }

        Commands cmds = new Commands(Command.OnError.Continue);

        createApplyVpnUsersCommand(users, router, cmds);

        // Currently we receive just one answer from the agent. In the future we have to parse individual answers and set
        // results accordingly
View Full Code Here

            s_logger.warn("Unable to apply remote access VPN configuration, virtual router is not in the right state " + router.getState());
            throw new ResourceUnavailableException("Unable to apply remote access VPN configuration," +
                    " virtual router is not in the right state", DataCenter.class, router.getDataCenterId());
        }

        Commands cmds = new Commands(Command.OnError.Stop);
        createApplyVpnCommands(true, vpn, router, cmds);

        try {
          _agentMgr.send(router.getHostId(), cmds);
        } catch (OperationTimedoutException e) {
          s_logger.debug("Failed to start remote access VPN: ", e);
          throw new AgentUnavailableException("Unable to send commands to virtual router ", router.getHostId(), e);
        }
        Answer answer = cmds.getAnswer("users");
        if (!answer.getResult()) {
          s_logger.error("Unable to start vpn: unable add users to vpn in zone " + router.getDataCenterId()
              + " for account " + vpn.getAccountId() + " on domR: " + router.getInstanceName()
              + " due to " + answer.getDetails());
          throw new ResourceUnavailableException("Unable to start vpn: Unable to add users to vpn in zone " +
              router.getDataCenterId() + " for account " + vpn.getAccountId() + " on domR: "
              + router.getInstanceName() + " due to " + answer.getDetails(), DataCenter.class, router.getDataCenterId());
        }
        answer = cmds.getAnswer("startVpn");
        if (!answer.getResult()) {
          s_logger.error("Unable to start vpn in zone " + router.getDataCenterId() + " for account " +
              vpn.getAccountId() + " on domR: " + router.getInstanceName() + " due to "
              + answer.getDetails());
          throw new ResourceUnavailableException("Unable to start vpn in zone " + router.getDataCenterId()
View Full Code Here

    @Override
    public boolean stopRemoteAccessVpn(RemoteAccessVpn vpn, VirtualRouter router) throws ResourceUnavailableException {
      boolean result = true;

        if (router.getState() == State.Running) {
          Commands cmds = new Commands(Command.OnError.Continue);
          createApplyVpnCommands(false, vpn, router, cmds);
          result = result && sendCommandsToRouter(router, cmds);
        } else if (router.getState() == State.Stopped) {
          s_logger.debug("Router " + router + " is in Stopped state, not sending deleteRemoteAccessVpn command to it");
        } else {
View Full Code Here

    protected void handleVmMigrated(VMInstanceVO vm) {
        if (!isVmSecurityGroupEnabled(vm.getId()))
            return;
        if (vm.getType() != VirtualMachine.Type.User) {
            Commands cmds = null;
            NetworkRulesSystemVmCommand nrc = new NetworkRulesSystemVmCommand(vm.getInstanceName(), vm.getType());
            cmds = new Commands(nrc);
            try {
                _agentMgr.send(vm.getHostId(), cmds);
            } catch (AgentUnavailableException e) {
                s_logger.debug(e.toString());
            } catch (OperationTimedoutException e) {
View Full Code Here

                                    nicSecIps = _nicSecIpDao.getSecondaryIpAddressesForNic(nic.getId());
                                }
                            }
                            SecurityGroupRulesCmd cmd = generateRulesetCmd( vm.getInstanceName(), vm.getPrivateIpAddress(), vm.getPrivateMacAddress(), vm.getId(), generateRulesetSignature(ingressRules, egressRules), seqnum,
                                    ingressRules, egressRules, nicSecIps);
                            Commands cmds = new Commands(cmd);
                            try {
                                _agentMgr.send(agentId, cmds, _answerListener);
                            } catch (AgentUnavailableException e) {
                                s_logger.debug("Unable to send ingress rules updates for vm: " + userVmId + "(agentid=" + agentId + ")");
                                _workDao.updateStep(work.getInstanceId(), seqnum, Step.Done);
View Full Code Here

        }

        //create command for the to add ip in ipset and arptables rules
        NetworkRulesVmSecondaryIpCommand cmd = new NetworkRulesVmSecondaryIpCommand(vmName, vmMac, secondaryIp, ruleAction);
        s_logger.debug("Asking agent to configure rules for vm secondary ip");
        Commands cmds = null;

        cmds = new Commands(cmd);
        try {
            _agentMgr.send(vm.getHostId(), cmds);
        } catch (AgentUnavailableException e) {
            s_logger.debug(e.toString());
        } catch (OperationTimedoutException e) {
View Full Code Here

                setId(newHostId);
            }
            if (s_logger.isDebugEnabled()) {
                s_logger.debug("Sending command " + cmd.toString() + " to host: " + newHostId);
            }
            agentMgr.send(newHostId, new Commands(cmd), new CmdRunner(callback));
        } catch (AgentUnavailableException e) {
            throw new CloudRuntimeException("Unable to send message", e);
        }
    }
View Full Code Here

TOP

Related Classes of com.cloud.agent.manager.Commands

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.