cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [cloudstack] branch master updated: CLOUDSTACK-9667 Enable resourcecount.check.interval by default
Date Mon, 24 Jul 2017 07:26:20 GMT
This is an automated email from the ASF dual-hosted git repository.

bhaisaab pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/master by this push:
     new d98520a  CLOUDSTACK-9667 Enable resourcecount.check.interval by default
d98520a is described below

commit d98520a6daeb3c5ceabed18a135c97245a41535a
Author: Bharat Kumar <bharat.kumar@accelerite.com>
AuthorDate: Tue May 9 19:01:10 2017 +0530

    CLOUDSTACK-9667 Enable resourcecount.check.interval by default
---
 api/src/com/cloud/user/ResourceLimitService.java      |  4 ++++
 server/src/com/cloud/configuration/Config.java        |  9 ---------
 .../cloud/resourcelimit/ResourceLimitManagerImpl.java | 19 ++++++++++++++++---
 3 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/api/src/com/cloud/user/ResourceLimitService.java b/api/src/com/cloud/user/ResourceLimitService.java
index fef16da..0ec2dc1 100644
--- a/api/src/com/cloud/user/ResourceLimitService.java
+++ b/api/src/com/cloud/user/ResourceLimitService.java
@@ -23,9 +23,13 @@ import com.cloud.configuration.ResourceCount;
 import com.cloud.configuration.ResourceLimit;
 import com.cloud.domain.Domain;
 import com.cloud.exception.ResourceAllocationException;
+import org.apache.cloudstack.framework.config.ConfigKey;
 
 public interface ResourceLimitService {
 
+    static final ConfigKey<Long> ResourceCountCheckInterval = new ConfigKey<Long>("Advanced",
Long.class, "resourcecount.check.interval", "300",
+            "Time (in seconds) to wait before retrying resource count check task. Default
is 300, Setting this to 0 will not run the task", false);
+
     /**
      * Updates an existing resource limit with the specified details. If a limit doesn't
exist, will create one.
      *
diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java
index 993f9c5..35dda93 100644
--- a/server/src/com/cloud/configuration/Config.java
+++ b/server/src/com/cloud/configuration/Config.java
@@ -1458,15 +1458,6 @@ public enum Config {
             "The default maximum secondary storage space (in GiB) that can be used for an
account",
             null),
 
-    ResourceCountCheckInterval(
-            "Advanced",
-            ManagementServer.class,
-            Long.class,
-            "resourcecount.check.interval",
-            "0",
-            "Time (in seconds) to wait before retrying resource count check task. Default
is 0 which is to never run the task",
-            "Seconds"),
-
     //disabling lb as cluster sync does not work with distributed cluster
     SubDomainNetworkAccess(
             "Advanced",
diff --git a/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java b/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java
index 25afd01..55ed60b 100644
--- a/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java
+++ b/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java
@@ -26,9 +26,12 @@ import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
 
+import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
+import org.apache.cloudstack.framework.config.ConfigKey;
+import org.apache.cloudstack.framework.config.Configurable;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
@@ -83,7 +86,6 @@ import com.cloud.user.AccountManager;
 import com.cloud.user.AccountVO;
 import com.cloud.user.ResourceLimitService;
 import com.cloud.user.dao.AccountDao;
-import com.cloud.utils.NumbersUtil;
 import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.concurrency.NamedThreadFactory;
 import com.cloud.utils.db.DB;
@@ -107,7 +109,8 @@ import com.cloud.vm.dao.UserVmDao;
 import com.cloud.vm.dao.VMInstanceDao;
 
 @Component
-public class ResourceLimitManagerImpl extends ManagerBase implements ResourceLimitService
{
+@Local(value = {ResourceLimitService.class})
+public class ResourceLimitManagerImpl extends ManagerBase implements ResourceLimitService,
Configurable{
     public static final Logger s_logger = Logger.getLogger(ResourceLimitManagerImpl.class);
 
     @Inject
@@ -205,7 +208,7 @@ public class ResourceLimitManagerImpl extends ManagerBase implements ResourceLim
         snapshotSizeSearch.join("snapshots", join2, snapshotSizeSearch.entity().getSnapshotId(),
join2.entity().getId(), JoinBuilder.JoinType.INNER);
         snapshotSizeSearch.done();
 
-        _resourceCountCheckInterval = NumbersUtil.parseInt(_configDao.getValue(Config.ResourceCountCheckInterval.key()),
0);
+        _resourceCountCheckInterval = ResourceCountCheckInterval.value();
         if (_resourceCountCheckInterval > 0) {
             _rcExecutor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("ResourceCountChecker"));
         }
@@ -1061,6 +1064,16 @@ public class ResourceLimitManagerImpl extends ManagerBase implements
ResourceLim
         }
     }
 
+    @Override
+    public String getConfigComponentName() {
+        return ResourceLimitManagerImpl.class.getName();
+    }
+
+    @Override
+    public ConfigKey<?>[] getConfigKeys() {
+        return new ConfigKey<?>[] {ResourceCountCheckInterval};
+    }
+
     protected class ResourceCountCheckTask extends ManagedContextRunnable {
         public ResourceCountCheckTask() {
 

-- 
To stop receiving notification emails like this one, please contact
['"commits@cloudstack.apache.org" <commits@cloudstack.apache.org>'].

Mime
View raw message