CLOUDSTACK-304: default number of concurrent snapshots is NULL (unlimited) - to provide backwards compatibility for existing customers.

Conflicts:

	setup/db/db/schema-305to306.sql
This commit is contained in:
Alena Prokharchyk 2012-10-16 10:34:40 -07:00
parent f4d085d609
commit 9d07ad8ecb
2 changed files with 23 additions and 8 deletions

View File

@ -63,7 +63,7 @@ public class ApiDispatcher {
ComponentLocator _locator;
AsyncJobManager _asyncMgr;
IdentityDao _identityDao;
long _createSnapshotQueueSizeLimit;
Long _createSnapshotQueueSizeLimit;
// singleton class
private static ApiDispatcher s_instance = new ApiDispatcher();
@ -78,7 +78,16 @@ public class ApiDispatcher {
_identityDao = _locator.getDao(IdentityDao.class);
ConfigurationDao configDao = _locator.getDao(ConfigurationDao.class);
Map<String, String> configs = configDao.getConfiguration();
_createSnapshotQueueSizeLimit = NumbersUtil.parseInt(configs.get(Config.ConcurrentSnapshotsThresholdPerHost.key()), 10);
String strSnapshotLimit = configs.get(Config.ConcurrentSnapshotsThresholdPerHost.key());
if (strSnapshotLimit != null) {
Long snapshotLimit = NumbersUtil.parseLong(strSnapshotLimit, 1L);
if (snapshotLimit <= 0) {
s_logger.debug("Global config parameter " + Config.ConcurrentSnapshotsThresholdPerHost.toString()
+ " is less or equal 0; defaulting to unlimited");
} else {
_createSnapshotQueueSizeLimit = snapshotLimit;
}
}
}
public void dispatchCreateCmd(BaseAsyncCreateCmd cmd, Map<String, String> params) {
@ -138,14 +147,20 @@ public class ApiDispatcher {
ctx.setStartEventId(Long.valueOf(startEventId));
// Synchronise job on the object if needed
if (asyncCmd.getJob() != null && asyncCmd.getSyncObjId() != null && asyncCmd.getSyncObjType() != null) {
long queueSizeLimit = 1;
Long queueSizeLimit = null;
if (asyncCmd.getSyncObjType() != null && asyncCmd.getSyncObjType().equalsIgnoreCase(BaseAsyncCmd.snapshotHostSyncObject)) {
queueSizeLimit = _createSnapshotQueueSizeLimit;
} else {
queueSizeLimit = 1L;
}
if (queueSizeLimit != null) {
_asyncMgr.syncAsyncJobExecution(asyncCmd.getJob(), asyncCmd.getSyncObjType(),
asyncCmd.getSyncObjId().longValue(), queueSizeLimit);
} else {
s_logger.trace("The queue size is unlimited, skipping the synchronizing");
}
_asyncMgr.syncAsyncJobExecution(asyncCmd.getJob(), asyncCmd.getSyncObjType(),
asyncCmd.getSyncObjId().longValue(), queueSizeLimit);
}
}

View File

@ -350,8 +350,8 @@ public enum Config {
VpcCleanupInterval("Advanced", ManagementServer.class, Integer.class, "vpc.cleanup.interval", "3600", "The interval (in seconds) between cleanup for Inactive VPCs", null),
VpcMaxNetworks("Advanced", ManagementServer.class, Integer.class, "vpc.max.networks", "3", "Maximum number of networks per vpc", null),
ConcurrentSnapshotsThresholdPerHost("Advanced", ManagementServer.class, String.class, "concurrent.snapshots.threshold.perhost",
"10", "Limits number of snapshots that can be handled by the host concurrently", null);
ConcurrentSnapshotsThresholdPerHost("Advanced", ManagementServer.class, Long.class, "concurrent.snapshots.threshold.perhost",
null, "Limits number of snapshots that can be handled by the host concurrently; default is NULL - unlimited", null);
private final String _category;