Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8CDE1108C6 for ; Wed, 17 Jul 2013 17:35:48 +0000 (UTC) Received: (qmail 28399 invoked by uid 500); 17 Jul 2013 17:35:27 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 28016 invoked by uid 500); 17 Jul 2013 17:35:22 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 26686 invoked by uid 99); 17 Jul 2013 17:35:00 -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, 17 Jul 2013 17:35:00 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id B7AC58AC551; Wed, 17 Jul 2013 17:35:00 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: chipchilders@apache.org To: commits@cloudstack.apache.org Date: Wed, 17 Jul 2013 17:35:18 -0000 Message-Id: <140746d59fe1434890cf2edb023ebc37@git.apache.org> In-Reply-To: <3faeaf39edf94446882d887c431d21b9@git.apache.org> References: <3faeaf39edf94446882d887c431d21b9@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [19/50] [abbrv] git commit: updated refs/heads/ldapplugin to 7bc705e CLOUDSTACK-2159 Anti-Affinity - When "HostAntiAffinityProcessor" plugin is not included in the deployment , deployVirtualMachine() command does not error out when passing the affiitygroupnames parameter. Changes: - Added a check during vm deployment to see if a processor for the affinity group type is available Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ee664a1c Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ee664a1c Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ee664a1c Branch: refs/heads/ldapplugin Commit: ee664a1cac9030f1e9902a6d9a574788ae34f9a6 Parents: 9f019ec Author: Prachi Damle Authored: Tue Jul 16 15:21:14 2013 -0700 Committer: Prachi Damle Committed: Tue Jul 16 15:48:07 2013 -0700 ---------------------------------------------------------------------- .../affinity/AffinityGroupService.java | 2 ++ client/tomcatconf/applicationContext.xml.in | 4 +++- server/src/com/cloud/vm/UserVmManagerImpl.java | 8 +++++++- .../affinity/AffinityGroupServiceImpl.java | 20 ++++++++++++++++++++ 4 files changed, 32 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee664a1c/api/src/org/apache/cloudstack/affinity/AffinityGroupService.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/affinity/AffinityGroupService.java b/api/src/org/apache/cloudstack/affinity/AffinityGroupService.java index 7423c48..1b30e58 100644 --- a/api/src/org/apache/cloudstack/affinity/AffinityGroupService.java +++ b/api/src/org/apache/cloudstack/affinity/AffinityGroupService.java @@ -73,4 +73,6 @@ public interface AffinityGroupService { UserVm updateVMAffinityGroups(Long vmId, List affinityGroupIds); + boolean isAffinityGroupProcessorAvailable(String affinityGroupType); + } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee664a1c/client/tomcatconf/applicationContext.xml.in ---------------------------------------------------------------------- diff --git a/client/tomcatconf/applicationContext.xml.in b/client/tomcatconf/applicationContext.xml.in index 0f3d328..fa52d3f 100644 --- a/client/tomcatconf/applicationContext.xml.in +++ b/client/tomcatconf/applicationContext.xml.in @@ -899,7 +899,9 @@ - + + + http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee664a1c/server/src/com/cloud/vm/UserVmManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java index bd7a791..461176e 100755 --- a/server/src/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/com/cloud/vm/UserVmManagerImpl.java @@ -37,6 +37,7 @@ import org.apache.log4j.Logger; import org.apache.cloudstack.acl.ControlledEntity.ACLType; import org.apache.cloudstack.acl.SecurityChecker.AccessType; +import org.apache.cloudstack.affinity.AffinityGroupService; import org.apache.cloudstack.affinity.AffinityGroupVO; import org.apache.cloudstack.affinity.dao.AffinityGroupDao; import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao; @@ -414,6 +415,8 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use DedicatedResourceDao _dedicatedDao; @Inject ConfigurationServer _configServer; + @Inject + AffinityGroupService _affinityGroupService; protected ScheduledExecutorService _executor = null; protected int _expungeInterval; @@ -2488,7 +2491,10 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use for (Long affinityGroupId : affinityGroupIdList) { AffinityGroupVO ag = _affinityGroupDao.findById(affinityGroupId); if (ag == null) { - throw new InvalidParameterValueException("Unable to find affinity group by id " + affinityGroupId); + throw new InvalidParameterValueException("Unable to find affinity group " + ag); + } else if (!_affinityGroupService.isAffinityGroupProcessorAvailable(ag.getType())) { + throw new InvalidParameterValueException("Affinity group type is not supported for group: " + ag + + " ,type: " + ag.getType() + " , Please try again after removing the affinity group"); } else { // verify permissions _accountMgr.checkAccess(caller, null, true, owner, ag); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee664a1c/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java ---------------------------------------------------------------------- diff --git a/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java b/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java index 287e622..e1fba1d 100644 --- a/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java +++ b/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java @@ -82,6 +82,16 @@ public class AffinityGroupServiceImpl extends ManagerBase implements AffinityGro @Inject private UserVmDao _userVmDao; + protected List _affinityProcessors; + + public List getAffinityGroupProcessors() { + return _affinityProcessors; + } + + public void setAffinityGroupProcessors(List affinityProcessors) { + this._affinityProcessors = affinityProcessors; + } + @Override @ActionEvent(eventType = EventTypes.EVENT_AFFINITY_GROUP_CREATE, eventDescription = "Creating Affinity Group", create = true) public AffinityGroup createAffinityGroup(String account, Long domainId, String affinityGroupName, @@ -361,4 +371,14 @@ public class AffinityGroupServiceImpl extends ManagerBase implements AffinityGro } + @Override + public boolean isAffinityGroupProcessorAvailable(String affinityGroupType) { + for (AffinityGroupProcessor processor : _affinityProcessors) { + if (affinityGroupType != null && affinityGroupType.equals(processor.getType())) { + return true; + } + } + return false; + } + }