From 1bc44a578ddd5ae40fbf8fb65398717972772d0c Mon Sep 17 00:00:00 2001 From: Sheng Yang Date: Fri, 30 Dec 2011 13:33:23 -0800 Subject: [PATCH] bug 12705: Don't set first ip if it's not source NAT It would happen with first ip of nics other than first public nic. status 12705: resolved fixed --- .../com/cloud/hypervisor/xen/resource/CitrixResourceBase.java | 2 ++ .../network/router/VirtualNetworkApplianceManagerImpl.java | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java index 18ae24f6878..42b82cc4230 100755 --- a/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java +++ b/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java @@ -1583,6 +1583,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe if (add && correctVif == null) { addVif = true; } else if (!add && firstIP) { + /* FIXME: This is incorrect. Because you can only tell if it's the first IP in this bundle of ip address which send to the router, + * but don't know if it's the only IP left in the router - because we didn't send all the related vlan's IPs to the router now. */ removeVif = true; } diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java index d384d2e0198..831bbb13f9d 100755 --- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java +++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java @@ -2443,6 +2443,10 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian IpAddressTO[] ipsToSend = new IpAddressTO[ipAddrList.size()]; int i = 0; boolean firstIP = true; + /* If the first IP is not source NAT, then don't treat it as first IP. It would happen if it's the first IP for public nic other than first one */ + if (!ipAddrList.get(0).isSourceNat()) { + firstIP = false; + } for (final PublicIpAddress ipAddr : ipAddrList) { boolean add = (ipAddr.getState() == IpAddress.State.Releasing ? false : true);