CLOUDSTACK-6205: VPC VR start - skip private gateway when create Guest nics as the nic for the private gateway is being created separately

This commit is contained in:
Alena Prokharchyk 2014-03-14 11:43:40 -07:00
parent 15bf144f1a
commit 94817c1b4b
5 changed files with 10 additions and 7 deletions

View File

@ -201,10 +201,10 @@ public interface NetworkModel {
List<? extends PhysicalNetwork> getPhysicalNtwksSupportingTrafficType(long zoneId, TrafficType trafficType);
/**
* @param guestNic
* @param ntwkId
* @return
*/
boolean isPrivateGateway(Nic guestNic);
boolean isPrivateGateway(long ntwkId);
Map<Service, Map<Capability, String>> getNetworkCapabilities(long networkId);

View File

@ -1656,8 +1656,8 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel {
}
@Override
public boolean isPrivateGateway(Nic guestNic) {
Network network = getNetwork(guestNic.getNetworkId());
public boolean isPrivateGateway(long ntwkId) {
Network network = getNetwork(ntwkId);
if (network.getTrafficType() != TrafficType.Guest || network.getNetworkOfferingId() != _privateOfferingId.longValue()) {
return false;
}

View File

@ -805,7 +805,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
PlugNicCommand plugNicCmd = new PlugNicCommand(getNicTO(router, guestNic.getNetworkId(), null), router.getInstanceName(), router.getType());
cmds.addCommand(plugNicCmd);
if (!_networkModel.isPrivateGateway(guestNic)) {
if (!_networkModel.isPrivateGateway(guestNic.getNetworkId())) {
//set guest network
VirtualMachine vm = _vmDao.findById(router.getId());
NicProfile nicProfile = _networkModel.getNicProfile(vm, guestNic.getNetworkId(), null);
@ -1237,6 +1237,9 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
//3) allocate nic for guest gateway if needed
List<? extends Network> guestNetworks = _vpcMgr.getVpcNetworks(vpcId);
for (Network guestNetwork : guestNetworks) {
if (_networkModel.isPrivateGateway(guestNetwork.getId())) {
continue;
}
if (guestNetwork.getState() == Network.State.Implemented || guestNetwork.getState() == Network.State.Setup) {
NicProfile guestNic = createGuestNicProfileForVpcRouter(guestNetwork);
networks.put(guestNetwork, new ArrayList<NicProfile>(Arrays.asList(guestNic)));

View File

@ -596,7 +596,7 @@ public class MockNetworkModelImpl extends ManagerBase implements NetworkModel {
* @see com.cloud.network.NetworkModel#isPrivateGateway(com.cloud.vm.Nic)
*/
@Override
public boolean isPrivateGateway(Nic guestNic) {
public boolean isPrivateGateway(long ntwkId) {
// TODO Auto-generated method stub
return false;
}

View File

@ -610,7 +610,7 @@ public class MockNetworkModelImpl extends ManagerBase implements NetworkModel {
* @see com.cloud.network.NetworkModel#isPrivateGateway(com.cloud.vm.Nic)
*/
@Override
public boolean isPrivateGateway(Nic guestNic) {
public boolean isPrivateGateway(long ntwkId) {
// TODO Auto-generated method stub
return false;
}