CLOUDSTACK-6139 router vm on local storage

This commit is contained in:
wrodrigues 2014-04-08 13:54:54 +02:00 committed by Daan Hoogland
parent 6598167bed
commit 31b3f0a5ce
2 changed files with 15 additions and 2 deletions

View File

@ -701,7 +701,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,

View File

@ -198,6 +198,8 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy
@Inject
protected StoragePoolHostDao _poolHostDao;
@Inject
protected DataCenterDao _zoneDao;
@Inject
protected VolumeDao _volsDao;
@Inject
@ -1271,7 +1273,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 {