Return-Path: X-Original-To: apmail-cloudstack-issues-archive@www.apache.org Delivered-To: apmail-cloudstack-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 97A4618717 for ; Thu, 3 Dec 2015 14:10:11 +0000 (UTC) Received: (qmail 94438 invoked by uid 500); 3 Dec 2015 14:10:11 -0000 Delivered-To: apmail-cloudstack-issues-archive@cloudstack.apache.org Received: (qmail 94382 invoked by uid 500); 3 Dec 2015 14:10:11 -0000 Mailing-List: contact issues-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 issues@cloudstack.apache.org Received: (qmail 94369 invoked by uid 500); 3 Dec 2015 14:10:11 -0000 Delivered-To: apmail-incubator-cloudstack-issues@incubator.apache.org Received: (qmail 94365 invoked by uid 99); 3 Dec 2015 14:10:11 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Dec 2015 14:10:11 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 018B52C1F6E for ; Thu, 3 Dec 2015 14:10:11 +0000 (UTC) Date: Thu, 3 Dec 2015 14:10:11 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: cloudstack-issues@incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CLOUDSTACK-6276) Affinity Groups within projects MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CLOUDSTACK-6276?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15037820#comment-15037820 ] ASF GitHub Bot commented on CLOUDSTACK-6276: -------------------------------------------- Github user ustcweizhou commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/1134#discussion_r46554416 --- Diff: server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java --- @@ -229,59 +205,99 @@ public AffinityGroupVO doInTransaction(TransactionStatus status) { return group; } }); + } - if (s_logger.isDebugEnabled()) { - s_logger.debug("Created affinity group =" + affinityGroupName); + private DomainVO getDomain(Long domainId) { + DomainVO domain = _domainDao.findById(domainId); + if (domain == null) { + throw new InvalidParameterValueException("Unable to find domain by specified id"); } + return domain; + } - return group; + private void verifyAffinityGroupNameInUse(long accountId, long domainId, String affinityGroupName) { + if (_affinityGroupDao.isNameInUse(accountId, domainId, affinityGroupName)) { + throw new InvalidParameterValueException("Unable to create affinity group, a group with name " + affinityGroupName + " already exists."); + } + } + + private void verifyDomainLevelAffinityGroupName(boolean domainLevel, long domainId, String affinityGroupName) { + if (domainLevel && _affinityGroupDao.findDomainLevelGroupByName(domainId, affinityGroupName) != null) { + throw new InvalidParameterValueException("Unable to create affinity group, a group with name " + affinityGroupName + " already exists under the domain."); + } } @DB - @Override @ActionEvent(eventType = EventTypes.EVENT_AFFINITY_GROUP_DELETE, eventDescription = "Deleting affinity group") - public boolean deleteAffinityGroup(Long affinityGroupId, String account, Long domainId, String affinityGroupName) { + public boolean deleteAffinityGroup(Long affinityGroupId, String account, Long projectId, Long domainId, String affinityGroupName) { + + AffinityGroupVO group = getAffinityGroup(affinityGroupId, account, projectId, domainId, affinityGroupName); + // check permissions Account caller = CallContext.current().getCallingAccount(); - Account owner = _accountMgr.finalizeOwner(caller, account, domainId, null); + _accountMgr.checkAccess(caller, AccessType.OperateEntry, true, group); --- End diff -- Checked the cloudstack, the difference of project admin and project user are http://docs.cloudstack.apache.org/projects/cloudstack-administration/en/4.6/projects.html The project administrator can pass on the role to another project member. The project administrator can also add more members, remove members from the project, set new resource limits (as long as they are below the global defaults set by the CloudStack administrator), and delete the project. When the administrator removes a member from the project, resources created by that user, such as VM instances, remain with the project. This brings us to the subject of resource ownership and which resources can be used by a project. so, @pdube you can ignore this comment. > Affinity Groups within projects > ------------------------------- > > Key: CLOUDSTACK-6276 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-6276 > Project: CloudStack > Issue Type: New Feature > Security Level: Public(Anyone can view this level - this is the default.) > Components: Management Server > Reporter: Ingo Jochim > > Hello, > I like to have the features "Affinity Group" and "Project" combined. > As far as I know I cannot use Affinity Groups within Projects. > Thanks and regards, > Ingo -- This message was sent by Atlassian JIRA (v6.3.4#6332)