cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject git commit: updated refs/heads/4.5 to 5241d0f
Date Mon, 01 Dec 2014 11:15:33 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.5 e12478144 -> 5241d0faf


CLOUDSTACK-7903: Fix build regression from previous fix

The previous fix tried to access StatsCollector from UsageManagerImpl
which is not possible due to dependency cycle.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
(cherry picked from commit 1e0880cbabfb2c8edbd6a5a35b9417b2f3e6f681)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

Conflicts:
	server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java


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

Branch: refs/heads/4.5
Commit: 5241d0faf8fb23e00c043527698b0ee13397fd2d
Parents: e124781
Author: Rohit Yadav <rohit.yadav@shapeblue.com>
Authored: Mon Dec 1 16:30:15 2014 +0530
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Mon Dec 1 16:39:01 2014 +0530

----------------------------------------------------------------------
 .../VirtualNetworkApplianceManagerImpl.java     |  8 +++----
 server/src/com/cloud/server/StatsCollector.java |  8 +++----
 usage/src/com/cloud/usage/UsageManagerImpl.java |  8 +++----
 .../cloudstack/utils/usage/UsageUtils.java      | 24 ++++++++++++++++++++
 4 files changed, 36 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5241d0fa/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
index 22cabb3..fcaf3bc 100755
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -178,7 +178,6 @@ import com.cloud.offerings.NetworkOfferingVO;
 import com.cloud.offerings.dao.NetworkOfferingDao;
 import com.cloud.resource.ResourceManager;
 import com.cloud.server.ConfigurationServer;
-import com.cloud.server.StatsCollector;
 import com.cloud.service.ServiceOfferingVO;
 import com.cloud.service.dao.ServiceOfferingDao;
 import com.cloud.storage.GuestOSVO;
@@ -261,6 +260,7 @@ import org.apache.cloudstack.framework.jobs.AsyncJobManager;
 import org.apache.cloudstack.framework.jobs.impl.AsyncJobVO;
 import org.apache.cloudstack.managed.context.ManagedContextRunnable;
 import org.apache.cloudstack.utils.identity.ManagementServerNode;
+import org.apache.cloudstack.utils.usage.UsageUtils;
 import org.apache.log4j.Logger;
 
 import javax.ejb.Local;
@@ -808,9 +808,9 @@ VirtualMachineGuru, Listener, Configurable, StateListener<State, VirtualMachine.
             _dailyOrHourly = false;
         }
 
