You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by pr...@apache.org on 2014/07/03 03:20:46 UTC
[2/2] git commit: updated refs/heads/4.4-forward to 40e28de
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.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/40e28de7
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/40e28de7
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/40e28de7
Branch: refs/heads/4.4-forward
Commit: 40e28de7275804f4483868ba8a737878ff54fba8
Parents: f37b152
Author: Prachi Damle <pr...@citrix.com>
Authored: Wed Jul 2 18:02:40 2014 -0700
Committer: Prachi Damle <pr...@citrix.com>
Committed: Wed Jul 2 18:02:40 2014 -0700
----------------------------------------------------------------------
.../com/cloud/deploy/DeploymentPlanningManagerImpl.java | 10 +++++-----
server/src/com/cloud/deploy/FirstFitPlanner.java | 12 ++++++------
2 files changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/40e28de7/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java b/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java
index aa3e6e1..0e02d1b 100644
--- a/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java
+++ b/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java
@@ -1244,7 +1244,7 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy
if (s_logger.isDebugEnabled()) {
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 (s_logger.isDebugEnabled()) {
s_logger.debug("Cannot allocate new storagepool for this volume in this cluster, allocation state is disabled");
@@ -1371,10 +1371,10 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy
return true;
}
- private boolean isRootAdmin(ReservationContext reservationContext) {
- if (reservationContext != null) {
- if (reservationContext.getAccount() != null) {
- return _accountMgr.isRootAdmin(reservationContext.getAccount().getId());
+ private boolean isRootAdmin(VirtualMachineProfile vmProfile) {
+ if (vmProfile != null) {
+ if (vmProfile.getOwner() != null) {
+ return _accountMgr.isRootAdmin(vmProfile.getOwner().getId());
} else {
return false;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/40e28de7/server/src/com/cloud/deploy/FirstFitPlanner.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/deploy/FirstFitPlanner.java b/server/src/com/cloud/deploy/FirstFitPlanner.java
index 1c3a9f1..c29101d 100755
--- a/server/src/com/cloud/deploy/FirstFitPlanner.java
+++ b/server/src/com/cloud/deploy/FirstFitPlanner.java
@@ -190,7 +190,7 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla
}
podsWithCapacity.removeAll(avoid.getPodsToAvoid());
}
- if (!isRootAdmin(plan.getReservationContext())) {
+ if (!isRootAdmin(vmProfile)) {
List<Long> disabledPods = listDisabledPods(plan.getDataCenterId());
if (!disabledPods.isEmpty()) {
if (s_logger.isDebugEnabled()) {
@@ -321,7 +321,7 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla
prioritizedClusterIds.removeAll(avoid.getClustersToAvoid());
}
- if (!isRootAdmin(plan.getReservationContext())) {
+ if (!isRootAdmin(vmProfile)) {
List<Long> disabledClusters = new ArrayList<Long>();
if (isZone) {
disabledClusters = listDisabledClusters(plan.getDataCenterId(), null);
@@ -464,10 +464,10 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla
}
- private boolean isRootAdmin(ReservationContext reservationContext) {
- if(reservationContext != null){
- if(reservationContext.getAccount() != null){
- return _accountMgr.isRootAdmin(reservationContext.getAccount().getId());
+ private boolean isRootAdmin(VirtualMachineProfile vmProfile) {
+ if (vmProfile != null) {
+ if (vmProfile.getOwner() != null) {
+ return _accountMgr.isRootAdmin(vmProfile.getOwner().getId());
}else{
return false;
}