VPC: CS-15485 - dont' create a record for VPC VR private gateway nic in router_network_ref; do it for regular guest networks only

This commit is contained in:
Alena Prokharchyk 2012-07-06 14:53:23 -07:00
parent 2fa2dd5dfd
commit c49cc27b1c
2 changed files with 8 additions and 3 deletions

View File

@ -2085,12 +2085,12 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
List<Provider> providersToImplement = getNetworkProviders(network.getId());
for (NetworkElement element : _networkElements) {
if (providersToImplement.contains(element.getProvider())) {
if (!isProviderEnabledInPhysicalNetwork(getPhysicalNetworkId(network), "VirtualRouter")) {
if (!isProviderEnabledInPhysicalNetwork(getPhysicalNetworkId(network), element.getProvider().getName())) {
// The physicalNetworkId will not get translated into a uuid by the reponse serializer,
// because the serializer would look up the NetworkVO class's table and retrieve the
// network id instead of the physical network id.
// So just throw this exception as is. We may need to TBD by changing the serializer.
throw new CloudRuntimeException("Service provider " + element.getProvider().getName() + "either doesn't exist or is not enabled in physical network id: " + network.getPhysicalNetworkId());
throw new CloudRuntimeException("Service provider " + element.getProvider().getName() + " either doesn't exist or is not enabled in physical network id: " + network.getPhysicalNetworkId());
}
if (s_logger.isDebugEnabled()) {
s_logger.debug("Asking " + element.getName() + " to implemenet " + network);

View File

@ -19,9 +19,11 @@ import javax.ejb.Local;
import com.cloud.host.HostVO;
import com.cloud.host.dao.HostDaoImpl;
import com.cloud.network.Network;
import com.cloud.network.Networks.TrafficType;
import com.cloud.network.RouterNetworkDaoImpl;
import com.cloud.network.RouterNetworkVO;
import com.cloud.network.router.VirtualRouter.Role;
import com.cloud.offering.NetworkOffering;
import com.cloud.user.UserStatisticsVO;
import com.cloud.user.dao.UserStatisticsDaoImpl;
import com.cloud.utils.component.ComponentLocator;
@ -265,7 +267,10 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
// 2) add router to the network
for (Network guestNetwork : guestNetworks) {
if (!isRouterPartOfGuestNetwork(router.getId(), guestNetwork.getId())) {
addRouterToGuestNetwork(router, guestNetwork);
//add only when network is not private network
if (!(guestNetwork.getName() != NetworkOffering.SystemPrivateGatewayNetworkOffering)) {
addRouterToGuestNetwork(router, guestNetwork);
}
}
}
}