cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alena1...@apache.org
Subject [42/47] git commit: updated refs/heads/internallb to 3795048
Date Thu, 11 Apr 2013 21:23:05 GMT
Fixes for issues found while testing after the merge


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

Branch: refs/heads/internallb
Commit: eea0ed5c4e9b55b4ded12dc268c93f1cf3bb20a0
Parents: bbf7900
Author: Prachi Damle <prachi@cloud.com>
Authored: Thu Apr 11 12:17:31 2013 -0700
Committer: Prachi Damle <prachi@cloud.com>
Committed: Thu Apr 11 13:23:46 2013 -0700

----------------------------------------------------------------------
 .../user/affinitygroup/DeleteAffinityGroupCmd.java |    2 +-
 .../affinity/HostAntiAffinityProcessor.java        |    1 +
 .../affinity/AffinityGroupServiceImpl.java         |   10 +++++++++-
 3 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eea0ed5c/api/src/org/apache/cloudstack/api/command/user/affinitygroup/DeleteAffinityGroupCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/affinitygroup/DeleteAffinityGroupCmd.java
b/api/src/org/apache/cloudstack/api/command/user/affinitygroup/DeleteAffinityGroupCmd.java
index 4ceba29..ea4a010 100644
--- a/api/src/org/apache/cloudstack/api/command/user/affinitygroup/DeleteAffinityGroupCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/affinitygroup/DeleteAffinityGroupCmd.java
@@ -52,7 +52,7 @@ public class DeleteAffinityGroupCmd extends BaseAsyncCmd {
     @Parameter(name = ApiConstants.ID, type = CommandType.UUID, description = "The ID of
the affinity group. Mutually exclusive with name parameter", entityType = AffinityGroupResponse.class)
     private Long id;
 
-    @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The ID
of the affinity group. Mutually exclusive with id parameter")
+    @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "The name
of the affinity group. Mutually exclusive with id parameter")
     private String name;
 
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eea0ed5c/plugins/affinity-group-processors/host-anti-affinity/src/org/apache/cloudstack/affinity/HostAntiAffinityProcessor.java
----------------------------------------------------------------------
diff --git a/plugins/affinity-group-processors/host-anti-affinity/src/org/apache/cloudstack/affinity/HostAntiAffinityProcessor.java
b/plugins/affinity-group-processors/host-anti-affinity/src/org/apache/cloudstack/affinity/HostAntiAffinityProcessor.java
index 4011c02..430cf92 100644
--- a/plugins/affinity-group-processors/host-anti-affinity/src/org/apache/cloudstack/affinity/HostAntiAffinityProcessor.java
+++ b/plugins/affinity-group-processors/host-anti-affinity/src/org/apache/cloudstack/affinity/HostAntiAffinityProcessor.java
@@ -62,6 +62,7 @@ public class HostAntiAffinityProcessor extends AffinityProcessorBase implements
             }
 
             List<Long> groupVMIds = _affinityGroupVMMapDao.listVmIdsByAffinityGroup(group.getId());
+            groupVMIds.remove(vm.getId());
 
             for (Long groupVMId : groupVMIds) {
                 VMInstanceVO groupVM = _vmInstanceDao.findById(groupVMId);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eea0ed5c/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 5c7edc5..613c095 100644
--- a/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java
+++ b/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java
@@ -130,7 +130,9 @@ public class AffinityGroupServiceImpl extends ManagerBase implements AffinityGro
             throw new InvalidParameterValueException(
                     "Either the affinity group Id or group name must be specified to delete
the group");
         }
-
+        if (affinityGroupId == null) {
+            affinityGroupId = group.getId();
+        }
         // check permissions
         _accountMgr.checkAccess(caller, null, true, group);
 
@@ -302,11 +304,17 @@ public class AffinityGroupServiceImpl extends ManagerBase implements
AffinityGro
                     + "; make sure the virtual machine is stopped and not in an error state
before updating.");
         }
 
+        Account caller = UserContext.current().getCaller();
+        Account owner = _accountMgr.getAccount(vmInstance.getAccountId());
+
         // check that the affinity groups exist
         for (Long affinityGroupId : affinityGroupIds) {
             AffinityGroupVO ag = _affinityGroupDao.findById(affinityGroupId);
             if (ag == null) {
                 throw new InvalidParameterValueException("Unable to find affinity group by
id " + affinityGroupId);
+            } else {
+                // verify permissions
+                _accountMgr.checkAccess(caller, null, true, owner, ag);
             }
         }
         _affinityGroupVMMapDao.updateMap(vmId, affinityGroupIds);


Mime
View raw message