Skip to content

Commit d9e1c9c

Browse files
author
Alena Prokharchyk
committed
CLOUDSTACK-6205: VPC VR start - skip private gateway when create Guest nics as the nic for the private gateway is being created separately
Conflicts: server/src/com/cloud/network/NetworkModelImpl.java server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
1 parent 3aee404 commit d9e1c9c

5 files changed

Lines changed: 10 additions & 8 deletions

File tree

api/src/com/cloud/network/NetworkModel.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,10 @@ public interface NetworkModel {
199199
List<? extends PhysicalNetwork> getPhysicalNtwksSupportingTrafficType(long zoneId, TrafficType trafficType);
200200

201201
/**
202-
* @param guestNic
202+
* @param ntwkId
203203
* @return
204204
*/
205-
boolean isPrivateGateway(Nic guestNic);
205+
boolean isPrivateGateway(long ntwkId);
206206

207207
Map<Service, Map<Capability, String>> getNetworkCapabilities(long networkId);
208208

server/src/com/cloud/network/NetworkModelImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,8 +1671,8 @@ public List<? extends PhysicalNetwork> getPhysicalNtwksSupportingTrafficType(lon
16711671
}
16721672

16731673
@Override
1674-
public boolean isPrivateGateway(Nic guestNic) {
1675-
Network network = getNetwork(guestNic.getNetworkId());
1674+
public boolean isPrivateGateway(long ntwkId) {
1675+
Network network = getNetwork(ntwkId);
16761676
if (network.getTrafficType() != TrafficType.Guest || network.getNetworkOfferingId() != s_privateOfferingId.longValue()) {
16771677
return false;
16781678
}

server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -782,8 +782,7 @@ public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile prof
782782
//plug guest nic
783783
PlugNicCommand plugNicCmd = new PlugNicCommand(getNicTO(router, guestNic.getNetworkId(), null), router.getInstanceName(), router.getType());
784784
cmds.addCommand(plugNicCmd);
785-
786-
if (!_networkModel.isPrivateGateway(guestNic)) {
785+
if (!_networkModel.isPrivateGateway(guestNic.getNetworkId())) {
787786
//set guest network
788787
VirtualMachine vm = _vmDao.findById(router.getId());
789788
NicProfile nicProfile = _networkModel.getNicProfile(vm, guestNic.getNetworkId(), null);
@@ -1210,6 +1209,9 @@ protected LinkedHashMap<Network, List<? extends NicProfile>> createVpcRouterNetw
12101209
//3) allocate nic for guest gateway if needed
12111210
List<? extends Network> guestNetworks = _vpcMgr.getVpcNetworks(vpcId);
12121211
for (Network guestNetwork : guestNetworks) {
1212+
if (_networkModel.isPrivateGateway(guestNetwork.getId())) {
1213+
continue;
1214+
}
12131215
if (guestNetwork.getState() == Network.State.Implemented || guestNetwork.getState() == Network.State.Setup) {
12141216
NicProfile guestNic = createGuestNicProfileForVpcRouter(guestNetwork);
12151217
networks.put(guestNetwork, new ArrayList<NicProfile>(Arrays.asList(guestNic)));

server/test/com/cloud/network/MockNetworkModelImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ public List<? extends PhysicalNetwork> getPhysicalNtwksSupportingTrafficType(lon
591591
* @see com.cloud.network.NetworkModel#isPrivateGateway(com.cloud.vm.Nic)
592592
*/
593593
@Override
594-
public boolean isPrivateGateway(Nic guestNic) {
594+
public boolean isPrivateGateway(long ntwkId) {
595595
// TODO Auto-generated method stub
596596
return false;
597597
}

server/test/com/cloud/vpc/MockNetworkModelImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ public List<? extends PhysicalNetwork> getPhysicalNtwksSupportingTrafficType(lon
607607
* @see com.cloud.network.NetworkModel#isPrivateGateway(com.cloud.vm.Nic)
608608
*/
609609
@Override
610-
public boolean isPrivateGateway(Nic guestNic) {
610+
public boolean isPrivateGateway(long ntwkId) {
611611
// TODO Auto-generated method stub
612612
return false;
613613
}

0 commit comments

Comments
 (0)