mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-7047: DeploymentPlanner should include disabled resources only when the VM owner is Admin account
Changes: -DeploymentPlanner should include disabled resources only when the VM owner is Admin account. The disabled resources should be ignored when VM is owned by any other user.
This commit is contained in:
parent
324b5d5a57
commit
9f68870a77
@ -1233,7 +1233,7 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy
|
|||||||
if (s_logger.isDebugEnabled()) {
|
if (s_logger.isDebugEnabled()) {
|
||||||
s_logger.debug("We need to allocate new storagepool for this volume");
|
s_logger.debug("We need to allocate new storagepool for this volume");
|
||||||
}
|
}
|
||||||
if (!isRootAdmin(plan.getReservationContext())) {
|
if (!isRootAdmin(vmProfile)) {
|
||||||
if (!isEnabledForAllocation(plan.getDataCenterId(), plan.getPodId(), plan.getClusterId())) {
|
if (!isEnabledForAllocation(plan.getDataCenterId(), plan.getPodId(), plan.getClusterId())) {
|
||||||
if (s_logger.isDebugEnabled()) {
|
if (s_logger.isDebugEnabled()) {
|
||||||
s_logger.debug("Cannot allocate new storagepool for this volume in this cluster, allocation state is disabled");
|
s_logger.debug("Cannot allocate new storagepool for this volume in this cluster, allocation state is disabled");
|
||||||
@ -1361,10 +1361,10 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isRootAdmin(ReservationContext reservationContext) {
|
private boolean isRootAdmin(VirtualMachineProfile vmProfile) {
|
||||||
if (reservationContext != null) {
|
if (vmProfile != null) {
|
||||||
if (reservationContext.getAccount() != null) {
|
if (vmProfile.getOwner() != null) {
|
||||||
return _accountMgr.isRootAdmin(reservationContext.getAccount().getId());
|
return _accountMgr.isRootAdmin(vmProfile.getOwner().getId());
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -191,7 +191,7 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla
|
|||||||
}
|
}
|
||||||
podsWithCapacity.removeAll(avoid.getPodsToAvoid());
|
podsWithCapacity.removeAll(avoid.getPodsToAvoid());
|
||||||
}
|
}
|
||||||
if (!isRootAdmin(plan.getReservationContext())) {
|
if (!isRootAdmin(vmProfile)) {
|
||||||
List<Long> disabledPods = listDisabledPods(plan.getDataCenterId());
|
List<Long> disabledPods = listDisabledPods(plan.getDataCenterId());
|
||||||
if (!disabledPods.isEmpty()) {
|
if (!disabledPods.isEmpty()) {
|
||||||
if (s_logger.isDebugEnabled()) {
|
if (s_logger.isDebugEnabled()) {
|
||||||
@ -322,7 +322,7 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla
|
|||||||
prioritizedClusterIds.removeAll(avoid.getClustersToAvoid());
|
prioritizedClusterIds.removeAll(avoid.getClustersToAvoid());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isRootAdmin(plan.getReservationContext())) {
|
if (!isRootAdmin(vmProfile)) {
|
||||||
List<Long> disabledClusters = new ArrayList<Long>();
|
List<Long> disabledClusters = new ArrayList<Long>();
|
||||||
if (isZone) {
|
if (isZone) {
|
||||||
disabledClusters = listDisabledClusters(plan.getDataCenterId(), null);
|
disabledClusters = listDisabledClusters(plan.getDataCenterId(), null);
|
||||||
@ -465,11 +465,11 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isRootAdmin(ReservationContext reservationContext) {
|
private boolean isRootAdmin(VirtualMachineProfile vmProfile) {
|
||||||
if(reservationContext != null){
|
if (vmProfile != null) {
|
||||||
if(reservationContext.getAccount() != null){
|
if (vmProfile.getOwner() != null) {
|
||||||
return _accountMgr.isRootAdmin(reservationContext.getAccount().getId());
|
return _accountMgr.isRootAdmin(vmProfile.getOwner().getId());
|
||||||
}else{
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user