Skip to content

Commit d9e0a3e

Browse files
authored
server: add config SSVM capacity scan (#7448)
Fixes #7438 Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
1 parent 5e442df commit d9e0a3e

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

server/src/main/java/com/cloud/storage/secondary/SecondaryStorageVmManager.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
import java.util.List;
2020

21+
import org.apache.cloudstack.framework.config.ConfigKey;
22+
2123
import com.cloud.agent.api.Command;
2224
import com.cloud.agent.api.StartupCommand;
2325
import com.cloud.host.HostVO;
@@ -28,6 +30,12 @@
2830

2931
public interface SecondaryStorageVmManager extends Manager {
3032

33+
static final ConfigKey<Long> SecondaryStorageCapacityScanInterval = new ConfigKey<>("Advanced", Long.class,
34+
"secstorage.capacityscan.interval",
35+
"30000",
36+
"The time interval(in millisecond) to scan whether or not system needs more SSVM to ensure minimal standby capacity",
37+
false);
38+
3139
public static final int DEFAULT_SS_VM_RAMSIZE = 512; // 512M
3240
public static final int DEFAULT_SS_VM_CPUMHZ = 500; // 500 MHz
3341
public static final int DEFAULT_SS_VM_MTUSIZE = 1500;

services/secondary-storage/controller/src/main/java/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,6 @@
174174
public class SecondaryStorageManagerImpl extends ManagerBase implements SecondaryStorageVmManager, VirtualMachineGuru, SystemVmLoadScanHandler<Long>,
175175
ResourceStateAdapter, Configurable {
176176
private static final Logger s_logger = Logger.getLogger(SecondaryStorageManagerImpl.class);
177-
178-
private static final int DEFAULT_CAPACITY_SCAN_INTERVAL_IN_MILLISECONDS = 30000;
179177
private static final int ACQUIRE_GLOBAL_LOCK_TIMEOUT_FOR_SYNC_IN_SECONDS = 180;
180178
private static final int STARTUP_DELAY_IN_MILLISECONDS = 60000;
181179

@@ -252,8 +250,6 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
252250
private IndirectAgentLB indirectAgentLB;
253251
@Inject
254252
private CAManager caManager;
255-
256-
private long _capacityScanInterval = DEFAULT_CAPACITY_SCAN_INTERVAL_IN_MILLISECONDS;
257253
private int _secStorageVmMtuSize;
258254

259255
private String _instance;
@@ -873,18 +869,14 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
873869
}
874870

875871
_allowedInternalSites = _configDao.getValue("secstorage.allowed.internal.sites");
876-
877-
String value = configs.get("secstorage.capacityscan.interval");
878-
_capacityScanInterval = NumbersUtil.parseLong(value, DEFAULT_CAPACITY_SCAN_INTERVAL_IN_MILLISECONDS);
879-
880872
_instance = configs.get("instance.name");
881873
if (_instance == null) {
882874
_instance = "DEFAULT";
883875
}
884876

885877
Map<String, String> agentMgrConfigs = _configDao.getConfiguration("AgentManager", params);
886878

887-
value = agentMgrConfigs.get("port");
879+
String value = agentMgrConfigs.get("port");
888880
_mgmtPort = NumbersUtil.parseInt(value, 8250);
889881

890882
_listener = new SecondaryStorageListener(this);
@@ -926,7 +918,7 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
926918

927919
if (_useServiceVM) {
928920
_loadScanner = new SystemVmLoadScanner<>(this);
929-
_loadScanner.initScan(STARTUP_DELAY_IN_MILLISECONDS, _capacityScanInterval);
921+
_loadScanner.initScan(STARTUP_DELAY_IN_MILLISECONDS, SecondaryStorageCapacityScanInterval.value());
930922
}
931923

932924
_httpProxy = configs.get(Config.SecStorageProxy.key());
@@ -1459,7 +1451,7 @@ public String getConfigComponentName() {
14591451

14601452
@Override
14611453
public ConfigKey<?>[] getConfigKeys() {
1462-
return new ConfigKey<?>[] {NTPServerConfig, MaxNumberOfSsvmsForMigration};
1454+
return new ConfigKey<?>[] {NTPServerConfig, MaxNumberOfSsvmsForMigration, SecondaryStorageCapacityScanInterval};
14631455
}
14641456

14651457
}

0 commit comments

Comments
 (0)