Updated Branches:
  refs/heads/master f4d085d60 -> 9d07ad8ec

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

Conflicts:

        setup/db/db/schema-305to306.sql


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/9d07ad8e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/9d07ad8e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/9d07ad8e

Branch: refs/heads/master
Commit: 9d07ad8ecb1547ee7cb4c376a794d141a4c34ce2
Parents: f4d085d
Author: Alena Prokharchyk <[email protected]>
Authored: Tue Oct 16 10:34:40 2012 -0700
Committer: Alena Prokharchyk <[email protected]>
Committed: Tue Oct 16 11:25:05 2012 -0700

----------------------------------------------------------------------
 server/src/com/cloud/api/ApiDispatcher.java    |   27 ++++++++++++++----
 server/src/com/cloud/configuration/Config.java |    4 +-
 2 files changed, 23 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/9d07ad8e/server/src/com/cloud/api/ApiDispatcher.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiDispatcher.java 
b/server/src/com/cloud/api/ApiDispatcher.java
index 9061dda..dfe4a1f 100755
--- a/server/src/com/cloud/api/ApiDispatcher.java
+++ b/server/src/com/cloud/api/ApiDispatcher.java
@@ -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);
                 }
             }
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/9d07ad8e/server/src/com/cloud/configuration/Config.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/Config.java 
b/server/src/com/cloud/configuration/Config.java
index c214bd0..66ac276 100755
--- a/server/src/com/cloud/configuration/Config.java
+++ b/server/src/com/cloud/configuration/Config.java
@@ -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;

Reply via email to