Skip to content

Commit 31b3f0a

Browse files
wilderrodriguesDaanHoogland
authored andcommitted
CLOUDSTACK-6139 router vm on local storage
1 parent 6598167 commit 31b3f0a

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

‎server/src/com/cloud/configuration/Config.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ public enum Config {
701701
"system.vm.use.local.storage",
702702
"false",
703703
"Indicates whether to use local storage pools or shared storage pools for system VMs.",
704-
null),
704+
null, ConfigKey.Scope.Zone.toString()),
705705
SystemVMAutoReserveCapacity(
706706
"Advanced",
707707
ManagementServer.class,

‎server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@ public void setHostAllocators(List<HostAllocator> hostAllocators) {
198198
@Inject
199199
protected StoragePoolHostDao _poolHostDao;
200200

201+
@Inject
202+
protected DataCenterDao _zoneDao;
201203
@Inject
202204
protected VolumeDao _volsDao;
203205
@Inject
@@ -1271,7 +1273,18 @@ protected Pair<Map<Volume, List<StoragePool>>, List<Volume>> findSuitablePoolsFo
12711273
boolean useLocalStorage = false;
12721274
if (vmProfile.getType() != VirtualMachine.Type.User) {
12731275
String ssvmUseLocalStorage = _configDao.getValue(Config.SystemVMUseLocalStorage.key());
1274-
if (ssvmUseLocalStorage.equalsIgnoreCase("true")) {
1276+
1277+
DataCenterVO zone = _zoneDao.findById(plan.getDataCenterId());
1278+
1279+
// It should not happen to have a "null" zone here. There can be NO instance if there is NO zone,
1280+
// so this part of the code would never be reached if no zone has been created.
1281+
//
1282+
// Added the check and the comment just to make it clear.
1283+
boolean zoneUsesLocalStorage = zone != null ? zone.isLocalStorageEnabled() : false;
1284+
1285+
// Local storage is used for the NON User VMs if, and only if, the Zone is marked to use local storage AND
1286+
// the global settings (ssvmUseLocalStorage) is set to true. Otherwise, the global settings won't be applied.
1287+
if (ssvmUseLocalStorage.equalsIgnoreCase("true") && zoneUsesLocalStorage) {
12751288
useLocalStorage = true;
12761289
}
12771290
} else {

0 commit comments

Comments
 (0)