You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ya...@apache.org on 2013/01/30 07:22:11 UTC
[1/5] git commit: IPv6: Make the IPv6 input all lowercase
IPv6: Make the IPv6 input all lowercase
To make them consistent.
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/85d0546f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/85d0546f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/85d0546f
Branch: refs/heads/ipv6
Commit: 85d0546fe8e20ef9577d4fded256b3e1e6d0a2f9
Parents: 0b62fc4
Author: Sheng Yang <sh...@citrix.com>
Authored: Tue Jan 29 19:47:08 2013 -0800
Committer: Sheng Yang <sh...@citrix.com>
Committed: Tue Jan 29 22:01:25 2013 -0800
----------------------------------------------------------------------
.../org/apache/cloudstack/api/ApiConstants.java | 4 +-
.../api/command/user/network/CreateNetworkCmd.java | 44 ++++++---------
.../api/command/user/vm/DeployVMCmd.java | 17 +++++-
3 files changed, 34 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/85d0546f/api/src/org/apache/cloudstack/api/ApiConstants.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java
index 80e382c..000e1e8 100644
--- a/api/src/org/apache/cloudstack/api/ApiConstants.java
+++ b/api/src/org/apache/cloudstack/api/ApiConstants.java
@@ -38,7 +38,7 @@ public class ApiConstants {
public static final String DOMAIN_SUFFIX = "domainsuffix";
public static final String DNS_SEARCH_ORDER = "dnssearchorder";
public static final String CIDR = "cidr";
- public static final String IP6CIDR = "ip6cidr";
+ public static final String IP6_CIDR = "ip6cidr";
public static final String CIDR_LIST = "cidrlist";
public static final String CLEANUP = "cleanup";
public static final String CLUSTER_ID = "clusterid";
@@ -75,7 +75,7 @@ public class ApiConstants {
public static final String FORMAT = "format";
public static final String FOR_VIRTUAL_NETWORK = "forvirtualnetwork";
public static final String GATEWAY = "gateway";
- public static final String IP6GATEWAY = "ip6gateway";
+ public static final String IP6_GATEWAY = "ip6gateway";
public static final String GROUP = "group";
public static final String GROUP_ID = "groupid";
public static final String GUEST_CIDR_ADDRESS = "guestcidraddress";
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/85d0546f/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java
index 89aa464..f9969ec 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java
@@ -119,11 +119,11 @@ public class CreateNetworkCmd extends BaseCmd {
@Parameter(name=ApiConstants.END_IPV6, type=CommandType.STRING, description="the ending IPv6 address in the IPv6 network range")
private String endIpv6;
- @Parameter(name=ApiConstants.IP6GATEWAY, type=CommandType.STRING, description="the gateway of the IPv6 network. Required " +
+ @Parameter(name=ApiConstants.IP6_GATEWAY, type=CommandType.STRING, description="the gateway of the IPv6 network. Required " +
"for Shared networks and Isolated networks when it belongs to VPC")
private String ip6Gateway;
- @Parameter(name=ApiConstants.IP6CIDR, type=CommandType.STRING, description="the CIDR of IPv6 network, must be at least /64")
+ @Parameter(name=ApiConstants.IP6_CIDR, type=CommandType.STRING, description="the CIDR of IPv6 network, must be at least /64")
private String ip6Cidr;
@Parameter(name=ApiConstants.DUAL_STACK, type=CommandType.BOOLEAN, description="The network is dual-stack(IPv6 and IPv4) or not")
@@ -223,35 +223,31 @@ public class CreateNetworkCmd extends BaseCmd {
}
public String getStartIpv6() {
- return startIpv6;
- }
-
- public void setStartIpv6(String startIpv6) {
- this.startIpv6 = startIpv6;
+ if (startIpv6 == null) {
+ return null;
+ }
+ return startIpv6.toLowerCase();
}
public String getEndIpv6() {
- return endIpv6;
- }
-
- public void setEndIpv6(String endIpv6) {
- this.endIpv6 = endIpv6;
+ if (endIpv6 == null) {
+ return null;
+ }
+ return endIpv6.toLowerCase();
}
public String getIp6Gateway() {
- return ip6Gateway;
- }
-
- public void setIp6Gateway(String ip6Gateway) {
- this.ip6Gateway = ip6Gateway;
+ if (ip6Gateway == null) {
+ return null;
+ }
+ return ip6Gateway.toLowerCase();
}
public String getIp6Cidr() {
- return ip6Cidr;
- }
-
- public void setIp6Cidr(String ip6Cidr) {
- this.ip6Cidr = ip6Cidr;
+ if (ip6Cidr == null) {
+ return null;
+ }
+ return ip6Cidr.toLowerCase();
}
public Boolean isDualStack() {
@@ -261,10 +257,6 @@ public class CreateNetworkCmd extends BaseCmd {
return dualStack;
}
- public void setDualStack(Boolean dualStack) {
- this.dualStack = dualStack;
- }
-
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/85d0546f/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
index b3eaed8..8302590 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
@@ -248,7 +248,7 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
public List<Long> getNetworkIds() {
if (ipToNetworkList != null) {
- if (networkIds != null || ipAddress != null || ip6Address != null) {
+ if (networkIds != null || ipAddress != null || getIp6Address() != null) {
throw new InvalidParameterValueException("ipToNetworkMap can't be specified along with networkIds or ipAddress");
} else {
List<Long> networks = new ArrayList<Long>();
@@ -276,7 +276,7 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
}
private Map<Long, IpAddresses> getIpToNetworkMap() {
- if ((networkIds != null || ipAddress != null || ip6Address != null) && ipToNetworkList != null) {
+ if ((networkIds != null || ipAddress != null || getIp6Address() != null) && ipToNetworkList != null) {
throw new InvalidParameterValueException("NetworkIds and ipAddress can't be specified along with ipToNetworkMap parameter");
}
LinkedHashMap<Long, IpAddresses> ipToNetworkMap = null;
@@ -299,6 +299,9 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
}
String requestedIp = (String) ips.get("ip");
String requestedIpv6 = (String) ips.get("ipv6");
+ if (requestedIpv6 != null) {
+ requestedIpv6 = requestedIpv6.toLowerCase();
+ }
IpAddresses addrs = new IpAddresses(requestedIp, requestedIpv6);
ipToNetworkMap.put(networkId, addrs);
}
@@ -306,6 +309,13 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
return ipToNetworkMap;
}
+
+ public String getIp6Address() {
+ if (ip6Address == null) {
+ return null;
+ }
+ return ip6Address.toLowerCase();
+ }
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
@@ -434,7 +444,7 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
if (getHypervisor() == HypervisorType.BareMetal) {
vm = _bareMetalVmService.createVirtualMachine(this);
} else {
- IpAddresses addrs = new IpAddresses(ipAddress, ip6Address);
+ IpAddresses addrs = new IpAddresses(ipAddress, getIp6Address());
if (zone.getNetworkType() == NetworkType.Basic) {
if (getNetworkIds() != null) {
throw new InvalidParameterValueException("Can't specify network Ids in Basic zone");
@@ -474,4 +484,5 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
}
}
+
}