Github user fmaximus commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1578#discussion_r77818579
  
    --- Diff: server/src/com/cloud/network/element/VirtualRouterElement.java ---
    @@ -988,6 +1016,21 @@ public boolean addDhcpEntry(final Network network, 
final NicProfile nic, final V
             return result;
         }
     
    +    protected boolean deleteDhcpSupportForSubnet(Network network, 
Network.Service service) throws ResourceUnavailableException {
    +        if (canHandle(network, service)) {
    +            final List<DomainRouterVO> routers = 
_routerDao.listByNetworkAndRole(network.getId(), Role.VIRTUAL_ROUTER);
    +            if (routers == null || routers.size() == 0) {
    +                throw new ResourceUnavailableException("Can't find at 
least one router!", DataCenter.class, network.getDataCenterId());
    +            }
    +            try {
    +                return _routerMgr.removeDhcpSupportForSubnet(network, 
routers);
    +            } catch (final ResourceUnavailableException e) {
    +                s_logger.debug("Router resource unavailable ");
    --- End diff --
    
    Here we moved existing code from removeDhcpSupportForSubnet to a separate 
method, containing the service. 
    Another question is, why catch ResourceUnavailableException, if it is also 
present in the method's throws clause? It then would be logged by the invoking 
methods.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to