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 02:50:28 UTC

[1/2] git commit: updated refs/heads/master to 48574f2

Repository: cloudstack
Updated Branches:
  refs/heads/master 324b5d5a5 -> 48574f2d6


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/9f68870a
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9f68870a
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9f68870a

Branch: refs/heads/master
Commit: 9f68870a779d0b969e4fb8f766846537a456e2ad
Parents: 324b5d5
Author: Prachi Damle <pr...@citrix.com>
Authored: Wed Jul 2 16:32:13 2014 -0700
Committer: Prachi Damle <pr...@citrix.com>
Committed: Wed Jul 2 17:49:51 2014 -0700

----------------------------------------------------------------------
 .../cloud/deploy/DeploymentPlanningManagerImpl.java   | 10 +++++-----
 server/src/com/cloud/deploy/FirstFitPlanner.java      | 14 +++++++-------
 2 files changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9f68870a/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 db6fa5f..d6f87b9 100644
--- a/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java
+++ b/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java
@@ -1233,7 +1233,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");
@@ -1361,10 +1361,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/9f68870a/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 6ffe31f..8592456 100755
--- a/server/src/com/cloud/deploy/FirstFitPlanner.java
+++ b/server/src/com/cloud/deploy/FirstFitPlanner.java
@@ -191,7 +191,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()) {
@@ -322,7 +322,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);
@@ -465,11 +465,11 @@ 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());
-            }else{
+    private boolean isRootAdmin(VirtualMachineProfile vmProfile) {
+        if (vmProfile != null) {
+            if (vmProfile.getOwner() != null) {
+                return _accountMgr.isRootAdmin(vmProfile.getOwner().getId());
+            } else {
                 return false;
             }
         }


[2/2] git commit: updated refs/heads/master to 48574f2

Posted by pr...@apache.org.
CLOUDSTACK-7047: DeploymentPlanner should include disabled resources only when the VM owner is Admin account

Changes:
- removing unused imports


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

Branch: refs/heads/master
Commit: 48574f2d606ebddb358457301a3dbaa896e9595c
Parents: 9f68870
Author: Prachi Damle <pr...@citrix.com>
Authored: Wed Jul 2 17:24:29 2014 -0700
Committer: Prachi Damle <pr...@citrix.com>
Committed: Wed Jul 2 17:49:53 2014 -0700

----------------------------------------------------------------------
 server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java | 1 -
 server/src/com/cloud/deploy/FirstFitPlanner.java               | 1 -
 2 files changed, 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48574f2d/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 d6f87b9..bb94b76 100644
--- a/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java
+++ b/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java
@@ -120,7 +120,6 @@ import com.cloud.utils.db.TransactionStatus;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.fsm.StateListener;
 import com.cloud.vm.DiskProfile;
-import com.cloud.vm.ReservationContext;
 import com.cloud.vm.VMInstanceVO;
 import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachine.Event;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48574f2d/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 8592456..48780a7 100755
--- a/server/src/com/cloud/deploy/FirstFitPlanner.java
+++ b/server/src/com/cloud/deploy/FirstFitPlanner.java
@@ -56,7 +56,6 @@ import com.cloud.storage.dao.VolumeDao;
 import com.cloud.user.AccountManager;
 import com.cloud.utils.NumbersUtil;
 import com.cloud.utils.Pair;
-import com.cloud.vm.ReservationContext;
 import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
 import com.cloud.vm.dao.UserVmDao;