cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jburwell <...@git.apache.org>
Subject [GitHub] cloudstack pull request: CLOUDSTACK-8832 : Update Nuage VSP plugin...
Date Mon, 12 Oct 2015 17:07:07 GMT
Github user jburwell commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/801#discussion_r41778039
  
    --- Diff: plugins/network-elements/nuage-vsp/src/com/cloud/network/element/NuageVspElement.java
---
    @@ -205,9 +254,79 @@ public boolean implement(Network network, NetworkOffering offering,
DeployDestin
                 return false;
             }
     
    +        final boolean egressDefaultPolicy = offering.getEgressDefaultPolicy();
    +        Domain networkDomain = _domainDao.findById(network.getDomainId());
    +        boolean isFirewallServiceSupported = _networkModel.areServicesSupportedByNetworkOffering(offering.getId(),
Service.Firewall);
    +        List<String> dnsServers = _nuageVspManager.getDnsDetails(network);
    +
    +        boolean isL2Network = false, isL3Network = false, isShared = false;
    +        String subnetUuid = network.getUuid();
    +        if (offering.getGuestType() == Network.GuestType.Shared) {
    +            isShared = true;
    +            subnetUuid = networkDomain.getUuid();
    +        } else if (_ntwkOfferingSrvcDao.areServicesSupportedByNetworkOffering(offering.getId(),
Service.SourceNat)
    +                || _ntwkOfferingSrvcDao.areServicesSupportedByNetworkOffering(offering.getId(),
Service.StaticNat)
    +                || _ntwkOfferingSrvcDao.areServicesSupportedByNetworkOffering(offering.getId(),
Service.Connectivity)) {
    +            isL3Network = true;
    +        } else {
    +            isL2Network = true;
    +        }
    +
    +        String preConfiguredDomainTemplateName = NuageVspUtil.getPreConfiguredDomainTemplateName(_configDao,
network, offering);
    +        List<FirewallRuleVO> firewallIngressRulesToApply = getFirewallRulesToApply(network.getId(),
FirewallRule.TrafficType.Ingress);
    +        List<FirewallRuleVO> firewallEgressRulesToApply = getFirewallRulesToApply(network.getId(),
FirewallRule.TrafficType.Egress);
    +
    +        List<Map<String, Object>> ingressFirewallRules = Lists.transform(firewallIngressRulesToApply,
new Function<FirewallRuleVO, Map<String, Object>>() {
    +            @Override
    +            public Map<String, Object> apply(FirewallRuleVO firewallRuleVO) {
    +                return getACLRuleDetails(firewallRuleVO, egressDefaultPolicy);
    +            }
    +        });
    +
    +        List<Map<String, Object>> egressFirewallRules = Lists.transform(firewallEgressRulesToApply,
new Function<FirewallRuleVO, Map<String, Object>>() {
    +            @Override
    +            public Map<String, Object> apply(FirewallRuleVO firewallRuleVO) {
    +                return getACLRuleDetails(firewallRuleVO, egressDefaultPolicy);
    +            }
    +        });
    +
    +        List<IPAddressVO> ips = _ipAddressDao.listStaticNatPublicIps(network.getId());
    +        List<String> acsFipUuid = new ArrayList<String>();
    +        for (IPAddressVO ip : ips) {
    +            acsFipUuid.add(ip.getUuid());
    +        }
    +
    +        try {
    +            HostVO nuageVspHost = getNuageVspHost(network.getPhysicalNetworkId());
    +            ImplementVspCommand.Builder cmdBuilder = new ImplementVspCommand.Builder().networkId(network.getId()).networkDomainUuid(networkDomain.getUuid())
    +                    .networkUuid(network.getUuid()).networkName(network.getName()).vpcOrSubnetUuid(subnetUuid).isL2Network(isL2Network).isL3Network(isL3Network)
    +                    .isVpc(false).isShared(isShared).domainTemplateName(preConfiguredDomainTemplateName).isFirewallServiceSupported(isFirewallServiceSupported)
    +                    .dnsServers(dnsServers).ingressFirewallRules(ingressFirewallRules).egressFirewallRules(egressFirewallRules).acsFipUuid(acsFipUuid)
    +                    .egressDefaultPolicy(egressDefaultPolicy);
    +            ImplementVspAnswer answer = (ImplementVspAnswer) _agentMgr.easySend(nuageVspHost.getId(),
cmdBuilder.build());
    +            if (answer == null || !answer.getResult()) {
    +                s_logger.error("ImplementVspCommand for network " + network.getUuid()
+ " failed");
    +                if ((null != answer) && (null != answer.getDetails())) {
    +                    throw new ResourceUnavailableException(answer.getDetails(), Network.class,
network.getId());
    +                }
    +            }
    +        } catch (Exception e) {
    --- End diff --
    
    Why are all checked and unchecked exceptions being caught here?  Why not catch the subset
of expected checked exceptions?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message