You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2018/03/26 07:37:03 UTC

[cloudstack] branch master updated: CLOUDSTACK-10221: Allow IPv6 when creating a Basic Network (#2397)

This is an automated email from the ASF dual-hosted git repository.

dahn pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/master by this push:
     new 9733a10  CLOUDSTACK-10221: Allow IPv6 when creating a Basic Network (#2397)
9733a10 is described below

commit 9733a10ecda5f1af0f2c0fa863fc976a3e710946
Author: Wido den Hollander <wi...@widodh.nl>
AuthorDate: Mon Mar 26 09:36:57 2018 +0200

    CLOUDSTACK-10221: Allow IPv6 when creating a Basic Network (#2397)
    
    Since CloudStack 4.10 Basic Networking supports IPv6 and thus
    should be allowed to be specified when creating a network.
    
    Signed-off-by: Wido den Hollander <wi...@widodh.nl>
---
 .../engine/orchestration/NetworkOrchestrator.java           | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
index cec2e59..1b707c3 100644
--- a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
+++ b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
@@ -38,6 +38,7 @@ import java.util.stream.Collectors;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
+import com.cloud.utils.StringUtils;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.acl.ControlledEntity.ACLType;
@@ -2116,16 +2117,12 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
 
         boolean ipv6 = false;
 
-        if (ip6Gateway != null && ip6Cidr != null) {
+        if (StringUtils.isNotBlank(ip6Gateway) && StringUtils.isNotBlank(ip6Cidr)) {
             ipv6 = true;
         }
         // Validate zone
         final DataCenterVO zone = _dcDao.findById(zoneId);
         if (zone.getNetworkType() == NetworkType.Basic) {
-            if (ipv6) {
-                throw new InvalidParameterValueException("IPv6 is not supported in Basic zone");
-            }
-
             // In Basic zone the network should have aclType=Domain, domainId=1, subdomainAccess=true
             if (aclType == null || aclType != ACLType.Domain) {
                 throw new InvalidParameterValueException("Only AclType=Domain can be specified for network creation in Basic zone");
@@ -2188,6 +2185,10 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
             }
         }
 
+        if (ipv6 && !NetUtils.isValidIp6Cidr(ip6Cidr)) {
+            throw new InvalidParameterValueException("Invalid IPv6 cidr specified");
+        }
+
         //TODO(VXLAN): Support VNI specified
         // VlanId can be specified only when network offering supports it
         final boolean vlanSpecified = vlanId != null;
@@ -2328,7 +2329,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
                     userNetwork.setGateway(gateway);
                 }
 
-                if (ip6Cidr != null && ip6Gateway != null) {
+                if (StringUtils.isNotBlank(ip6Gateway) && StringUtils.isNotBlank(ip6Cidr)) {
                     userNetwork.setIp6Cidr(ip6Cidr);
                     userNetwork.setIp6Gateway(ip6Gateway);
                 }

-- 
To stop receiving notification emails like this one, please contact
dahn@apache.org.