-        if (_usageAggregationRange < StatsCollector.USAGE_AGGREGATION_RANGE_MIN) {
-            s_logger.warn("Usage stats job aggregation range is to small, using the minimum
value of " + StatsCollector.USAGE_AGGREGATION_RANGE_MIN);
-            _usageAggregationRange = StatsCollector.USAGE_AGGREGATION_RANGE_MIN;
+        if (_usageAggregationRange < UsageUtils.USAGE_AGGREGATION_RANGE_MIN) {
+            s_logger.warn("Usage stats job aggregation range is to small, using the minimum
value of " + UsageUtils.USAGE_AGGREGATION_RANGE_MIN);
+            _usageAggregationRange = UsageUtils.USAGE_AGGREGATION_RANGE_MIN;
         }
 
         _networkStatsUpdateExecutor.scheduleAtFixedRate(new NetworkStatsUpdateTask(), (endDate
- System.currentTimeMillis()), (_usageAggregationRange * 60 * 1000),

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5241d0fa/server/src/com/cloud/server/StatsCollector.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/StatsCollector.java b/server/src/com/cloud/server/StatsCollector.java
index f4b8e8c..d56ee4a 100755
--- a/server/src/com/cloud/server/StatsCollector.java
+++ b/server/src/com/cloud/server/StatsCollector.java
@@ -31,6 +31,7 @@ import java.util.concurrent.TimeUnit;
 
 import javax.inject.Inject;
 
+import org.apache.cloudstack.utils.usage.UsageUtils;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
@@ -199,7 +200,6 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
     private String _usageTimeZone = "GMT";
     private final long mgmtSrvrId = MacAddress.getMacAddress().toLong();
     private static final int ACQUIRE_GLOBAL_LOCK_TIMEOUT_FOR_COOPERATION = 5;    // 5 seconds
-    public static final int USAGE_AGGREGATION_RANGE_MIN = 1;
     private boolean _dailyOrHourly = false;
 
     //private final GlobalLock m_capacityCheckLock = GlobalLock.getInternLock("capacity.check");
@@ -290,9 +290,9 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
             endDate = cal.getTime().getTime();
             _dailyOrHourly = false;
         }
-        if (_usageAggregationRange < USAGE_AGGREGATION_RANGE_MIN) {
-            s_logger.warn("Usage stats job aggregation range is to small, using the minimum
value of " + USAGE_AGGREGATION_RANGE_MIN);
-            _usageAggregationRange = USAGE_AGGREGATION_RANGE_MIN;
+        if (_usageAggregationRange < UsageUtils.USAGE_AGGREGATION_RANGE_MIN) {
+            s_logger.warn("Usage stats job aggregation range is to small, using the minimum
value of " + UsageUtils.USAGE_AGGREGATION_RANGE_MIN);
+            _usageAggregationRange = UsageUtils.USAGE_AGGREGATION_RANGE_MIN;
         }
         _diskStatsUpdateExecutor.scheduleAtFixedRate(new VmDiskStatsUpdaterTask(), (endDate
- System.currentTimeMillis()), (_usageAggregationRange * 60 * 1000),
             TimeUnit.MILLISECONDS);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5241d0fa/usage/src/com/cloud/usage/UsageManagerImpl.java
----------------------------------------------------------------------
diff --git a/usage/src/com/cloud/usage/UsageManagerImpl.java b/usage/src/com/cloud/usage/UsageManagerImpl.java
index 5a3e854..8429c60 100644
--- a/usage/src/com/cloud/usage/UsageManagerImpl.java
+++ b/usage/src/com/cloud/usage/UsageManagerImpl.java
@@ -34,6 +34,7 @@ import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
+import org.apache.cloudstack.utils.usage.UsageUtils;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
@@ -42,7 +43,6 @@ import org.apache.cloudstack.managed.context.ManagedContextRunnable;
 import org.apache.cloudstack.usage.UsageTypes;
 
 import com.cloud.alert.AlertManager;
-import com.cloud.server.StatsCollector;
 import com.cloud.event.EventTypes;
 import com.cloud.event.UsageEventDetailsVO;
 import com.cloud.event.UsageEventVO;
@@ -246,9 +246,9 @@ public class UsageManagerImpl extends ManagerBase implements UsageManager,
Runna
             s_logger.debug("Current Time: " + currentDate.toString());
 
             _aggregationDuration = Integer.parseInt(aggregationRange);
-            if (_aggregationDuration < StatsCollector.USAGE_AGGREGATION_RANGE_MIN) {
-                s_logger.warn("Usage stats job aggregation range is to small, using the minimum
value of " + StatsCollector.USAGE_AGGREGATION_RANGE_MIN);
-                _aggregationDuration = StatsCollector.USAGE_AGGREGATION_RANGE_MIN;
+            if (_aggregationDuration < UsageUtils.USAGE_AGGREGATION_RANGE_MIN) {
+                s_logger.warn("Usage stats job aggregation range is to small, using the minimum
value of " + UsageUtils.USAGE_AGGREGATION_RANGE_MIN);
+                _aggregationDuration = UsageUtils.USAGE_AGGREGATION_RANGE_MIN;
             }
             _hostname = InetAddress.getLocalHost().getHostName() + "/" + InetAddress.getLocalHost().getHostAddress();
         } catch (NumberFormatException ex) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5241d0fa/utils/src/org/apache/cloudstack/utils/usage/UsageUtils.java
----------------------------------------------------------------------
diff --git a/utils/src/org/apache/cloudstack/utils/usage/UsageUtils.java b/utils/src/org/apache/cloudstack/utils/usage/UsageUtils.java
new file mode 100644
index 0000000..a97aed1
--- /dev/null
+++ b/utils/src/org/apache/cloudstack/utils/usage/UsageUtils.java
@@ -0,0 +1,24 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package org.apache.cloudstack.utils.usage;
+
+public class UsageUtils {
+    public static final int USAGE_AGGREGATION_RANGE_MIN = 1;
+}


Mime
View raw message