Skip to content

Commit 4e49b7d

Browse files
committed
CE-110 move config to public fields
1 parent dcc7f4c commit 4e49b7d

3 files changed

Lines changed: 5 additions & 15 deletions

File tree

engine/components-api/src/com/cloud/storage/StorageManager.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ public interface StorageManager extends StorageService {
5050
"Determines how long (in seconds) to wait before actually expunging destroyed volumes. The default value = the default value of storage.cleanup.interval.", false, ConfigKey.Scope.Global, null);
5151
static final ConfigKey<Boolean> StorageCleanupEnabled = new ConfigKey<Boolean>(Boolean.class, "storage.cleanup.enabled", "Advanced", "true",
5252
"Enables/disables the storage cleanup thread.", false, ConfigKey.Scope.Global, null);
53+
static final ConfigKey<Boolean> TemplateCleanupEnabled = new ConfigKey<Boolean>(Boolean.class, "storage.template.cleanup.enabled", "Storage", "true",
54+
"Enable/disable template cleanup activity, only take effect when overall storage cleanup is enabled", false, ConfigKey.Scope.Global, null);
5355

5456
/**
5557
* Returns a comma separated list of tags for the specified storage pool

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,6 @@ public enum Config {
182182
"3600",
183183
"Timeout (in seconds) to synchronize storage pool operations.",
184184
null),
185-
StorageTemplateCleanupEnabled(
186-
"Storage",
187-
ManagementServer.class,
188-
Boolean.class,
189-
"storage.template.cleanup.enabled",
190-
"true",
191-
"Enable/disable template cleanup activity, only take effect when overall storage cleanup is enabled",
192-
null),
193185
PrimaryStorageDownloadWait(
194186
"Storage",
195187
TemplateManager.class,

server/src/com/cloud/storage/StorageManagerImpl.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,6 @@ public void setDiscoverers(List<StoragePoolDiscoverer> discoverers) {
309309
protected SearchBuilder<StoragePoolVO> LocalStorageSearch;
310310

311311
ScheduledExecutorService _executor = null;
312-
boolean _templateCleanupEnabled = true;
313312
int _storagePoolAcquisitionWaitSeconds = 1800; // 30 minutes
314313
int _downloadUrlCleanupInterval;
315314
int _downloadUrlExpirationInterval;
@@ -472,11 +471,8 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
472471

473472
_agentMgr.registerForHostEvents(new StoragePoolMonitor(this, _storagePoolDao, _dataStoreProviderMgr), true, false, true);
474473

475-
String value = _configDao.getValue(Config.StorageTemplateCleanupEnabled.key());
476-
_templateCleanupEnabled = (value == null ? true : Boolean.parseBoolean(value));
477-
478474
s_logger.info("Storage cleanup enabled: " + StorageCleanupEnabled.value() + ", interval: " + StorageCleanupInterval.value() + ", delay: " + StorageCleanupDelay.value() +
479-
", template cleanup enabled: " + _templateCleanupEnabled);
475+
", template cleanup enabled: " + TemplateCleanupEnabled.value());
480476

481477
String cleanupInterval = configs.get("extract.url.cleanup.interval");
482478
_downloadUrlCleanupInterval = NumbersUtil.parseInt(cleanupInterval, 7200);
@@ -1047,7 +1043,7 @@ public void cleanupStorage(boolean recurring) {
10471043
if (scanLock.lock(3)) {
10481044
try {
10491045
// Cleanup primary storage pools
1050-
if (_templateCleanupEnabled) {
1046+
if (TemplateCleanupEnabled.value()) {
10511047
List<StoragePoolVO> storagePools = _storagePoolDao.listAll();
10521048
for (StoragePoolVO pool : storagePools) {
10531049
try {
@@ -2385,7 +2381,7 @@ public String getConfigComponentName() {
23852381

23862382
@Override
23872383
public ConfigKey<?>[] getConfigKeys() {
2388-
return new ConfigKey<?>[] {StorageCleanupInterval, StorageCleanupDelay, StorageCleanupEnabled};
2384+
return new ConfigKey<?>[] {StorageCleanupInterval, StorageCleanupDelay, StorageCleanupEnabled, TemplateCleanupEnabled};
23892385
}
23902386

23912387
@Override

0 commit comments

Comments
 (0)