mirror of https://github.com/apache/cloudstack.git
Fixes for issues found while testing after the merge
This commit is contained in:
parent
bbf7900732
commit
eea0ed5c4e
|
|
@ -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;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue