diff --git a/api/src/com/cloud/vm/NicProfile.java b/api/src/com/cloud/vm/NicProfile.java index ad76d3f45f0..217aa38a774 100644 --- a/api/src/com/cloud/vm/NicProfile.java +++ b/api/src/com/cloud/vm/NicProfile.java @@ -202,6 +202,10 @@ public class NicProfile { return networkRate; } + public ReservationStrategy getStrategy() { + return strategy; + } + public NicProfile(Nic nic, Network network, URI broadcastUri, URI isolationUri, Integer networkRate) { this.id = nic.getId(); this.networkId = network.getId(); diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java index 2f9a12194a8..f5b27c0ee94 100755 --- a/server/src/com/cloud/network/NetworkManagerImpl.java +++ b/server/src/com/cloud/network/NetworkManagerImpl.java @@ -1215,6 +1215,10 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag nic.setNetmask(profile.getNetmask()); nic.setGateway(profile.getGateway()); nic.setAddressFormat(profile.getFormat()); + if (profile.getStrategy() != null) { + nic.setReservationStrategy(profile.getStrategy()); + } + updateNic(nic, network.getId(), 1); } else { profile = new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), networkRate); diff --git a/server/src/com/cloud/network/guru/DirectPodBasedNetworkGuru.java b/server/src/com/cloud/network/guru/DirectPodBasedNetworkGuru.java index cc47e0f6dfd..6acf6236bf6 100644 --- a/server/src/com/cloud/network/guru/DirectPodBasedNetworkGuru.java +++ b/server/src/com/cloud/network/guru/DirectPodBasedNetworkGuru.java @@ -90,8 +90,10 @@ public class DirectPodBasedNetworkGuru extends DirectNetworkGuru { if (nic == null) { nic = new NicProfile(ReservationStrategy.Start, null, null, null, null); - } else { + } else if (nic.getIp4Address() == null) { nic.setStrategy(ReservationStrategy.Start); + } else { + nic.setStrategy(ReservationStrategy.Create); } return nic; @@ -102,6 +104,7 @@ public class DirectPodBasedNetworkGuru extends DirectNetworkGuru { throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException { if (nic.getIp4Address() == null) { getIp(nic, dest.getPod(), vm, network); + nic.setStrategy(ReservationStrategy.Create); } } diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java index a3e9145aac8..d42ec084e98 100755 --- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java +++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java @@ -808,7 +808,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian assert guestNetwork.getState() == Network.State.Implemented || guestNetwork.getState() == Network.State.Setup || guestNetwork.getState() == Network.State.Implementing : "Network is not yet fully implemented: " + guestNetwork; - DataCenterDeployment plan = new DataCenterDeployment(dcId); + DataCenterDeployment plan = null; DataCenter dc = _dcDao.findById(dcId); DomainRouterVO router = null; Long podId = dest.getPod().getId(); @@ -816,8 +816,10 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian // In Basic zone and Guest network we have to start domR per pod, not per network if ((dc.getNetworkType() == NetworkType.Basic || guestNetwork.isSecurityGroupEnabled()) && guestNetwork.getTrafficType() == TrafficType.Guest) { router = _routerDao.findByNetworkAndPod(guestNetwork.getId(), podId); + plan = new DataCenterDeployment(dcId, podId, null, null, null); } else { router = _routerDao.findByNetwork(guestNetwork.getId()); + plan = new DataCenterDeployment(dcId); } if (router == null) { diff --git a/server/src/com/cloud/vm/NicVO.java b/server/src/com/cloud/vm/NicVO.java index 071401e072b..ae2edbddbc5 100644 --- a/server/src/com/cloud/vm/NicVO.java +++ b/server/src/com/cloud/vm/NicVO.java @@ -99,7 +99,7 @@ public class NicVO implements Nic { @Column(name="strategy") @Enumerated(value=EnumType.STRING) - ReservationStrategy strategy; + ReservationStrategy reservationStrategy; @Enumerated(value=EnumType.STRING) @Column(name="vm_type") @@ -250,7 +250,7 @@ public class NicVO implements Nic { public void setReservationStrategy(ReservationStrategy strategy) { - this.strategy = strategy; + this.reservationStrategy = strategy; } public void setDeviceId(int deviceId) { @@ -277,7 +277,7 @@ public class NicVO implements Nic { @Override public ReservationStrategy getReservationStrategy() { - return strategy; + return reservationStrategy; } @Override