mirror of https://github.com/apache/cloudstack.git
Got all of the config stuff out of the way
This commit is contained in:
parent
47afae8112
commit
6e8ca99466
|
|
@ -32,13 +32,22 @@ public interface CapacityManager {
|
|||
|
||||
static final String CpuOverprovisioningFactorCK = "cpu.overprovisioning.factor";
|
||||
static final String MemOverprovisioningFactorCK = "mem.overprovisioning.factor";
|
||||
static final String StorageCapacityDisableThresholdCK = "pool.storage.capacity.disablethreshold";
|
||||
static final String StorageOverprovisioningFactorCK = "storage.overprovisioning.factor";
|
||||
static final String StorageAllocatedCapacityDisableThresholdCK = "pool.storage.allocated.capacity.disablethreshold";
|
||||
|
||||
static final ConfigKey<Float> CpuOverprovisioningFactor = new ConfigKey<Float>(Float.class, CpuOverprovisioningFactorCK, "Advanced", "1.0",
|
||||
"Used for CPU overprovisioning calculation; available CPU will be (actualCpuCapacity * cpu.overprovisioning.factor)", true, ConfigKey.Scope.Cluster, null);
|
||||
static final ConfigKey<Float> MemOverprovisioningFactor = new ConfigKey<Float>(Float.class, MemOverprovisioningFactorCK, "Advanced", "1.0",
|
||||
"Used for memory overprovisioning calculation", true, ConfigKey.Scope.Cluster, null);
|
||||
static final ConfigKey<Double> StorageCapacityDisableThreshold = new ConfigKey<Double>("Alert", Double.class, StorageCapacityDisableThresholdCK, "0.85",
|
||||
"Percentage (as a value between 0 and 1) of storage utilization above which allocators will disable using the pool for low storage available.", true, ConfigKey.Scope.Zone);
|
||||
static final ConfigKey<Double> StorageOverprovisioningFactor = new ConfigKey<Double>("Storage", Double.class, StorageOverprovisioningFactorCK, "2",
|
||||
"Used for storage overprovisioning calculation; available storage will be (actualStorageSize * storage.overprovisioning.factor)", true, ConfigKey.Scope.Zone);
|
||||
static final ConfigKey<Double> StorageAllocatedCapacityDisableThreshold = new ConfigKey<Double>("Alert", Double.class, StorageAllocatedCapacityDisableThresholdCK, "0.85",
|
||||
"Percentage (as a value between 0 and 1) of allocated storage utilization above which allocators will disable using the pool for low allocated storage available.", true,
|
||||
ConfigKey.Scope.Zone);
|
||||
|
||||
|
||||
public boolean releaseVmCapacity(VirtualMachine vm, boolean moveFromReserved, boolean moveToReservered, Long hostId);
|
||||
|
||||
void allocateVmCapacity(VirtualMachine vm, boolean fromLastHost);
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import com.cloud.vm.VirtualMachine;
|
|||
/**
|
||||
* Rules Manager manages the network rules created for different networks.
|
||||
*/
|
||||
public interface RulesManager {
|
||||
public interface RulesManager extends RulesService {
|
||||
|
||||
boolean applyPortForwardingRulesForNetwork(long networkId, boolean continueOnError, Account caller);
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.lf5.viewer.configure.ConfigurationManager;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mock;
|
||||
|
|
@ -41,6 +40,8 @@ import org.mockito.Spy;
|
|||
import org.apache.cloudstack.api.command.user.vm.RestoreVMCmd;
|
||||
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
|
||||
import org.apache.cloudstack.engine.orchestration.service.VolumeOrchestrationService;
|
||||
import org.apache.cloudstack.framework.config.ConfigDepot;
|
||||
import org.apache.cloudstack.framework.config.ConfigValue;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
||||
|
|
@ -113,8 +114,6 @@ public class VirtualMachineManagerImplTest {
|
|||
@Mock
|
||||
Account _account;
|
||||
@Mock
|
||||
ConfigurationManager _configMgr;
|
||||
@Mock
|
||||
CapacityManager _capacityMgr;
|
||||
@Mock
|
||||
AgentManager _agentMgr;
|
||||
|
|
@ -197,6 +196,8 @@ public class VirtualMachineManagerImplTest {
|
|||
Map<Volume, StoragePool> _volumeToPoolMock;
|
||||
@Mock
|
||||
EntityManager _entityMgr;
|
||||
@Mock
|
||||
ConfigDepot _configDepot;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
|
|
@ -222,6 +223,7 @@ public class VirtualMachineManagerImplTest {
|
|||
_vmMgr._vmDao = _vmInstanceDao;
|
||||
_vmMgr._uservmDetailsDao = _vmDetailsDao;
|
||||
_vmMgr._entityMgr = _entityMgr;
|
||||
_vmMgr._configDepot = _configDepot;
|
||||
|
||||
when(_vmMock.getId()).thenReturn(314l);
|
||||
when(_vmInstance.getId()).thenReturn(1L);
|
||||
|
|
@ -266,9 +268,14 @@ public class VirtualMachineManagerImplTest {
|
|||
doReturn(hostVO).when(_hostDao).findById(1L);
|
||||
doReturn(1L).when(_vmInstance).getDataCenterId();
|
||||
doReturn(1L).when(hostVO).getClusterId();
|
||||
when(_configMgr.getConfigValue(Config.EnableDynamicallyScaleVm.key(), Config.Scope.zone.toString(), 1L)).thenReturn("true");
|
||||
when(_configMgr.getConfigValue(Config.MemOverprovisioningFactor.key(), Config.Scope.cluster.toString(), 1L)).thenReturn("1.0");
|
||||
when(_configMgr.getConfigValue(Config.CPUOverprovisioningFactor.key(), Config.Scope.cluster.toString(), 1L)).thenReturn("1.0");
|
||||
@SuppressWarnings("unchecked")
|
||||
ConfigValue<Float> memOverprovisioningFactor = mock(ConfigValue.class);
|
||||
@SuppressWarnings("unchecked")
|
||||
ConfigValue<Float> cpuOverprovisioningFactor = mock(ConfigValue.class);
|
||||
when(_configDepot.get(CapacityManager.MemOverprovisioningFactor)).thenReturn(memOverprovisioningFactor);
|
||||
when(memOverprovisioningFactor.valueIn(1L)).thenReturn(1.0f);
|
||||
when(_configDepot.get(CapacityManager.CpuOverprovisioningFactor)).thenReturn(cpuOverprovisioningFactor);
|
||||
when(cpuOverprovisioningFactor.valueIn(1L)).thenReturn(1.0f);
|
||||
ScaleVmCommand reconfigureCmd = new ScaleVmCommand("myVmName", newServiceOffering.getCpu(),
|
||||
newServiceOffering.getSpeed(), newServiceOffering.getSpeed(), newServiceOffering.getRamSize(), newServiceOffering.getRamSize(),
|
||||
newServiceOffering.getLimitCpuUse());
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import javax.naming.ConfigurationException;
|
|||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||
import org.apache.cloudstack.framework.config.ConfigValue;
|
||||
import org.apache.cloudstack.framework.config.Configurable;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.framework.messagebus.MessageBus;
|
||||
|
|
@ -75,6 +76,7 @@ import com.cloud.storage.dao.VolumeDao;
|
|||
import com.cloud.utils.DateUtil;
|
||||
import com.cloud.utils.NumbersUtil;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.component.InjectConfig;
|
||||
import com.cloud.utils.component.ManagerBase;
|
||||
import com.cloud.utils.concurrency.NamedThreadFactory;
|
||||
import com.cloud.utils.db.DB;
|
||||
|
|
@ -133,9 +135,9 @@ public class CapacityManagerImpl extends ManagerBase implements CapacityManager,
|
|||
ClusterDetailsDao _clusterDetailsDao;
|
||||
private int _vmCapacityReleaseInterval;
|
||||
private ScheduledExecutorService _executor;
|
||||
private boolean _stopped;
|
||||
long _extraBytesPerVolume = 0;
|
||||
private float _storageOverProvisioningFactor = 1.0f;
|
||||
@InjectConfig(key = StorageOverprovisioningFactorCK)
|
||||
private ConfigValue<Double> _storageOverProvisioningFactor;
|
||||
|
||||
@Inject
|
||||
MessageBus _messageBus;
|
||||
|
|
@ -145,7 +147,6 @@ public class CapacityManagerImpl extends ManagerBase implements CapacityManager,
|
|||
@Override
|
||||
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
|
||||
_vmCapacityReleaseInterval = NumbersUtil.parseInt(_configDao.getValue(Config.CapacitySkipcountingHours.key()), 3600);
|
||||
_storageOverProvisioningFactor = NumbersUtil.parseFloat(_configDao.getValue(Config.StorageOverprovisioningFactor.key()), 1.0f);
|
||||
|
||||
_executor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("HostCapacity-Checker"));
|
||||
VirtualMachine.State.getStateMachine().registerListener(this);
|
||||
|
|
@ -165,7 +166,6 @@ public class CapacityManagerImpl extends ManagerBase implements CapacityManager,
|
|||
@Override
|
||||
public boolean stop() {
|
||||
_executor.shutdownNow();
|
||||
_stopped = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,15 +57,12 @@ public enum Config {
|
|||
VlanCapacityThreshold("Alert", ManagementServer.class, Float.class, "zone.vlan.capacity.notificationthreshold", "0.75", "Percentage (as a value between 0 and 1) of Zone Vlan utilization above which alerts will be sent about low number of Zone Vlans.", null),
|
||||
DirectNetworkPublicIpCapacityThreshold("Alert", ManagementServer.class, Float.class, "zone.directnetwork.publicip.capacity.notificationthreshold", "0.75", "Percentage (as a value between 0 and 1) of Direct Network Public Ip Utilization above which alerts will be sent about low number of direct network public ips.", null),
|
||||
LocalStorageCapacityThreshold("Alert", ManagementServer.class, Float.class, "cluster.localStorage.capacity.notificationthreshold", "0.75", "Percentage (as a value between 0 and 1) of local storage utilization above which alerts will be sent about low local storage available.", null),
|
||||
StorageAllocatedCapacityDisableThreshold("Alert", ManagementServer.class, Float.class, "pool.storage.allocated.capacity.disablethreshold", "0.85", "Percentage (as a value between 0 and 1) of allocated storage utilization above which allocators will disable using the pool for low allocated storage available.", null, ConfigKey.Scope.Zone.toString()),
|
||||
StorageCapacityDisableThreshold("Alert", ManagementServer.class, Float.class, "pool.storage.capacity.disablethreshold", "0.85", "Percentage (as a value between 0 and 1) of storage utilization above which allocators will disable using the pool for low storage available.", null, ConfigKey.Scope.Zone.toString()),
|
||||
CPUCapacityDisableThreshold("Alert", ManagementServer.class, Float.class, "cluster.cpu.allocated.capacity.disablethreshold", "0.85", "Percentage (as a value between 0 and 1) of cpu utilization above which allocators will disable using the cluster for low cpu available. Keep the corresponding notification threshold lower than this to be notified beforehand.", null, ConfigKey.Scope.Cluster.toString()),
|
||||
MemoryCapacityDisableThreshold("Alert", ManagementServer.class, Float.class, "cluster.memory.allocated.capacity.disablethreshold", "0.85", "Percentage (as a value between 0 and 1) of memory utilization above which allocators will disable using the cluster for low memory available. Keep the corresponding notification threshold lower than this to be notified beforehand.", null, ConfigKey.Scope.Cluster.toString()),
|
||||
|
||||
|
||||
// Storage
|
||||
|
||||
StorageOverprovisioningFactor("Storage", StoragePoolAllocator.class, String.class, "storage.overprovisioning.factor", "2", "Used for storage overprovisioning calculation; available storage will be (actualStorageSize * storage.overprovisioning.factor)", null, ConfigKey.Scope.Zone.toString()),
|
||||
StorageStatsInterval("Storage", ManagementServer.class, String.class, "storage.stats.interval", "60000", "The interval (in milliseconds) when storage stats (per host) are retrieved from agents.", null),
|
||||
MaxVolumeSize("Storage", ManagementServer.class, Integer.class, "storage.max.volume.size", "2000", "The maximum size for a volume (in GB).", null),
|
||||
StorageCacheReplacementLRUTimeInterval("Storage", ManagementServer.class, Integer.class, "storage.cache.replacement.lru.interval", "30", "time interval for unused data on cache storage (in days).", null),
|
||||
|
|
|
|||
|
|
@ -373,8 +373,8 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
weightBasedParametersForValidation.add(Config.VlanCapacityThreshold.key());
|
||||
weightBasedParametersForValidation.add(Config.DirectNetworkPublicIpCapacityThreshold.key());
|
||||
weightBasedParametersForValidation.add(Config.LocalStorageCapacityThreshold.key());
|
||||
weightBasedParametersForValidation.add(Config.StorageAllocatedCapacityDisableThreshold.key());
|
||||
weightBasedParametersForValidation.add(Config.StorageCapacityDisableThreshold.key());
|
||||
weightBasedParametersForValidation.add(CapacityManager.StorageAllocatedCapacityDisableThreshold.key());
|
||||
weightBasedParametersForValidation.add(CapacityManager.StorageCapacityDisableThreshold.key());
|
||||
weightBasedParametersForValidation.add(Config.CPUCapacityDisableThreshold.key());
|
||||
weightBasedParametersForValidation.add(Config.MemoryCapacityDisableThreshold.key());
|
||||
weightBasedParametersForValidation.add(Config.AgentLoadThreshold.key());
|
||||
|
|
@ -387,7 +387,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
overprovisioningFactorsForValidation = new HashSet<String>();
|
||||
overprovisioningFactorsForValidation.add(CapacityManager.MemOverprovisioningFactor.key());
|
||||
overprovisioningFactorsForValidation.add(CapacityManager.CpuOverprovisioningFactor.key());
|
||||
overprovisioningFactorsForValidation.add(Config.StorageOverprovisioningFactor.key());
|
||||
overprovisioningFactorsForValidation.add(CapacityManager.StorageOverprovisioningFactor.key());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -142,7 +142,7 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager, Rules
|
|||
@Inject
|
||||
LoadBalancerVMMapDao _loadBalancerVMMapDao;
|
||||
@Inject
|
||||
VpcService _vpcService;
|
||||
VpcService _vpcSvc;
|
||||
|
||||
|
||||
protected void checkIpAndUserVm(IpAddress ipAddress, UserVm userVm, Account caller, Boolean ignoreVmState) {
|
||||
|
|
@ -509,7 +509,7 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager, Rules
|
|||
|
||||
// associate portable IP to vpc, if network is part of VPC
|
||||
if (network.getVpcId() != null) {
|
||||
_vpcService.associateIPToVpc(ipId, network.getVpcId());
|
||||
_vpcSvc.associateIPToVpc(ipId, network.getVpcId());
|
||||
}
|
||||
|
||||
// associate portable IP with guest network
|
||||
|
|
@ -844,12 +844,6 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager, Rules
|
|||
return new Pair<List<? extends PortForwardingRule>, Integer>(result.first(), result.second());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getSourceCidrs(long ruleId) {
|
||||
return _firewallCidrsDao.getSourceCidrs(ruleId);
|
||||
}
|
||||
|
||||
|
||||
protected boolean applyPortForwardingRules(long ipId, boolean continueOnError, Account caller) {
|
||||
List<PortForwardingRuleVO> rules = _portForwardingDao.listForApplication(ipId);
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.VolumeService;
|
|||
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeService.VolumeApiResult;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope;
|
||||
import org.apache.cloudstack.framework.async.AsyncCallFuture;
|
||||
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||
import org.apache.cloudstack.framework.config.ConfigValue;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.ImageStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.ImageStoreDetailsDao;
|
||||
|
|
@ -147,13 +147,13 @@ import com.cloud.storage.listener.VolumeStateListener;
|
|||
import com.cloud.template.TemplateManager;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.AccountManager;
|
||||
import com.cloud.user.User;
|
||||
import com.cloud.user.dao.UserDao;
|
||||
import com.cloud.utils.NumbersUtil;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.StringUtils;
|
||||
import com.cloud.utils.UriUtils;
|
||||
import com.cloud.utils.component.ComponentContext;
|
||||
import com.cloud.utils.component.InjectConfig;
|
||||
import com.cloud.utils.component.ManagerBase;
|
||||
import com.cloud.utils.concurrency.NamedThreadFactory;
|
||||
import com.cloud.utils.db.DB;
|
||||
|
|
@ -280,19 +280,12 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
|
|||
boolean _storageCleanupEnabled;
|
||||
boolean _templateCleanupEnabled = true;
|
||||
int _storageCleanupInterval;
|
||||
private int _createVolumeFromSnapshotWait;
|
||||
private int _copyvolumewait;
|
||||
int _storagePoolAcquisitionWaitSeconds = 1800; // 30 minutes
|
||||
// protected BigDecimal _overProvisioningFactor = new BigDecimal(1);
|
||||
private long _maxVolumeSizeInGb;
|
||||
private long _serverId;
|
||||
|
||||
private int _customDiskOfferingMinSize = 1;
|
||||
private int _customDiskOfferingMaxSize = 1024;
|
||||
private final Map<String, HypervisorHostListener> hostListeners = new HashMap<String, HypervisorHostListener>();
|
||||
|
||||
private boolean _recreateSystemVmEnabled;
|
||||
|
||||
public boolean share(VMInstanceVO vm, List<VolumeVO> vols, HostVO host, boolean cancelPreviousShare) throws StorageUnavailableException {
|
||||
|
||||
// if pool is in maintenance and it is the ONLY pool available; reject
|
||||
|
|
@ -450,16 +443,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
|
|||
String storageCleanupEnabled = configs.get("storage.cleanup.enabled");
|
||||
_storageCleanupEnabled = (storageCleanupEnabled == null) ? true : Boolean.parseBoolean(storageCleanupEnabled);
|
||||
|
||||
String value = _configDao.getValue(Config.CreateVolumeFromSnapshotWait.toString());
|
||||
_createVolumeFromSnapshotWait = NumbersUtil.parseInt(value, Integer.parseInt(Config.CreateVolumeFromSnapshotWait.getDefaultValue()));
|
||||
|
||||
value = _configDao.getValue(Config.CopyVolumeWait.toString());
|
||||
_copyvolumewait = NumbersUtil.parseInt(value, Integer.parseInt(Config.CopyVolumeWait.getDefaultValue()));
|
||||
|
||||
value = _configDao.getValue(Config.RecreateSystemVmEnabled.key());
|
||||
_recreateSystemVmEnabled = Boolean.parseBoolean(value);
|
||||
|
||||
value = _configDao.getValue(Config.StorageTemplateCleanupEnabled.key());
|
||||
String value = _configDao.getValue(Config.StorageTemplateCleanupEnabled.key());
|
||||
_templateCleanupEnabled = (value == null ? true : Boolean.parseBoolean(value));
|
||||
|
||||
String time = configs.get("storage.cleanup.interval");
|
||||
|
|
@ -474,17 +458,6 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
|
|||
|
||||
_agentMgr.registerForHostEvents(ComponentContext.inject(LocalStoragePoolListener.class), true, false, false);
|
||||
|
||||
String maxVolumeSizeInGbString = _configDao.getValue("storage.max.volume.size");
|
||||
_maxVolumeSizeInGb = NumbersUtil.parseLong(maxVolumeSizeInGbString, 2000);
|
||||
|
||||
String _customDiskOfferingMinSizeStr = _configDao.getValue(Config.CustomDiskOfferingMinSize.toString());
|
||||
_customDiskOfferingMinSize = NumbersUtil.parseInt(_customDiskOfferingMinSizeStr,
|
||||
Integer.parseInt(Config.CustomDiskOfferingMinSize.getDefaultValue()));
|
||||
|
||||
String _customDiskOfferingMaxSizeStr = _configDao.getValue(Config.CustomDiskOfferingMaxSize.toString());
|
||||
_customDiskOfferingMaxSize = NumbersUtil.parseInt(_customDiskOfferingMaxSizeStr,
|
||||
Integer.parseInt(Config.CustomDiskOfferingMaxSize.getDefaultValue()));
|
||||
|
||||
_serverId = _msServer.getId();
|
||||
|
||||
UpHostsInPoolSearch = _storagePoolHostDao.createSearchBuilder(Long.class);
|
||||
|
|
@ -598,7 +571,6 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
public PrimaryDataStoreInfo createPool(CreateStoragePoolCmd cmd) throws ResourceInUseException, IllegalArgumentException, UnknownHostException,
|
||||
ResourceUnavailableException {
|
||||
String providerName = cmd.getStorageProviderName();
|
||||
|
|
@ -886,10 +858,12 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
|
|||
listener.hostConnect(hostId, pool.getId());
|
||||
}
|
||||
|
||||
@InjectConfig(key = CapacityManager.StorageOverprovisioningFactorCK)
|
||||
ConfigValue<Double> _storageOverprovisioningFactor;
|
||||
|
||||
@Override
|
||||
public BigDecimal getStorageOverProvisioningFactor(Long dcId) {
|
||||
return new BigDecimal(_configServer.getConfigValue(Config.StorageOverprovisioningFactor.key(),
|
||||
ConfigKey.Scope.Zone.toString(), dcId));
|
||||
return new BigDecimal(_storageOverprovisioningFactor.valueIn(dcId));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -1221,11 +1195,6 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
|
|||
@DB
|
||||
public PrimaryDataStoreInfo preparePrimaryStorageForMaintenance(Long primaryStorageId) throws ResourceUnavailableException,
|
||||
InsufficientCapacityException {
|
||||
Long userId = CallContext.current().getCallingUserId();
|
||||
User user = _userDao.findById(userId);
|
||||
Account account = CallContext.current().getCallingAccount();
|
||||
|
||||
boolean restart = true;
|
||||
StoragePoolVO primaryStorage = null;
|
||||
primaryStorage = _storagePoolDao.findById(primaryStorageId);
|
||||
|
||||
|
|
@ -1252,9 +1221,6 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
|
|||
@DB
|
||||
public PrimaryDataStoreInfo cancelPrimaryStorageForMaintenance(CancelPrimaryStorageMaintenanceCmd cmd) throws ResourceUnavailableException {
|
||||
Long primaryStorageId = cmd.getId();
|
||||
Long userId = CallContext.current().getCallingUserId();
|
||||
User user = _userDao.findById(userId);
|
||||
Account account = CallContext.current().getCallingAccount();
|
||||
StoragePoolVO primaryStorage = null;
|
||||
|
||||
primaryStorage = _storagePoolDao.findById(primaryStorageId);
|
||||
|
|
@ -1496,10 +1462,12 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
|
|||
}
|
||||
}
|
||||
|
||||
@InjectConfig(key = CapacityManager.StorageCapacityDisableThresholdCK)
|
||||
ConfigValue<Float> _storageCapacityDisableThreshold;
|
||||
|
||||
private boolean checkUsagedSpace(StoragePool pool) {
|
||||
StatsCollector sc = StatsCollector.getInstance();
|
||||
double storageUsedThreshold = Double.parseDouble(_configServer.getConfigValue(Config.StorageCapacityDisableThreshold.key(),
|
||||
ConfigKey.Scope.Zone.toString(), pool.getDataCenterId()));
|
||||
double storageUsedThreshold = _storageCapacityDisableThreshold.valueIn(pool.getDataCenterId());
|
||||
if (sc != null) {
|
||||
long totalSize = pool.getCapacityBytes();
|
||||
StorageStats stats = sc.getStoragePoolStats(pool.getId());
|
||||
|
|
@ -1569,6 +1537,9 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
|
|||
return futureIops <= pool.getCapacityIops();
|
||||
}
|
||||
|
||||
@InjectConfig(key = CapacityManager.StorageAllocatedCapacityDisableThresholdCK)
|
||||
ConfigValue<Double> _storageAllocatedCapacityDisableThreshold;
|
||||
|
||||
@Override
|
||||
public boolean storagePoolHasEnoughSpace(List<Volume> volumes,
|
||||
StoragePool pool) {
|
||||
|
|
@ -1604,8 +1575,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
|
|||
totalOverProvCapacity = pool.getCapacityBytes();
|
||||
}
|
||||
|
||||
double storageAllocatedThreshold = Double.parseDouble(_configServer.getConfigValue(Config.StorageAllocatedCapacityDisableThreshold.key(),
|
||||
ConfigKey.Scope.Zone.toString(), pool.getDataCenterId()));
|
||||
double storageAllocatedThreshold = _storageAllocatedCapacityDisableThreshold.valueIn(pool.getDataCenterId());
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Checking pool: " + pool.getId() + " for volume allocation " + volumes.toString() + ", maxSize : " + totalOverProvCapacity
|
||||
+ ", totalAllocatedSize : " + allocatedSizeWithtemplate + ", askingSize : " + totalAskingSize + ", allocated disable threshold: "
|
||||
|
|
@ -1782,7 +1752,6 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
|
|||
@Override
|
||||
public boolean deleteImageStore(DeleteImageStoreCmd cmd) {
|
||||
long storeId = cmd.getId();
|
||||
User caller = _accountMgr.getActiveUser(CallContext.current().getCallingUserId());
|
||||
// Verify that image store exists
|
||||
ImageStoreVO store = _imageStoreDao.findById(storeId);
|
||||
if (store == null) {
|
||||
|
|
@ -1893,7 +1862,6 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
|
|||
@Override
|
||||
public boolean deleteSecondaryStagingStore(DeleteSecondaryStagingStoreCmd cmd) {
|
||||
long storeId = cmd.getId();
|
||||
User caller = _accountMgr.getActiveUser(CallContext.current().getCallingUserId());
|
||||
// Verify that cache store exists
|
||||
ImageStoreVO store = _imageStoreDao.findById(storeId);
|
||||
if (store == null) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue