Repository: cloudstack Updated Branches: refs/heads/master a05718cb2 -> b3f18e7d7
implementation of the featured requests in the issue CLOUDSTACK-6139. Signed-off-by: Daan Hoogland <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b3f18e7d Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b3f18e7d Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b3f18e7d Branch: refs/heads/master Commit: b3f18e7d74a0f09db9977554a6c7648b7edbc33d Parents: a05718c Author: wrodrigues <[email protected]> Authored: Tue Apr 8 13:54:54 2014 +0200 Committer: Daan Hoogland <[email protected]> Committed: Thu Apr 17 20:51:46 2014 +0200 ---------------------------------------------------------------------- server/src/com/cloud/configuration/Config.java | 2 +- .../deploy/DeploymentPlanningManagerImpl.java | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b3f18e7d/server/src/com/cloud/configuration/Config.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java index 6827197..e3be281 100755 --- a/server/src/com/cloud/configuration/Config.java +++ b/server/src/com/cloud/configuration/Config.java @@ -702,7 +702,7 @@ public enum Config { "system.vm.use.local.storage", "false", "Indicates whether to use local storage pools or shared storage pools for system VMs.", - null), + null, ConfigKey.Scope.Zone.toString()), SystemVMAutoReserveCapacity( "Advanced", ManagementServer.class, http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b3f18e7d/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 5e6ab49..db6fa5f 100644 --- a/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java +++ b/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java @@ -199,6 +199,8 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy protected StoragePoolHostDao _poolHostDao; @Inject + protected DataCenterDao _zoneDao; + @Inject protected VolumeDao _volsDao; @Inject protected CapacityManager _capacityMgr; @@ -1259,7 +1261,18 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy boolean useLocalStorage = false; if (vmProfile.getType() != VirtualMachine.Type.User) { String ssvmUseLocalStorage = _configDao.getValue(Config.SystemVMUseLocalStorage.key()); - if (ssvmUseLocalStorage.equalsIgnoreCase("true")) { + + DataCenterVO zone = _zoneDao.findById(plan.getDataCenterId()); + + // It should not happen to have a "null" zone here. There can be NO instance if there is NO zone, + // so this part of the code would never be reached if no zone has been created. + // + // Added the check and the comment just to make it clear. + boolean zoneUsesLocalStorage = zone != null ? zone.isLocalStorageEnabled() : false; + + // Local storage is used for the NON User VMs if, and only if, the Zone is marked to use local storage AND + // the global settings (ssvmUseLocalStorage) is set to true. Otherwise, the global settings won't be applied. + if (ssvmUseLocalStorage.equalsIgnoreCase("true") && zoneUsesLocalStorage) { useLocalStorage = true; } } else { @@ -1270,11 +1283,12 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy // when deploying VM based on ISO, we have a service offering // and an additional disk offering, use-local storage flag is // actually - // saved in service offering, overrde the flag from service + // saved in service offering, override the flag from service // offering when it is a ROOT disk if (!useLocalStorage && vmProfile.getServiceOffering().getUseLocalStorage()) { - if (toBeCreated.getVolumeType() == Volume.Type.ROOT) + if (toBeCreated.getVolumeType() == Volume.Type.ROOT) { useLocalStorage = true; + } } } diskProfile.setUseLocalStorage(useLocalStorage);
