cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sw...@apache.org
Subject [1/6] git commit: updated refs/heads/master to 9b525f5
Date Mon, 25 Apr 2016 19:54:32 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 4ab7fb78a -> 9b525f51a


CLOUDSTACK-9322 : Changes to support InternalLbVm with Nuage VSP plugin


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ae0d6b32
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ae0d6b32
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ae0d6b32

Branch: refs/heads/master
Commit: ae0d6b32d8d30f860a53c9c808ca136012609db7
Parents: c48b6c3
Author: Nick Livens <nick.livens@nuagenetworks.net>
Authored: Thu Feb 18 11:03:34 2016 +0100
Committer: Nick Livens <nick.livens@nuagenetworks.net>
Committed: Tue Mar 29 11:24:45 2016 +0200

----------------------------------------------------------------------
 .../com/cloud/api/commands/VspConstants.java    |  1 +
 .../api/response/NuageVspDeviceResponse.java    |  7 ++
 .../cloud/network/element/NuageVspElement.java  | 31 +++++++
 .../network/guru/NuageVspGuestNetworkGuru.java  |  9 ++
 .../network/manager/NuageVspManagerImpl.java    | 91 ++++++++++++++------
 .../network/element/NuageVspElementTest.java    |  6 ++
 .../guru/NuageVspGuestNetworkGuruTest.java      | 25 ++++--
 .../com/cloud/network/vpc/VpcManagerImpl.java   |  9 +-
 .../src/com/cloud/user/DomainManagerImpl.java   |  1 +
 ui/scripts/configuration.js                     |  5 +-
 10 files changed, 153 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ae0d6b32/plugins/network-elements/nuage-vsp/src/com/cloud/api/commands/VspConstants.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nuage-vsp/src/com/cloud/api/commands/VspConstants.java
