You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by al...@apache.org on 2012/08/07 20:39:58 UTC
[5/61] [abbrv] git commit: VPC: CS-15850 - don't unplug the nic for
public network when there are existing ips in the same vlan having network
rules
VPC: CS-15850 - don't unplug the nic for public network when there are existing ips in the same vlan having network rules
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/a83c7533
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/a83c7533
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/a83c7533
Branch: refs/heads/vpc
Commit: a83c753354cae55d053b6711b8c1070c4c243a4d
Parents: cf64fda
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Mon Aug 6 16:25:37 2012 -0700
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Tue Aug 7 11:24:04 2012 -0700
----------------------------------------------------------------------
.../VpcVirtualNetworkApplianceManagerImpl.java | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a83c7533/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
index 31aade4..23faa58 100644
--- a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
@@ -111,6 +111,7 @@ import com.cloud.utils.net.NetUtils;
import com.cloud.vm.DomainRouterVO;
import com.cloud.vm.Nic;
import com.cloud.vm.NicProfile;
+import com.cloud.vm.NicVO;
import com.cloud.vm.ReservationContext;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachine.State;
@@ -1298,10 +1299,19 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
Nic nic = _nicDao.findByNetworkIdInstanceIdAndBroadcastUri(publicNtwkId, router.getId(),
broadcastUri.toString());
- if ((nic == null && nicsToPlug.get(ip.getVlanTag()) == null) || nicsToUnplug.get(ip.getVlanTag()) != null) {
+ if (nic == null && nicsToPlug.get(ip.getVlanTag()) == null) {
nicsToPlug.put(ip.getVlanTag(), ip);
s_logger.debug("Need to plug the nic for ip=" + ip + "; vlan=" + ip.getVlanTag() +
" in public network id =" + publicNtwkId);
+ } else {
+ PublicIpAddress nicToUnplug = nicsToUnplug.get(ip.getVlanTag());
+ if (nicToUnplug != null) {
+ NicVO nicVO = _nicDao.findByIp4AddressAndNetworkIdAndInstanceId(publicNtwkId, router.getId(), nicToUnplug.getAddress().addr());
+ nicVO.setIp4Address(ip.getAddress().addr());
+ _nicDao.update(nicVO.getId(), nicVO);
+ s_logger.debug("Updated the nic " + nicVO + " with the new ip address " + ip.getAddress().addr());
+ nicsToUnplug.remove(ip.getVlanTag());
+ }
}
}
}