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_r206870388
 
 

 ##########
 File path: server/src/main/java/com/cloud/network/Ipv6AddressManagerImpl.java
 ##########
 @@ -150,4 +163,101 @@ public void revokeDirectIpv6Address(long networkId, 
String ip6Address) {
             _ipv6Dao.remove(ip.getId());
         }
     }
+
+    /**
+     * Executes method {@link #acquireGuestIpv6Address(Network, String)} and 
returns the requested IPv6 (String) in case of successfully allocating the 
guest IPv6 address.
+     */
+    @Override
+    public String allocateGuestIpv6(Network network, String requestedIpv6) 
throws InsufficientAddressCapacityException {
+        return acquireGuestIpv6Address(network, requestedIpv6);
+    }
+
+    /**
+     * Allocates a guest IPv6 address for the guest NIC. It will throw 
exceptions in the following cases:
+     * <ul>
+     *    <li>there is no IPv6 address available in the network;</li>
+     *    <li>IPv6 address is equals to the Gateway;</li>
+     *    <li>the network offering is empty;</li>
+     *    <li>the IPv6 address is not in the network;</li>
+     *    <li>the the requested IPv6 address is already in use in the 
network.</li>
+     * </ul>
+     */
+    @Override
+    @DB
+    public String acquireGuestIpv6Address(Network network, String 
requestedIpv6) throws InsufficientAddressCapacityException {
+        if (!_networkModel.isIP6AddressAvailableInNetwork(network.getId())) {
 
 Review comment:
   What about `areThereIPv6AddressAvailableInNetwork`

----------------------------------------------------------------
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


With regards,
Apache Git Services

Reply via email to