Skip to content

Commit 94817c1

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
1 parent 15bf144 commit 94817c1

5 files changed

Lines changed: 10 additions & 7 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,10 @@ Map<PublicIpAddress, Set<Service>> getIpToServices(List<? extends PublicIpAddres
201201
List<? extends PhysicalNetwork> getPhysicalNtwksSupportingTrafficType(long zoneId, TrafficType trafficType);
202202

203203
/**
204-
* @param guestNic
204+
* @param ntwkId
205205
* @return
206206
*/
207-
boolean isPrivateGateway(Nic guestNic);
207+
boolean isPrivateGateway(long ntwkId);
208208

209209
Map<Service, Map<Capability, String>> getNetworkCapabilities(long networkId);
210210

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

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

16581658
@Override
1659-
public boolean isPrivateGateway(Nic guestNic) {
1660-
Network network = getNetwork(guestNic.getNetworkId());
1659+
public boolean isPrivateGateway(long ntwkId) {
1660+
Network network = getNetwork(ntwkId);
16611661
if (network.getTrafficType() != TrafficType.Guest || network.getNetworkOfferingId() != _privateOfferingId.longValue()) {
16621662
return false;
16631663
}

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile prof
805805
PlugNicCommand plugNicCmd = new PlugNicCommand(getNicTO(router, guestNic.getNetworkId(), null), router.getInstanceName(), router.getType());
806806
cmds.addCommand(plugNicCmd);
807807

808-
if (!_networkModel.isPrivateGateway(guestNic)) {
808+
if (!_networkModel.isPrivateGateway(guestNic.getNetworkId())) {
809809
//set guest network
810810
VirtualMachine vm = _vmDao.findById(router.getId());
811811
NicProfile nicProfile = _networkModel.getNicProfile(vm, guestNic.getNetworkId(), null);
@@ -1237,6 +1237,9 @@ private void createVpcAssociatePrivateIPCommands(final VirtualRouter router, fin
12371237
//3) allocate nic for guest gateway if needed
12381238
List<? extends Network> guestNetworks = _vpcMgr.getVpcNetworks(vpcId);
12391239
for (Network guestNetwork : guestNetworks) {
1240+
if (_networkModel.isPrivateGateway(guestNetwork.getId())) {
1241+
continue;
1242+
}
12401243
if (guestNetwork.getState() == Network.State.Implemented || guestNetwork.getState() == Network.State.Setup) {
12411244
NicProfile guestNic = createGuestNicProfileForVpcRouter(guestNetwork);
12421245
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
@@ -596,7 +596,7 @@ public List<? extends PhysicalNetwork> getPhysicalNtwksSupportingTrafficType(lon
596596
* @see com.cloud.network.NetworkModel#isPrivateGateway(com.cloud.vm.Nic)
597597
*/
598598
@Override
599-
public boolean isPrivateGateway(Nic guestNic) {
599+
public boolean isPrivateGateway(long ntwkId) {
600600
// TODO Auto-generated method stub
601601
return false;
602602
}

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

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

0 commit comments

Comments
 (0)