b/plugins/network-elements/nuage-vsp/src/com/cloud/api/commands/VspConstants.java
index 2372890..7abcdfb 100644
--- a/plugins/network-elements/nuage-vsp/src/com/cloud/api/commands/VspConstants.java
+++ b/plugins/network-elements/nuage-vsp/src/com/cloud/api/commands/VspConstants.java
@@ -32,4 +32,5 @@ public class VspConstants {
     public static final String NUAGE_VSP_API_CHILD_RESOURCE = "childresource";
     public static final String NUAGE_VSP_API_RESOURCE_FILTER = "resourcefilter";
     public static final String NUAGE_VSP_API_RESOURCE_INFO = "resourceinfo";
+    public static final String NUAGE_VSP_CMS_ID = "cmsid";
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ae0d6b32/plugins/network-elements/nuage-vsp/src/com/cloud/api/response/NuageVspDeviceResponse.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nuage-vsp/src/com/cloud/api/response/NuageVspDeviceResponse.java
b/plugins/network-elements/nuage-vsp/src/com/cloud/api/response/NuageVspDeviceResponse.java
index 136a465..346e288 100644
--- a/plugins/network-elements/nuage-vsp/src/com/cloud/api/response/NuageVspDeviceResponse.java
+++ b/plugins/network-elements/nuage-vsp/src/com/cloud/api/response/NuageVspDeviceResponse.java
@@ -65,6 +65,10 @@ public class NuageVspDeviceResponse extends BaseResponse {
     @Param(description = "the time to wait after failure before retrying to communicate to
Nuage VSD")
     private long apiRetryInterval;
 
+    @SerializedName(VspConstants.NUAGE_VSP_CMS_ID)
+    @Param(description = "the CMS ID generated by the Nuage VSD")
+    private String cmsId;
+
     public void setId(String vspDetailsId) {
         this.id = vspDetailsId;
     }
@@ -101,4 +105,7 @@ public class NuageVspDeviceResponse extends BaseResponse {
         this.apiRetryInterval = apiRetryInterval;
     }
 
+    public void setCmsId(String cmsId) {
+        this.cmsId = cmsId;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ae0d6b32/plugins/network-elements/nuage-vsp/src/com/cloud/network/element/NuageVspElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nuage-vsp/src/com/cloud/network/element/NuageVspElement.java
b/plugins/network-elements/nuage-vsp/src/com/cloud/network/element/NuageVspElement.java
index cb0d698..d0d5ad2 100644
--- a/plugins/network-elements/nuage-vsp/src/com/cloud/network/element/NuageVspElement.java
+++ b/plugins/network-elements/nuage-vsp/src/com/cloud/network/element/NuageVspElement.java
@@ -59,6 +59,7 @@ import com.cloud.network.dao.NuageVspDao;
 import com.cloud.network.dao.PhysicalNetworkDao;
 import com.cloud.network.dao.PhysicalNetworkVO;
 import com.cloud.network.manager.NuageVspManager;
+import com.cloud.network.manager.NuageVspManagerImpl;
 import com.cloud.network.rules.FirewallRule;
 import com.cloud.network.rules.FirewallRule.FirewallRuleType;
 import com.cloud.network.rules.FirewallRuleVO;
@@ -69,7 +70,9 @@ import com.cloud.network.vpc.NetworkACLItemVO;
 import com.cloud.network.vpc.PrivateGateway;
 import com.cloud.network.vpc.StaticRouteProfile;
 import com.cloud.network.vpc.Vpc;
+import com.cloud.network.vpc.VpcOfferingServiceMapVO;
 import com.cloud.network.vpc.dao.VpcDao;
+import com.cloud.network.vpc.dao.VpcOfferingServiceMapDao;
 import com.cloud.offering.NetworkOffering;
 import com.cloud.offerings.NetworkOfferingVO;
 import com.cloud.offerings.dao.NetworkOfferingDao;
@@ -135,6 +138,8 @@ public class NuageVspElement extends AdapterBase implements ConnectivityProvider
     @Inject
     VpcDao _vpcDao;
     @Inject
+    VpcOfferingServiceMapDao _vpcOfferingSrvcDao;
+    @Inject
     NetworkOfferingServiceMapDao _ntwkOfferingSrvcDao;
     @Inject
     AgentManager _agentMgr;
@@ -426,6 +431,16 @@ public class NuageVspElement extends AdapterBase implements ConnectivityProvider
             }
         }
 
+        if (network.getVpcId() != null) {
+            NetworkOffering networkOffering = _ntwkOfferingDao.findById(network.getNetworkOfferingId());
+            if (!networkOffering.getIsPersistent()) {
+                if (s_logger.isDebugEnabled()) {
+                    s_logger.debug("NuageVsp can't handle VPC tiers which use a network offering
which are not persistent");
+                }
+                return false;
+            }
+        }
+
         return true;
     }
 
@@ -586,6 +601,22 @@ public class NuageVspElement extends AdapterBase implements ConnectivityProvider
 
     @Override
     public boolean implementVpc(Vpc vpc, DeployDestination dest, ReservationContext context)
throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException
{
+        List<VpcOfferingServiceMapVO> vpcOfferingServices = _vpcOfferingSrvcDao.listByVpcOffId(vpc.getVpcOfferingId());
+        Map<Network.Service, Set<Network.Provider>> supportedVpcServices = NuageVspManagerImpl.NUAGE_VSP_VPC_SERVICE_MAP;
+        for (VpcOfferingServiceMapVO vpcOfferingService : vpcOfferingServices) {
+            Network.Service service = Network.Service.getService(vpcOfferingService.getService());
+            if (!supportedVpcServices.containsKey(service)) {
+                s_logger.warn(String.format("NuageVsp doesn't support service %s for VPCs",
service.getName()));
+                return false;
+            }
+
+            Network.Provider provider = Network.Provider.getProvider(vpcOfferingService.getProvider());
+            if (!supportedVpcServices.get(service).contains(provider)) {
+                s_logger.warn(String.format("NuageVsp doesn't support provider %s for service
%s for VPCs", provider.getName(), service.getName()));
+                return false;
+            }
+        }
+
         return true;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ae0d6b32/plugins/network-elements/nuage-vsp/src/com/cloud/network/guru/NuageVspGuestNetworkGuru.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nuage-vsp/src/com/cloud/network/guru/NuageVspGuestNetworkGuru.java
b/plugins/network-elements/nuage-vsp/src/com/cloud/network/guru/NuageVspGuestNetworkGuru.java
index 5f69a21..2037d92 100644
--- a/plugins/network-elements/nuage-vsp/src/com/cloud/network/guru/NuageVspGuestNetworkGuru.java
+++ b/plugins/network-elements/nuage-vsp/src/com/cloud/network/guru/NuageVspGuestNetworkGuru.java
@@ -25,6 +25,7 @@ import com.cloud.agent.api.guru.DeallocateVmVspCommand;
 import com.cloud.agent.api.guru.ImplementNetworkVspCommand;
 import com.cloud.agent.api.guru.ReserveVmInterfaceVspCommand;
 import com.cloud.agent.api.guru.TrashNetworkVspCommand;
+import com.cloud.configuration.ConfigurationManager;
 import com.cloud.dc.DataCenter;
 import com.cloud.dc.DataCenter.NetworkType;
 import com.cloud.dc.VlanVO;
@@ -105,6 +106,8 @@ public class NuageVspGuestNetworkGuru extends GuestNetworkGuru {
     AgentManager _agentMgr;
     @Inject
     NuageVspManager _nuageVspManager;
+    @Inject
+    ConfigurationManager _configMgr;
 
     public NuageVspGuestNetworkGuru() {
         super();
@@ -347,6 +350,12 @@ public class NuageVspGuestNetworkGuru extends GuestNetworkGuru {
     protected boolean canHandle(NetworkOffering offering, final NetworkType networkType,
final PhysicalNetwork physicalNetwork) {
         if (networkType == NetworkType.Advanced && isMyTrafficType(offering.getTrafficType())
&& (offering.getGuestType() == Network.GuestType.Isolated || offering.getGuestType()
== Network.GuestType.Shared)
                 && isMyIsolationMethod(physicalNetwork)) {
+            if (_configMgr.isOfferingForVpc(offering) && !offering.getIsPersistent())
{
+                if (s_logger.isDebugEnabled()) {
+                    s_logger.debug("NuageVsp can't handle VPC tiers which use a network offering
which are not persistent");
+                }
+                return false;
+            }
             return true;
         } else {
             if (s_logger.isTraceEnabled()) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ae0d6b32/plugins/network-elements/nuage-vsp/src/com/cloud/network/manager/NuageVspManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nuage-vsp/src/com/cloud/network/manager/NuageVspManagerImpl.java
b/plugins/network-elements/nuage-vsp/src/com/cloud/network/manager/NuageVspManagerImpl.java
index ce2a363..16fd11d 100644
--- a/plugins/network-elements/nuage-vsp/src/com/cloud/network/manager/NuageVspManagerImpl.java
+++ b/plugins/network-elements/nuage-vsp/src/com/cloud/network/manager/NuageVspManagerImpl.java
@@ -105,6 +105,7 @@ import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
 import net.nuage.vsp.acs.NuageVspPluginClientLoader;
 import org.apache.cloudstack.framework.config.ConfigKey;
 import org.apache.cloudstack.framework.config.Configurable;
@@ -120,7 +121,6 @@ import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -137,8 +137,7 @@ public class NuageVspManagerImpl extends ManagerBase implements NuageVspManager,
 
     private static final int ONE_MINUTE_MULTIPLIER = 60 * 1000;
 
-    private static final Set<Network.Provider> NUAGE_VSP_PROVIDERS;
-    private static final Map<Network.Service, Set<Network.Provider>> NUAGE_VSP_VPC_SERVICE_MAP;
+    public static final Map<Network.Service, Set<Network.Provider>> NUAGE_VSP_VPC_SERVICE_MAP;
     private static final ConfigKey[] NUAGE_VSP_CONFIG_KEYS = new ConfigKey<?>[] { NuageVspConfigDns,
NuageVspDnsExternal, NuageVspConfigGateway,
             NuageVspSharedNetworkDomainTemplateName, NuageVspVpcDomainTemplateName, NuageVspIsolatedNetworkDomainTemplateName
};
 
@@ -195,13 +194,18 @@ public class NuageVspManagerImpl extends ManagerBase implements NuageVspManager,
     MessageBus _messageBus;
 
     static {
-        NUAGE_VSP_PROVIDERS = ImmutableSet.of(Network.Provider.NuageVsp);
+        Set<Network.Provider> nuageVspProviders = ImmutableSet.of(Network.Provider.NuageVsp);
+        Set<Network.Provider> userDataProviders = ImmutableSet.of(Network.Provider.VPCVirtualRouter);
+        Set<Network.Provider> lbProviders = ImmutableSet.of(Network.Provider.InternalLbVm);
         NUAGE_VSP_VPC_SERVICE_MAP = ImmutableMap.<Network.Service, Set<Network.Provider>>builder()
-                .put(Network.Service.Connectivity, NUAGE_VSP_PROVIDERS)
-                .put(Network.Service.Dhcp, NUAGE_VSP_PROVIDERS)
-                .put(Network.Service.StaticNat, NUAGE_VSP_PROVIDERS)
-                .put(Network.Service.SourceNat, NUAGE_VSP_PROVIDERS)
-                .put(Network.Service.NetworkACL, NUAGE_VSP_PROVIDERS)
+                .put(Network.Service.Connectivity, nuageVspProviders)
+                .put(Network.Service.Gateway, nuageVspProviders)
+                .put(Network.Service.Dhcp, nuageVspProviders)
+                .put(Network.Service.StaticNat, nuageVspProviders)
+                .put(Network.Service.SourceNat, nuageVspProviders)
+                .put(Network.Service.NetworkACL, nuageVspProviders)
+                .put(Network.Service.UserData, userDataProviders)
+                .put(Network.Service.Lb, lbProviders)
                 .build();
     }
 
@@ -424,6 +428,7 @@ public class NuageVspManagerImpl extends ManagerBase implements NuageVspManager,
         HostVO nuageVspHost = _hostDao.findById(nuageVspDeviceVO.getHostId());
         _hostDao.loadDetails(nuageVspHost);
 
+        NuageVspResource.Configuration resourceConfiguration = NuageVspResource.Configuration.fromConfiguration(nuageVspHost.getDetails());
         NuageVspDeviceResponse response = new NuageVspDeviceResponse();
         response.setDeviceName(nuageVspDeviceVO.getDeviceName());
         PhysicalNetwork pnw = ApiDBUtils.findPhysicalNetworkById(nuageVspDeviceVO.getPhysicalNetworkId());
@@ -432,12 +437,13 @@ public class NuageVspManagerImpl extends ManagerBase implements NuageVspManager,
         }
         response.setId(nuageVspDeviceVO.getUuid());
         response.setProviderName(nuageVspDeviceVO.getProviderName());
-        response.setHostName(nuageVspHost.getDetail("hostname"));
-        response.setPort(Integer.parseInt(nuageVspHost.getDetail("port")));
-        String apiRelativePath = nuageVspHost.getDetail("apirelativepath");
+        response.setHostName(resourceConfiguration.hostName());
+        response.setPort(Integer.parseInt(resourceConfiguration.port()));
+        String apiRelativePath = resourceConfiguration.apiRelativePath();
         response.setApiVersion(apiRelativePath.substring(apiRelativePath.lastIndexOf('/')
+ 1));
-        response.setApiRetryCount(Integer.parseInt(nuageVspHost.getDetail("retrycount")));
-        response.setApiRetryInterval(Long.parseLong(nuageVspHost.getDetail("retryinterval")));
+        response.setApiRetryCount(Integer.parseInt(resourceConfiguration.retryCount()));
+        response.setApiRetryInterval(Long.parseLong(resourceConfiguration.retryInterval()));
+        response.setCmsId(resourceConfiguration.nuageVspCmsId());
         response.setObjectName("nuagevspdevice");
         return response;
     }
@@ -770,7 +776,7 @@ public class NuageVspManagerImpl extends ManagerBase implements NuageVspManager,
                     defaultNuageVspSharedSGNetworkOffering.setState(NetworkOffering.State.Enabled);
                     defaultNuageVspSharedSGNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(defaultNuageVspSharedSGNetworkOffering);
 
-                    Map<Network.Service, Network.Provider> defaultNuageVspSharedSGNetworkOfferingProviders
= new HashMap<>();
+                    Map<Network.Service, Network.Provider> defaultNuageVspSharedSGNetworkOfferingProviders
= new HashMap<Network.Service, Network.Provider>();
                     defaultNuageVspSharedSGNetworkOfferingProviders.put(Network.Service.Dhcp,
Network.Provider.NuageVsp);
                     defaultNuageVspSharedSGNetworkOfferingProviders.put(Network.Service.SecurityGroup,
Network.Provider.NuageVsp);
                     defaultNuageVspSharedSGNetworkOfferingProviders.put(Network.Service.Connectivity,
Network.Provider.NuageVsp);
@@ -794,16 +800,15 @@ public class NuageVspManagerImpl extends ManagerBase implements NuageVspManager,
         Transaction.execute(new TransactionCallbackNoReturn() {
             @Override
             public void doInTransactionWithoutResult(TransactionStatus status) {
-                if (_vpcOffDao.findByUniqueName(nuageVPCOfferingName) == null) {
+                VpcOffering offering = _vpcOffDao.findByUniqueName(nuageVPCOfferingName);
+                if (offering == null) {
                     if (s_logger.isDebugEnabled()) {
                         s_logger.debug("Creating default Nuage VPC offering " + nuageVPCOfferingName);
                     }
 
-                    Map<Network.Service, Set<Network.Provider>> svcProviderMap
= Maps.newHashMap(NUAGE_VSP_VPC_SERVICE_MAP);
-                    Set<Network.Provider> userDataProviders = Collections.singleton(Network.Provider.VPCVirtualRouter);
-                    svcProviderMap.put(Network.Service.UserData, userDataProviders);
-
-                    createVpcOffering(nuageVPCOfferingName, nuageVPCOfferingDisplayText,
svcProviderMap, true, VpcOffering.State.Enabled, null);
+                    createVpcOffering(nuageVPCOfferingName, nuageVPCOfferingDisplayText,
NUAGE_VSP_VPC_SERVICE_MAP, true, VpcOffering.State.Enabled, null);
+                } else {
+                    updateVpcOffering(offering, NUAGE_VSP_VPC_SERVICE_MAP);
                 }
             }
         });
@@ -822,7 +827,7 @@ public class NuageVspManagerImpl extends ManagerBase implements NuageVspManager,
                     offering.setState(state);
                 }
                 if (s_logger.isDebugEnabled()) {
-                    s_logger.debug("Adding vpc offering " + offering);
+                    s_logger.debug(String.format("Adding vpc offering %s", offering));
                 }
                 offering = _vpcOffDao.persist(offering);
                 // populate services and providers
@@ -834,11 +839,49 @@ public class NuageVspManagerImpl extends ManagerBase implements NuageVspManager,
                                 VpcOfferingServiceMapVO offService = new VpcOfferingServiceMapVO(offering.getId(),
service, provider);
                                 _vpcOffSvcMapDao.persist(offService);
                                 if (s_logger.isTraceEnabled()) {
-                                    s_logger.trace("Added service for the vpc offering: "
+ offService + " with provider " + provider.getName());
+                                    s_logger.trace(String.format("Added service for the vpc
offering: %s with provider %s", offService, provider.getName()));
                                 }
                             }
                         } else {
-                            throw new InvalidParameterValueException("Provider is missing
for the VPC offering service " + service.getName());
+                            throw new InvalidParameterValueException(String.format("Provider
is missing for the VPC offering service %s", service.getName()));
+                        }
+                    }
+                }
+                return offering;
+            }
+        });
+    }
+
+    @DB
+    protected void updateVpcOffering(final VpcOffering offering, final Map<Network.Service,
Set<Network.Provider>> svcProviderMap) {
+        Transaction.execute(new TransactionCallback<VpcOffering>() {
+            @Override
+            public VpcOffering doInTransaction(TransactionStatus status) {
+                if (s_logger.isDebugEnabled()) {
+                    s_logger.debug(String.format("Updating vpc offering %s", offering));
+                }
+
+                List<VpcOfferingServiceMapVO> currentVpcOfferingServices = _vpcOffSvcMapDao.listByVpcOffId(offering.getId());
+                Map<Network.Service, Set<Network.Provider>> currentSvcProviderMap
= Maps.newHashMap();
+                for (VpcOfferingServiceMapVO vpcOfferingService : currentVpcOfferingServices)
{
+                    Network.Service service = Network.Service.getService(vpcOfferingService.getService());
+                    Network.Provider provider = Network.Provider.getProvider(vpcOfferingService.getProvider());
+
+                    if (!currentSvcProviderMap.containsKey(service)) {
+                        currentSvcProviderMap.put(service, Sets.newHashSet(provider));
+                    } else if (!currentSvcProviderMap.get(service).contains(provider)) {
+                        currentSvcProviderMap.get(service).add(provider);
+                    }
+                }
+
+                for (Network.Service service : svcProviderMap.keySet()) {
+                    for (Network.Provider provider : svcProviderMap.get(service)) {
+                        if (currentSvcProviderMap.get(service) == null || !currentSvcProviderMap.get(service).contains(provider))
{
+                            VpcOfferingServiceMapVO offService = new VpcOfferingServiceMapVO(offering.getId(),
service, provider);
+                            _vpcOffSvcMapDao.persist(offService);
+                            if (s_logger.isDebugEnabled()) {
+                                s_logger.debug(String.format("Added service for the vpc offering:
%s", offService));
+                            }
                         }
                     }
                 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ae0d6b32/plugins/network-elements/nuage-vsp/test/com/cloud/network/element/NuageVspElementTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nuage-vsp/test/com/cloud/network/element/NuageVspElementTest.java
b/plugins/network-elements/nuage-vsp/test/com/cloud/network/element/NuageVspElementTest.java
index bbdf764..2f5ce7d 100644
--- a/plugins/network-elements/nuage-vsp/test/com/cloud/network/element/NuageVspElementTest.java
+++ b/plugins/network-elements/nuage-vsp/test/com/cloud/network/element/NuageVspElementTest.java
@@ -142,6 +142,12 @@ public class NuageVspElementTest {
         final Network net = mock(Network.class);
         when(net.getBroadcastDomainType()).thenReturn(BroadcastDomainType.Vsp);
         when(net.getId()).thenReturn(NETWORK_ID);
+        when(net.getNetworkOfferingId()).thenReturn(NETWORK_ID);
+
+        final NetworkOfferingVO ntwkoffer = mock(NetworkOfferingVO.class);
+        when(ntwkoffer.getId()).thenReturn(NETWORK_ID);
+        when(ntwkoffer.getIsPersistent()).thenReturn(true);
+        when(ntwkOfferingDao.findById(NETWORK_ID)).thenReturn(ntwkoffer);
 
         when(ntwkSrvcDao.canProviderSupportServiceInNetwork(NETWORK_ID, Service.Connectivity,
Provider.NuageVsp)).thenReturn(true);
         // Golden path

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ae0d6b32/plugins/network-elements/nuage-vsp/test/com/cloud/network/guru/NuageVspGuestNetworkGuruTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nuage-vsp/test/com/cloud/network/guru/NuageVspGuestNetworkGuruTest.java
b/plugins/network-elements/nuage-vsp/test/com/cloud/network/guru/NuageVspGuestNetworkGuruTest.java
index 18c088f..c8d23ab 100644
--- a/plugins/network-elements/nuage-vsp/test/com/cloud/network/guru/NuageVspGuestNetworkGuruTest.java
+++ b/plugins/network-elements/nuage-vsp/test/com/cloud/network/guru/NuageVspGuestNetworkGuruTest.java
@@ -22,6 +22,7 @@ package com.cloud.network.guru;
 import com.cloud.agent.AgentManager;
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.Command;
+import com.cloud.configuration.ConfigurationManager;
 import com.cloud.dc.DataCenter;
 import com.cloud.dc.DataCenter.NetworkType;
 import com.cloud.dc.DataCenterVO;
@@ -78,6 +79,7 @@ import static com.cloud.network.manager.NuageVspManager.NuageVspIsolatedNetworkD
 import static com.cloud.network.manager.NuageVspManager.NuageVspSharedNetworkDomainTemplateName;
 import static com.cloud.network.manager.NuageVspManager.NuageVspVpcDomainTemplateName;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.Matchers.any;
 import static org.mockito.Matchers.eq;
@@ -102,6 +104,7 @@ public class NuageVspGuestNetworkGuruTest {
     ConfigurationDao configDao = mock(ConfigurationDao.class);
     IPAddressDao ipAddressDao = mock(IPAddressDao.class);
     NuageVspManager nuageVspManager = mock(NuageVspManager.class);
+    ConfigurationManager configurationManager = mock(ConfigurationManager.class);
 
     NetworkDao netdao = mock(NetworkDao.class);
     NuageVspGuestNetworkGuru guru;
@@ -126,6 +129,7 @@ public class NuageVspGuestNetworkGuruTest {
         guru._configDao = configDao;
         guru._ipAddressDao = ipAddressDao;
         guru._nuageVspManager = nuageVspManager;
+        guru._configMgr = configurationManager;
 
         final DataCenterVO dc = mock(DataCenterVO.class);
         when(dc.getNetworkType()).thenReturn(NetworkType.Advanced);
@@ -144,6 +148,8 @@ public class NuageVspGuestNetworkGuruTest {
         when(offering.getId()).thenReturn(NETWORK_ID);
         when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
         when(offering.getGuestType()).thenReturn(GuestType.Isolated);
+        when(offering.getIsPersistent()).thenReturn(false);
+        when(configurationManager.isOfferingForVpc(any(NetworkOffering.class))).thenReturn(false);
 
         final PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class);
         when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] {"VSP"}));
@@ -151,25 +157,28 @@ public class NuageVspGuestNetworkGuruTest {
 
         when(nosd.areServicesSupportedByNetworkOffering(NETWORK_ID, Service.Connectivity)).thenReturn(true);
 
-        assertTrue(guru.canHandle(offering, NetworkType.Advanced, physnet) == true);
+        assertTrue(guru.canHandle(offering, NetworkType.Advanced, physnet));
 
         // Not supported TrafficType != Guest
         when(offering.getTrafficType()).thenReturn(TrafficType.Management);
-        assertFalse(guru.canHandle(offering, NetworkType.Advanced, physnet) == true);
+        assertFalse(guru.canHandle(offering, NetworkType.Advanced, physnet));
 
         // Supported: GuestType Shared
         when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
         when(offering.getGuestType()).thenReturn(GuestType.Shared);
-        assertTrue(guru.canHandle(offering, NetworkType.Advanced, physnet) == true);
+        assertTrue(guru.canHandle(offering, NetworkType.Advanced, physnet));
 
         // Not supported: Basic networking
         when(offering.getGuestType()).thenReturn(GuestType.Isolated);
-        assertFalse(guru.canHandle(offering, NetworkType.Basic, physnet) == true);
+        assertFalse(guru.canHandle(offering, NetworkType.Basic, physnet));
 
         // Not supported: IsolationMethod != STT
         when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] {"VLAN"}));
-        assertFalse(guru.canHandle(offering, NetworkType.Advanced, physnet) == true);
+        assertFalse(guru.canHandle(offering, NetworkType.Advanced, physnet));
 
+        // Not supported: Non-persistent VPC tier
+        when(configurationManager.isOfferingForVpc(any(NetworkOffering.class))).thenReturn(true);
+        assertFalse(guru.canHandle(offering, NetworkType.Advanced, physnet));
     }
 
     @Test
@@ -187,6 +196,8 @@ public class NuageVspGuestNetworkGuruTest {
         when(offering.getId()).thenReturn(NETWORK_ID);
         when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
         when(offering.getGuestType()).thenReturn(GuestType.Isolated);
+        when(offering.getIsPersistent()).thenReturn(false);
+        when(configurationManager.isOfferingForVpc(any(NetworkOffering.class))).thenReturn(false);
 
         when(nosd.areServicesSupportedByNetworkOffering(NETWORK_ID, Service.Connectivity)).thenReturn(true);
 
@@ -197,6 +208,10 @@ public class NuageVspGuestNetworkGuruTest {
         final Network designednetwork = guru.design(offering, plan, network, account);
         assertTrue(designednetwork != null);
         assertTrue(designednetwork.getBroadcastDomainType() == BroadcastDomainType.Vsp);
+
+        // Can't design non-persistent VPC tier
+        when(configurationManager.isOfferingForVpc(any(NetworkOffering.class))).thenReturn(true);
+        assertNull(guru.design(offering, plan, network, account));
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ae0d6b32/server/src/com/cloud/network/vpc/VpcManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpc/VpcManagerImpl.java b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
index 18fbfe2..706f4c4 100644
--- a/server/src/com/cloud/network/vpc/VpcManagerImpl.java
+++ b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
@@ -46,6 +46,7 @@ import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationSe
 import org.apache.cloudstack.framework.config.ConfigDepot;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
 import org.apache.cloudstack.managed.context.ManagedContextRunnable;
+import org.apache.commons.collections.CollectionUtils;
 import org.apache.log4j.Logger;
 
 import com.cloud.configuration.Config;
@@ -402,8 +403,6 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager,
VpcProvis
             svcProviderMap.put(Service.NetworkACL, defaultProviders);
         }
 
-        svcProviderMap.put(Service.Gateway, defaultProviders);
-
         if (serviceProviders != null) {
             for (final Entry<String, List<String>> serviceEntry : serviceProviders.entrySet())
{
                 final Network.Service service = Network.Service.getService(serviceEntry.getKey());
@@ -425,6 +424,12 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager,
VpcProvis
             }
         }
 
+        // add gateway provider (if sourceNat provider is enabled)
+        final Set<Provider> sourceNatServiceProviders = svcProviderMap.get(Service.SourceNat);
+        if (CollectionUtils.isNotEmpty(sourceNatServiceProviders)) {
+            svcProviderMap.put(Service.Gateway, sourceNatServiceProviders);
+        }
+
         validateConnectivtyServiceCapabilities(svcProviderMap.get(Service.Connectivity),
serviceCapabilitystList);
 
         final boolean supportsDistributedRouter = isVpcOfferingSupportsDistributedRouter(serviceCapabilitystList);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ae0d6b32/server/src/com/cloud/user/DomainManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/user/DomainManagerImpl.java b/server/src/com/cloud/user/DomainManagerImpl.java
index 912aa8b..e056e2d 100644
--- a/server/src/com/cloud/user/DomainManagerImpl.java
+++ b/server/src/com/cloud/user/DomainManagerImpl.java
@@ -308,6 +308,7 @@ public class DomainManagerImpl extends ManagerBase implements DomainManager,
Dom
 
             cleanupDomainOfferings(domain.getId());
             CallContext.current().putContextParameter(Domain.class, domain.getUuid());
+            _messageBus.publish(_name, MESSAGE_REMOVE_DOMAIN_EVENT, PublishScope.LOCAL, domain);
             return true;
         } catch (Exception ex) {
             s_logger.error("Exception deleting domain with id " + domain.getId(), ex);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ae0d6b32/ui/scripts/configuration.js
----------------------------------------------------------------------
diff --git a/ui/scripts/configuration.js b/ui/scripts/configuration.js
index 14b0e15..4f7947a 100644
--- a/ui/scripts/configuration.js
+++ b/ui/scripts/configuration.js
@@ -3583,7 +3583,10 @@
                                             });
                                             networkServiceObjs.push({
                                                 name: 'Lb',
-                                                provider: [{name: 'VpcVirtualRouter'}]
+                                                provider: [
+                                                       {name: 'VpcVirtualRouter'},
+                                                       {name: 'InternalLbVm'}
+                                                ]
                                             });
                                             networkServiceObjs.push({
                                                 name: 'Gateway',


Mime
View raw message