mirror of
https://github.com/apache/cloudstack.git
synced 2025-12-16 18:43:26 +01:00
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>
This commit is contained in:
parent
0d9c38e131
commit
1e0880cbab
@ -57,6 +57,7 @@ import org.apache.cloudstack.managed.context.ManagedContextRunnable;
|
|||||||
import org.apache.cloudstack.network.topology.NetworkTopology;
|
import org.apache.cloudstack.network.topology.NetworkTopology;
|
||||||
import org.apache.cloudstack.network.topology.NetworkTopologyContext;
|
import org.apache.cloudstack.network.topology.NetworkTopologyContext;
|
||||||
import org.apache.cloudstack.utils.identity.ManagementServerNode;
|
import org.apache.cloudstack.utils.identity.ManagementServerNode;
|
||||||
|
import org.apache.cloudstack.utils.usage.UsageUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.cloud.network.router.deployment.RouterDeploymentDefinitionBuilder;
|
import org.cloud.network.router.deployment.RouterDeploymentDefinitionBuilder;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -183,7 +184,6 @@ import com.cloud.offerings.NetworkOfferingVO;
|
|||||||
import com.cloud.offerings.dao.NetworkOfferingDao;
|
import com.cloud.offerings.dao.NetworkOfferingDao;
|
||||||
import com.cloud.resource.ResourceManager;
|
import com.cloud.resource.ResourceManager;
|
||||||
import com.cloud.server.ConfigurationServer;
|
import com.cloud.server.ConfigurationServer;
|
||||||
import com.cloud.server.StatsCollector;
|
|
||||||
import com.cloud.service.ServiceOfferingVO;
|
import com.cloud.service.ServiceOfferingVO;
|
||||||
import com.cloud.service.dao.ServiceOfferingDao;
|
import com.cloud.service.dao.ServiceOfferingDao;
|
||||||
import com.cloud.storage.Storage.ProvisioningType;
|
import com.cloud.storage.Storage.ProvisioningType;
|
||||||
@ -681,9 +681,9 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
|
|||||||
_dailyOrHourly = false;
|
_dailyOrHourly = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_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 " + StatsCollector.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 = StatsCollector.USAGE_AGGREGATION_RANGE_MIN;
|
_usageAggregationRange = UsageUtils.USAGE_AGGREGATION_RANGE_MIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
_networkStatsUpdateExecutor.scheduleAtFixedRate(new NetworkStatsUpdateTask(), endDate - System.currentTimeMillis(), _usageAggregationRange * 60 * 1000,
|
_networkStatsUpdateExecutor.scheduleAtFixedRate(new NetworkStatsUpdateTask(), endDate - System.currentTimeMillis(), _usageAggregationRange * 60 * 1000,
|
||||||
|
|||||||
@ -33,6 +33,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import org.apache.cloudstack.utils.usage.UsageUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@ -223,7 +224,6 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
|
|||||||
private String _usageTimeZone = "GMT";
|
private String _usageTimeZone = "GMT";
|
||||||
private final long mgmtSrvrId = MacAddress.getMacAddress().toLong();
|
private final long mgmtSrvrId = MacAddress.getMacAddress().toLong();
|
||||||
private static final int ACQUIRE_GLOBAL_LOCK_TIMEOUT_FOR_COOPERATION = 5; // 5 seconds
|
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 boolean _dailyOrHourly = false;
|
||||||
|
|
||||||
//private final GlobalLock m_capacityCheckLock = GlobalLock.getInternLock("capacity.check");
|
//private final GlobalLock m_capacityCheckLock = GlobalLock.getInternLock("capacity.check");
|
||||||
@ -344,9 +344,9 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
|
|||||||
endDate = cal.getTime().getTime();
|
endDate = cal.getTime().getTime();
|
||||||
_dailyOrHourly = false;
|
_dailyOrHourly = false;
|
||||||
}
|
}
|
||||||
if (_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 " + 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 = USAGE_AGGREGATION_RANGE_MIN;
|
_usageAggregationRange = UsageUtils.USAGE_AGGREGATION_RANGE_MIN;
|
||||||
}
|
}
|
||||||
_diskStatsUpdateExecutor.scheduleAtFixedRate(new VmDiskStatsUpdaterTask(), (endDate - System.currentTimeMillis()), (_usageAggregationRange * 60 * 1000),
|
_diskStatsUpdateExecutor.scheduleAtFixedRate(new VmDiskStatsUpdaterTask(), (endDate - System.currentTimeMillis()), (_usageAggregationRange * 60 * 1000),
|
||||||
TimeUnit.MILLISECONDS);
|
TimeUnit.MILLISECONDS);
|
||||||
|
|||||||
@ -34,6 +34,7 @@ import javax.ejb.Local;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.naming.ConfigurationException;
|
import javax.naming.ConfigurationException;
|
||||||
|
|
||||||
|
import org.apache.cloudstack.utils.usage.UsageUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@ -42,7 +43,6 @@ import org.apache.cloudstack.managed.context.ManagedContextRunnable;
|
|||||||
import org.apache.cloudstack.usage.UsageTypes;
|
import org.apache.cloudstack.usage.UsageTypes;
|
||||||
|
|
||||||
import com.cloud.alert.AlertManager;
|
import com.cloud.alert.AlertManager;
|
||||||
import com.cloud.server.StatsCollector;
|
|
||||||
import com.cloud.event.EventTypes;
|
import com.cloud.event.EventTypes;
|
||||||
import com.cloud.event.UsageEventDetailsVO;
|
import com.cloud.event.UsageEventDetailsVO;
|
||||||
import com.cloud.event.UsageEventVO;
|
import com.cloud.event.UsageEventVO;
|
||||||
@ -246,9 +246,9 @@ public class UsageManagerImpl extends ManagerBase implements UsageManager, Runna
|
|||||||
s_logger.debug("Current Time: " + currentDate.toString());
|
s_logger.debug("Current Time: " + currentDate.toString());
|
||||||
|
|
||||||
_aggregationDuration = Integer.parseInt(aggregationRange);
|
_aggregationDuration = Integer.parseInt(aggregationRange);
|
||||||
if (_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 " + StatsCollector.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 = StatsCollector.USAGE_AGGREGATION_RANGE_MIN;
|
_aggregationDuration = UsageUtils.USAGE_AGGREGATION_RANGE_MIN;
|
||||||
}
|
}
|
||||||
_hostname = InetAddress.getLocalHost().getHostName() + "/" + InetAddress.getLocalHost().getHostAddress();
|
_hostname = InetAddress.getLocalHost().getHostName() + "/" + InetAddress.getLocalHost().getHostAddress();
|
||||||
} catch (NumberFormatException ex) {
|
} catch (NumberFormatException ex) {
|
||||||
|
|||||||
24
utils/src/org/apache/cloudstack/utils/usage/UsageUtils.java
Normal file
24
utils/src/org/apache/cloudstack/utils/usage/UsageUtils.java
Normal file
@ -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;
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user