weizhouapache commented on a change in pull request #3635: server: acquire IPv4 
address when add secondary IP to nic if IP is not specified
URL: https://github.com/apache/cloudstack/pull/3635#discussion_r346405230
 
 

 ##########
 File path: server/src/main/java/com/cloud/network/NetworkServiceImpl.java
 ##########
 @@ -732,11 +732,10 @@ public NicSecondaryIp allocateSecondaryGuestIP(final 
long nicId, IpAddresses req
             }
 
             try {
-                if (ipv4Address != null) {
-                    ipaddr = _ipAddrMgr.allocatePublicIpForGuestNic(network, 
podId, ipOwner, ipv4Address);
-                }
                 if (ipv6Address != null) {
                     ip6addr = 
ipv6AddrMgr.allocatePublicIp6ForGuestNic(network, podId, ipOwner, ipv6Address);
+                } else {
 
 Review comment:
   @DaanHoogland 
   the method is called only when add a nic to vm.
   
https://github.com/apache/cloudstack/blob/master/api/src/main/java/org/apache/cloudstack/api/command/user/vm/AddIpToVmNicCmd.java#L159-L162
   
   at most one ip (ipv4 or ipv6) is passed.
   
   the idea of this PR is, if ipv6 is passed, check and assign an ipv6 address. 
It ipv4 is passed or no ip is passed, then assign an ipv4 address.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to