[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10328?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16565290#comment-16565290
 ] 

ASF GitHub Bot commented on CLOUDSTACK-10328:
---------------------------------------------

rafaelweingartner commented on a change in pull request #2773: 
CLOUDSTACK-10328: Add Secondary IPv6 address through API
URL: https://github.com/apache/cloudstack/pull/2773#discussion_r206868794
 
 

 ##########
 File path: 
api/src/main/java/org/apache/cloudstack/api/command/user/vm/AddIpToVmNicCmd.java
 ##########
 @@ -169,17 +161,15 @@ public long getEntityOwnerId() {
 
     @Override
     public void create() throws ResourceAllocationException {
-        String ip;
         NicSecondaryIp result;
-        String secondaryIp = null;
-        if ((ip = getIpaddress()) != null) {
-            if (!NetUtils.isValidIp4(ip)) {
-                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, 
"Invalid ip address " + ip);
-            }
+
+        IpAddresses requestedIpPair = new IpAddresses(ipAddr, null);
+        if (!NetUtils.isIpv4(ipAddr)) {
+            requestedIpPair = new IpAddresses(null, ipAddr);
         }
 
         try {
-            result = _networkService.allocateSecondaryGuestIP(getNicId(), 
getIpaddress());
+            result = _networkService.allocateSecondaryGuestIP(getNicId(), 
requestedIpPair);
 
 Review comment:
   What about sending the command to `allocateSecondaryGuestIP`? Then, you can 
extract the block 166-168 to a method and unit-test it there.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


> Add Secondary IPv6 address through API
> --------------------------------------
>
>                 Key: CLOUDSTACK-10328
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10328
>             Project: CloudStack
>          Issue Type: New Feature
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>            Reporter: Gabriel Beims Bräscher
>            Assignee: Gabriel Beims Bräscher
>            Priority: Critical
>
> Currently, we have IPv6 support in Basic Networking. However, CloudStack does 
> not support Multiple IPv6 addresses. This was partially implemented with this 
> Pull Request: https://github.com/apache/cloudstack/pull/2028
> The addIpToNic command only supports IPv4: 
> https://cloudstack.apache.org/api/apidocs-4.11/apis/addIpToNic.html
> Features:
> - Add IPv6 address alias
> - Check if this IPv6 address is in the configured subnet for that POD/VLAN
> - Update the security group
> The admin will manually add the address to the Instance but the Security 
> Grouping should allow it.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to