Updated Branches:
  refs/heads/network-refactor 6d41fe029 -> f1c1241e6

IPv6: Make requested ip input lower case

Ported from 4.1 branch.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/f1c1241e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/f1c1241e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/f1c1241e

Branch: refs/heads/network-refactor
Commit: f1c1241e649a112a7193e128476d82e17295e7a1
Parents: 4228345
Author: Sheng Yang <[email protected]>
Authored: Wed Feb 6 20:12:56 2013 -0800
Committer: Sheng Yang <[email protected]>
Committed: Wed Feb 6 20:12:56 2013 -0800

----------------------------------------------------------------------
 api/src/com/cloud/api/commands/DeployVMCmd.java |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f1c1241e/api/src/com/cloud/api/commands/DeployVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DeployVMCmd.java 
b/api/src/com/cloud/api/commands/DeployVMCmd.java
index 46ad6af..f2006be 100644
--- a/api/src/com/cloud/api/commands/DeployVMCmd.java
+++ b/api/src/com/cloud/api/commands/DeployVMCmd.java
@@ -228,7 +228,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>();
@@ -256,7 +256,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;
@@ -269,6 +269,9 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
                 Long networkId = 
Long.valueOf(_responseGenerator.getIdentiyId("networks", ips.get("networkid")));
                 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);
             }
@@ -276,6 +279,13 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
         
         return ipToNetworkMap;
     }
+    
+       public String getIp6Address() {
+               if (ip6Address == null) {
+                       return null;
+               }
+               return ip6Address.toLowerCase();
+       }
 
     /////////////////////////////////////////////////////
     /////////////// API Implementation///////////////////
@@ -404,7 +414,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");

Reply via email to