Package com.cloud.agent.manager

Examples of com.cloud.agent.manager.Commands


            _tunnelInterfaceDao.getByHostAndLabel(host.getId(),
                                physNetLabel);
        if (tunnelIface == null) {
            //Now find and fetch configuration for physical interface
          //for network with label on target host
      Commands fetchIfaceCmds =
          new Commands(new OvsFetchInterfaceCommand(physNetLabel));
      s_logger.debug("Ask host " + host.getId() +
               " to retrieve interface for phy net with label:" +
               physNetLabel);
      Answer[] fetchIfaceAnswers = _agentMgr.send(host.getId(),
                            fetchIfaceCmds);
View Full Code Here


        String otherIp = getGreEndpointIP(rHost, nw);
              if (otherIp == null)
                throw new GreTunnelException("Unable to retrieve the remote " +
                               "endpoint for the GRE tunnel." +
                               "Failure is on host:" + rHost.getId());
        Commands cmds = new Commands(
            new OvsCreateTunnelCommand(otherIp, key,
                Long.valueOf(hostId), i, nw.getId(), myIp));
        s_logger.debug("Ask host " + hostId +
            " to create gre tunnel to " + i);
        Answer[] answers = _agentMgr.send(hostId, cmds);
        handleCreateTunnelAnswer(answers);
        noHost = false;
      }
     
      for (Long i : fromHostIds) {
          HostVO rHost = _hostDao.findById(i);
          String otherIp = getGreEndpointIP(rHost, nw);
        Commands cmds = new Commands(
                new OvsCreateTunnelCommand(myIp, key, i,
                               Long.valueOf(hostId),
                                       nw.getId(), otherIp));
        s_logger.debug("Ask host " + i +
            " to create gre tunnel to " + hostId);
        Answer[] answers = _agentMgr.send(i, cmds);
        handleCreateTunnelAnswer(answers);
        noHost = false;
      }
      // If no tunnels have been configured, perform the bridge setup anyway
      // This will ensure VIF rules will be triggered
      if (noHost) {
        Commands cmds = new Commands(
            new OvsSetupBridgeCommand(key, hostId, nw.getId()));
        s_logger.debug("Ask host " + hostId +
            " to configure bridge for network:" + nw.getId());
        Answer[] answers = _agentMgr.send(hostId, cmds);
        handleSetupBridgeAnswer(answers);
View Full Code Here

        try {
            long newHostId = _hvGuruMgr.getGuruProcessedCommandTargetHost(this.hostId, cmd);
            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

    }

    protected boolean applyLBRules(DomainRouterVO elbVm,
            List<LoadBalancingRule> rules, long guestNetworkId) throws ResourceUnavailableException {
        Commands cmds = new Commands(OnError.Continue);
        createApplyLoadBalancingRulesCommands(rules, elbVm, cmds, guestNetworkId);
        // Send commands to elbVm
        return sendCommandsToRouter(elbVm, cmds);
    }
View Full Code Here

            throw new ResourceUnavailableException("Unable to apply lb rules; Internal LB VM is not in the right state", DataCenter.class, lbVm.getDataCenterId());
        }
    }
   
    protected boolean sendLBRules(VirtualRouter internalLbVm, List<LoadBalancingRule> rules, long guestNetworkId) throws ResourceUnavailableException {
        Commands cmds = new Commands(OnError.Continue);
        createApplyLoadBalancingRulesCommands(rules, internalLbVm, cmds, guestNetworkId);
        return sendCommandsToInternalLbVm(internalLbVm, cmds);
    }
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

            String pubKey = _configDao.getValue("ssh.publickey");
            String prvKey = _configDao.getValue("ssh.privatekey");
           
            try {
              ModifySshKeysCommand cmds = new ModifySshKeysCommand(pubKey, prvKey);
              Commands c = new Commands(cmds);
              _agentMgr.send(host.getId(), c, this);
            } catch (AgentUnavailableException e) {
              s_logger.debug("Failed to send keys to agent: " + host.getId());
            }
          }
View Full Code Here

        if (cmd instanceof StartupRoutingCommand) {
            //if (Boolean.toString(true).equals(host.getDetail("can_bridge_firewall"))) {
            try {
                int interval = MIN_TIME_BETWEEN_CLEANUPS + _cleanupRandom.nextInt(MIN_TIME_BETWEEN_CLEANUPS/2);
                CleanupNetworkRulesCmd cleanupCmd = new CleanupNetworkRulesCmd(interval);
                Commands c = new Commands(cleanupCmd);
                _agentMgr.send(host.getId(), c,  this);
                if(s_logger.isInfoEnabled())
                    s_logger.info("Scheduled network rules cleanup, interval=" + cleanupCmd.getInterval());
            } catch (AgentUnavailableException e) {
                //usually hypervisors that do not understand sec group rules.
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.