Search in sources :

Example 6 with AggregationControlCommand

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

the class VirtualNetworkApplianceManagerImpl method aggregationExecution.

protected boolean aggregationExecution(final AggregationControlCommand.Action action, final Network network, final List<DomainRouterVO> routers) throws AgentUnavailableException, ResourceUnavailableException {
    int errors = 0;
    for (final DomainRouterVO router : routers) {
        final String routerControlIp = _routerControlHelper.getRouterControlIp(router.getId());
        final String routerIpInNetwork = _routerControlHelper.getRouterIpInNetwork(network.getId(), router.getId());
        if (routerIpInNetwork == null) {
            // Nic hasn't been created in this router yet. Try to configure the next one.
            s_logger.warn("The Network is not configured in the router " + router.getHostName() + " yet. Try the next router!");
            errors++;
            continue;
        }
        final AggregationControlCommand cmd = new AggregationControlCommand(action, router.getInstanceName(), routerControlIp, routerIpInNetwork);
        final Commands cmds = new Commands(cmd);
        if (!_nwHelper.sendCommandsToRouter(router, cmds)) {
            return false;
        }
    }
    if (errors == routers.size()) {
        s_logger.error("aggregationExecution() on " + getClass().getName() + " failed! Network is not configured in any router.");
        return false;
    }
    return true;
}
Also used : AggregationControlCommand(com.cloud.agent.api.routing.AggregationControlCommand) Commands(com.cloud.agent.manager.Commands) DomainRouterVO(com.cloud.vm.DomainRouterVO)

Aggregations

AggregationControlCommand (com.cloud.agent.api.routing.AggregationControlCommand)6 Answer (com.cloud.agent.api.Answer)3 NetworkUsageCommand (com.cloud.agent.api.NetworkUsageCommand)2 PlugNicCommand (com.cloud.agent.api.PlugNicCommand)2 GroupAnswer (com.cloud.agent.api.routing.GroupAnswer)2 Provider (com.cloud.network.Network.Provider)2 VirtualRouterProvider (com.cloud.network.VirtualRouterProvider)2 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)2 DomainRouterVO (com.cloud.vm.DomainRouterVO)2 NicProfile (com.cloud.vm.NicProfile)2 AttachIsoCommand (com.cloud.agent.api.AttachIsoCommand)1 BackupSnapshotCommand (com.cloud.agent.api.BackupSnapshotCommand)1 CheckHealthCommand (com.cloud.agent.api.CheckHealthCommand)1 CheckNetworkCommand (com.cloud.agent.api.CheckNetworkCommand)1 CheckRouterAnswer (com.cloud.agent.api.CheckRouterAnswer)1 CheckRouterCommand (com.cloud.agent.api.CheckRouterCommand)1 CheckS2SVpnConnectionsAnswer (com.cloud.agent.api.CheckS2SVpnConnectionsAnswer)1 CheckS2SVpnConnectionsCommand (com.cloud.agent.api.CheckS2SVpnConnectionsCommand)1 CheckVirtualMachineCommand (com.cloud.agent.api.CheckVirtualMachineCommand)1 CleanupNetworkRulesCmd (com.cloud.agent.api.CleanupNetworkRulesCmd)1