Pearl1594 commented on code in PR #6426:
URL: https://github.com/apache/cloudstack/pull/6426#discussion_r906041521


##########
core/src/main/java/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java:
##########
@@ -216,6 +225,51 @@ private Answer executeQueryCommand(NetworkElementCommand 
cmd) {
         }
     }
 
+    private static String getRouterSshControlIp(NetworkElementCommand cmd) {
+        String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
+        if (s_logger.isDebugEnabled())
+            s_logger.debug("Use router's private IP for SSH control. IP : " + 
routerIp);
+        return routerIp;
+    }
+
+    private Answer execute(UpdateNetworkCommand cmd) {
+        IpAddressTO[] ipAddresses = cmd.getIpAddresses();
+        String routerIp = getRouterSshControlIp(cmd);
+        boolean finalResult = true;
+        for (IpAddressTO ipAddressTO : ipAddresses) {
+            try {
+                SubnetUtils util = new SubnetUtils(ipAddressTO.getPublicIp(), 
ipAddressTO.getVlanNetmask());
+                String address = util.getInfo().getCidrSignature();
+                String subnet = address.split("/")[1];
+                ExecutionResult result = _vrDeployer.executeInVR(routerIp, 
VRScripts.VR_UPDATE_MTU,
+                        ipAddressTO.getPublicIp() + " " + subnet + " " + 
ipAddressTO.getMtu() + " " + 15);
+                if (s_logger.isDebugEnabled())
+                    s_logger.debug("result: " + result.isSuccess() + ", 
output: " + result.getDetails());
+                if (!Boolean.TRUE.equals(result.isSuccess())) {
+                    if (result.getDetails().contains(String.format("Interface 
with IP %s not found", ipAddressTO.getPublicIp()))) {
+                        s_logger.warn(String.format("Skipping IP: %s as it 
isn't configured on router interface", ipAddressTO.getPublicIp()));

Review Comment:
   moved the continue outside the second check. thanks!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to