bug 11021: Add ReservationStrategy.Managed to prevent sourceNat from release

status 11021: resolved fixed
This commit is contained in:
Sheng Yang 2011-08-10 12:50:14 -07:00
parent 34682b3bb0
commit 2d958c5d23
2 changed files with 3 additions and 3 deletions

View File

@ -83,7 +83,7 @@ public interface Nic {
}
public enum ReservationStrategy {
PlaceHolder, Create, Start;
PlaceHolder, Create, Start, Managed;
}
/**

View File

@ -155,7 +155,7 @@ public class PublicNetworkGuru extends AdapterBase implements NetworkGuru {
if (nic.getIp4Address() == null) {
nic.setStrategy(ReservationStrategy.Start);
} else {
nic.setStrategy(ReservationStrategy.Create);
nic.setStrategy(ReservationStrategy.Managed);
}
return nic;
@ -182,7 +182,7 @@ public class PublicNetworkGuru extends AdapterBase implements NetworkGuru {
@Override
public void deallocate(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) {
IPAddressVO ip = _ipAddressDao.findByIpAndSourceNetworkId(nic.getNetworkId(), nic.getIp4Address());
if (ip != null) {
if (ip != null && nic.getReservationStrategy() != ReservationStrategy.Managed) {
_networkMgr.markIpAsUnavailable(ip.getId());
_ipAddressDao.unassignIpAddress(ip.getId());
}