Return-Path: X-Original-To: apmail-incubator-cloudstack-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-cloudstack-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D5E3FD761 for ; Wed, 12 Sep 2012 06:43:36 +0000 (UTC) Received: (qmail 99998 invoked by uid 500); 12 Sep 2012 06:43:35 -0000 Delivered-To: apmail-incubator-cloudstack-commits-archive@incubator.apache.org Received: (qmail 99809 invoked by uid 500); 12 Sep 2012 06:43:35 -0000 Mailing-List: contact cloudstack-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cloudstack-dev@incubator.apache.org Delivered-To: mailing list cloudstack-commits@incubator.apache.org Received: (qmail 98892 invoked by uid 99); 12 Sep 2012 06:43:29 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Sep 2012 06:43:29 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 2CD4935C02; Wed, 12 Sep 2012 06:43:29 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: edison@apache.org To: cloudstack-commits@incubator.apache.org X-Mailer: ASF-Git Admin Mailer Subject: [5/41] git commit: CS-16187: don't allow vpc offering creation with unsupported services (Firewall, SecurityGroup) Message-Id: <20120912064329.2CD4935C02@tyr.zones.apache.org> Date: Wed, 12 Sep 2012 06:43:29 +0000 (UTC) CS-16187: don't allow vpc offering creation with unsupported services (Firewall, SecurityGroup) Conflicts: server/src/com/cloud/network/vpc/VpcManagerImpl.java Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/f5c93973 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/f5c93973 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/f5c93973 Branch: refs/heads/4.0 Commit: f5c939732706228ca6044b561d4a4d6eb994b340 Parents: d0c526f Author: Alena Prokharchyk Authored: Tue Sep 11 16:59:43 2012 -0700 Committer: Alena Prokharchyk Committed: Tue Sep 11 17:05:04 2012 -0700 ---------------------------------------------------------------------- .../src/com/cloud/network/vpc/VpcManagerImpl.java | 13 +++++-------- 1 files changed, 5 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f5c93973/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 08a03b1..675ae59 100644 --- a/server/src/com/cloud/network/vpc/VpcManagerImpl.java +++ b/server/src/com/cloud/network/vpc/VpcManagerImpl.java @@ -17,6 +17,7 @@ package com.cloud.network.vpc; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -53,7 +54,6 @@ import com.cloud.exception.NetworkRuleConflictException; import com.cloud.exception.PermissionDeniedException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; -import com.cloud.exception.UnsupportedServiceException; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.network.IPAddressVO; import com.cloud.network.IpAddress; @@ -167,7 +167,8 @@ public class VpcManagerImpl implements VpcManager, Manager{ private final ScheduledExecutorService _executor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("VpcChecker")); private VpcProvider vpcElement = null; - + private final List nonSupportedServices = Arrays.asList(Service.SecurityGroup, Service.Firewall); + String _name; int _cleanupInterval; int _maxNetworks; @@ -265,14 +266,10 @@ public class VpcManagerImpl implements VpcManager, Manager{ for (String serviceName : supportedServices) { // validate if the service is supported Service service = Network.Service.getService(serviceName); - if (service == null || service == Service.Gateway) { - throw new InvalidParameterValueException("Invalid service " + serviceName); + if (service == null || nonSupportedServices.contains(service)) { + throw new InvalidParameterValueException("Service " + serviceName + " is not supported in VPC"); } - //don't allow security group service for vpc - if (service == Service.SecurityGroup) { - throw new UnsupportedServiceException("Service " + Service.SecurityGroup.getName() + " is not supported by VPC"); - } svcProviderMap.put(service, defaultProviders); if (service == Service.NetworkACL) { firewallSvs = true;