cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From muralire...@apache.org
Subject git commit: updated refs/heads/master-6-17-stable to d01afe0
Date Mon, 08 Jul 2013 10:23:52 GMT
Updated Branches:
  refs/heads/master-6-17-stable 2a67e132e -> d01afe0cd


CLOUDSTACK-3214: transferring portable IP across zones with enableStatic
NAT does not work

making an exception for portabe IP, so that if the current datacenter with
portable IP is associated is different from destiantion data center

also on transfer on to new zone, transfer the portable ip association to
new data center, physical network id's


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

Branch: refs/heads/master-6-17-stable
Commit: d01afe0cd94245641a8c6619c4ddf1dc3506a49a
Parents: 2a67e13
Author: Murali Reddy <muralimmreddy@gmail.com>
Authored: Wed Jun 26 19:27:09 2013 +0530
Committer: Murali Reddy <muralimmreddy@gmail.com>
Committed: Mon Jul 8 15:53:40 2013 +0530

----------------------------------------------------------------------
 engine/schema/src/com/cloud/dc/VlanVO.java      |  4 ++++
 .../src/com/cloud/network/dao/IPAddressVO.java  |  4 ++++
 .../com/cloud/network/NetworkManagerImpl.java   | 21 +++++++++++++++++++-
 .../cloud/network/rules/RulesManagerImpl.java   |  5 ++++-
 4 files changed, 32 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d01afe0c/engine/schema/src/com/cloud/dc/VlanVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/VlanVO.java b/engine/schema/src/com/cloud/dc/VlanVO.java
index 1d28896..d262409 100644
--- a/engine/schema/src/com/cloud/dc/VlanVO.java
+++ b/engine/schema/src/com/cloud/dc/VlanVO.java
@@ -120,6 +120,10 @@ public class VlanVO implements Vlan {
 		return dataCenterId;
 	}
 
+    public void setDataCenterId(long dcId) {
+        this.dataCenterId = dcId;
+    }
+
 	@Override
     public String getIpRange() {
 		return ipRange;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d01afe0c/engine/schema/src/com/cloud/network/dao/IPAddressVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/IPAddressVO.java b/engine/schema/src/com/cloud/network/dao/IPAddressVO.java
index 5eb2500..c5f17504 100644
--- a/engine/schema/src/com/cloud/network/dao/IPAddressVO.java
+++ b/engine/schema/src/com/cloud/network/dao/IPAddressVO.java
@@ -158,6 +158,10 @@ public class IPAddressVO implements IpAddress {
 	    return dataCenterId;
 	}
 
+    public void setDataCenterId(long dcId) {
+        this.dataCenterId = dcId;
+    }
+
 	@Override
     public Ip getAddress() {
 		return address;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d01afe0c/server/src/com/cloud/network/NetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java
index 708c03d..1b8ba05 100755
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@ -1126,7 +1126,6 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager,
L
         }
 
         Transaction txn = Transaction.currentTxn();
-        txn.start();
 
         assert(isPortableIpTransferableFromNetwork(ipAddrId, currentNetworkId));
 
@@ -1136,8 +1135,27 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager,
L
             disassociatePortableIPToGuestNetwork(ipAddrId, currentNetworkId);
         }
 
+        if (srcNetwork.getDataCenterId() != dstNetwork.getDataCenterId()) {
+            // portable IP need to be transferred across the zones, so mark the entry corresponding
to portable ip
+            // in user_ip_address as provisioned in destination data center
+            txn.start();
+            ip.setDataCenterId(dstNetwork.getDataCenterId());
+            ip.setPhysicalNetworkId(dstNetwork.getPhysicalNetworkId());
+            _ipAddressDao.update(ipAddrId, ip);
+
+            VlanVO vlan = _vlanDao.findById(ip.getVlanId());
+            vlan.setPhysicalNetworkId(dstNetwork.getPhysicalNetworkId());
+            vlan.setNetworkId(newNetworkId);
+            vlan.setDataCenterId(dstNetwork.getDataCenterId());
+            _vlanDao.update(ip.getVlanId(), vlan);
+            txn.commit();
+        }
+
         associatePortableIPToGuestNetwork(ipAddrId, newNetworkId, false);
 
+
+        txn.start();
+
         if (dstNetwork.getVpcId() != null) {
             ip.setVpcId(dstNetwork.getVpcId());
         } else {
@@ -1145,6 +1163,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager,
L
         }
 
         _ipAddressDao.update(ipAddrId, ip);
+
         txn.commit();
         ActionEventUtils.onActionEvent(User.UID_SYSTEM, Account.ACCOUNT_ID_SYSTEM, Domain.ROOT_DOMAIN,
                 EventTypes.EVENT_PORTABLE_IP_TRANSFER, "Portable IP associated is transferred
from network "

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d01afe0c/server/src/com/cloud/network/rules/RulesManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/rules/RulesManagerImpl.java b/server/src/com/cloud/network/rules/RulesManagerImpl.java
index bcda32d..0f733fb 100755
--- a/server/src/com/cloud/network/rules/RulesManagerImpl.java
+++ b/server/src/com/cloud/network/rules/RulesManagerImpl.java
@@ -159,7 +159,10 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager,
Rules
 
         // validate that userVM is in the same availability zone as the IP address
         if (ipAddress.getDataCenterId() != userVm.getDataCenterId()) {
-            throw new InvalidParameterValueException("Unable to create ip forwarding rule,
IP address " + ipAddress + " is not in the same availability zone as virtual machine " + userVm.toString());
+            //make an exception for portable IP
+            if (!ipAddress.isPortable()) {
+                throw new InvalidParameterValueException("Unable to create ip forwarding
rule, IP address " + ipAddress + " is not in the same availability zone as virtual machine
" + userVm.toString());
+            }
         }
 
     }


Mime
View raw message