You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by de...@apache.org on 2013/06/27 20:59:46 UTC

git commit: updated refs/heads/master to 0d78868

Updated Branches:
  refs/heads/master 4361418e4 -> 0d7886818


CLOUDSTACK-3064: Able to create an instance from different account of the same domain without
using affinity group even if the zone is dedicated to an account. The check to make sure that
explicit resources are not picked up for non-explicit deployment was present only at the domain
level for zones. Added a check at account level too.


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

Branch: refs/heads/master
Commit: 0d788681809f720f8ad55eb27c995d7f09ed7106
Parents: 4361418
Author: Saksham Srivastava <sa...@citrix.com>
Authored: Fri Jun 28 00:16:02 2013 +0530
Committer: Devdeep Singh <de...@gmail.com>
Committed: Fri Jun 28 00:32:17 2013 +0530

----------------------------------------------------------------------
 .../cloud/deploy/DeploymentPlanningManagerImpl.java    | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0d788681/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 4ef2152..142e63f 100644
--- a/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java
+++ b/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java
@@ -452,9 +452,22 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy
             DedicatedResourceVO dedicatedZone = _dedicatedDao.findByZoneId(dc.getId());
             if (dedicatedZone != null) {
                 long accountDomainId = vmProfile.getOwner().getDomainId();
+                long accountId = vmProfile.getOwner().getAccountId();
                 if (dedicatedZone.getDomainId() != null && !dedicatedZone.getDomainId().equals(accountDomainId)) {
                     throw new CloudRuntimeException("Failed to deploy VM. Zone " + dc.getName() + " is dedicated.");
                 }
+
+                // If a zone is dedicated to an account then all hosts in this zone will be explicitly dedicated to
+                // that account. So there won't be any shared hosts in the zone, the only way to deploy vms from that
+                // account will be to use explicit dedication affinity group.
+                if (dedicatedZone.getAccountId() != null) {
+                    if (dedicatedZone.getAccountId().equals(accountId)) {
+                        throw new CloudRuntimeException("Failed to deploy VM. There are no shared hosts available in" +
+                                " this dedicated zone.");
+                    } else {
+                        throw new CloudRuntimeException("Failed to deploy VM. Zone " + dc.getName() + " is dedicated.");
+                    }
+                }
             }
 
             List<HostPodVO> podsInDc = _podDao.listByDataCenterId(dc.getId());