mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-6139: Fix regression, allow zone level systemvm localstorage config
From b3f18e7d74a0f09db9977554a6c7648b7edbc33d, the zone level systemvm local storage setting never worked as it needed to be moved to config depot. (cherry picked from commit 279efb04324249a2e1a5487b58b40a723baf4600) Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com> Conflicts: plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
This commit is contained in:
parent
fdea7eb472
commit
df3dea58a2
@ -16,18 +16,22 @@
|
||||
// under the License.
|
||||
package com.cloud.dc;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.org.Grouping;
|
||||
import org.apache.cloudstack.acl.InfrastructureEntity;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||
|
||||
import com.cloud.org.Grouping;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public interface DataCenter extends InfrastructureEntity, Grouping, Identity, InternalIdentity {
|
||||
public static final String SystemVMUseLocalStorageCK = "system.vm.use.local.storage";
|
||||
public static final ConfigKey<Boolean> UseSystemVMLocalStorage = new ConfigKey<Boolean>(Boolean.class, SystemVMUseLocalStorageCK, "Advanced", "false",
|
||||
"Indicates whether to use local storage pools or shared storage pools for system VMs.", true, ConfigKey.Scope.Zone, null);
|
||||
|
||||
public enum NetworkType {
|
||||
Basic, Advanced,
|
||||
}
|
||||
|
||||
@ -290,7 +290,7 @@ public class ElasticLoadBalancerManagerImpl extends ManagerBase implements Elast
|
||||
}
|
||||
_mgmtCidr = _configDao.getValue(Config.ManagementNetwork.key());
|
||||
|
||||
boolean useLocalStorage = Boolean.parseBoolean(configs.get(Config.SystemVMUseLocalStorage.key()));
|
||||
boolean useLocalStorage = Boolean.parseBoolean(configs.get(DataCenter.SystemVMUseLocalStorageCK));
|
||||
|
||||
_elasticLbVmRamSize = NumbersUtil.parseInt(configs.get(Config.ElasticLoadBalancerVmMemory.key()), DEFAULT_ELB_VM_RAMSIZE);
|
||||
_elasticLbvmCpuMHz = NumbersUtil.parseInt(configs.get(Config.ElasticLoadBalancerVmCpuMhz.key()), DEFAULT_ELB_VM_CPU_MHZ);
|
||||
|
||||
@ -380,7 +380,7 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements In
|
||||
|
||||
//if offering wasn't set, try to get the default one
|
||||
if (_internalLbVmOfferingId == 0L) {
|
||||
final boolean useLocalStorage = Boolean.parseBoolean(configs.get(Config.SystemVMUseLocalStorage.key()));
|
||||
final boolean useLocalStorage = Boolean.parseBoolean(configs.get(DataCenter.SystemVMUseLocalStorageCK));
|
||||
ServiceOfferingVO newOff =
|
||||
new ServiceOfferingVO("System Offering For Internal LB VM", 1, InternalLoadBalancerVMManager.DEFAULT_INTERNALLB_VM_RAMSIZE,
|
||||
InternalLoadBalancerVMManager.DEFAULT_INTERNALLB_VM_CPU_MHZ, null, null, true, null,
|
||||
|
||||
@ -686,14 +686,6 @@ public enum Config {
|
||||
"The mount point on the Management Server for Secondary Storage.",
|
||||
null),
|
||||
// UpgradeURL("Advanced", ManagementServer.class, String.class, "upgrade.url", "http://example.com:8080/client/agent/update.zip", "The upgrade URL is the URL of the management server that agents will connect to in order to automatically upgrade.", null),
|
||||
SystemVMUseLocalStorage(
|
||||
"Advanced",
|
||||
ManagementServer.class,
|
||||
Boolean.class,
|
||||
"system.vm.use.local.storage",
|
||||
"false",
|
||||
"Indicates whether to use local storage pools or shared storage pools for system VMs.",
|
||||
null, ConfigKey.Scope.Zone.toString()),
|
||||
SystemVMAutoReserveCapacity(
|
||||
"Advanced",
|
||||
ManagementServer.class,
|
||||
@ -2025,16 +2017,6 @@ public enum Config {
|
||||
VMSnapshotCreateWait("Advanced", VMSnapshotManager.class, Integer.class, "vmsnapshot.create.wait", "1800", "In second, timeout for create vm snapshot", null),
|
||||
|
||||
CloudDnsName("Advanced", ManagementServer.class, String.class, "cloud.dns.name", null, "DNS name of the cloud for the GSLB service", null),
|
||||
|
||||
BlacklistedRoutes(
|
||||
"Advanced",
|
||||
VpcManager.class,
|
||||
String.class,
|
||||
"blacklisted.routes",
|
||||
null,
|
||||
"Routes that are blacklisted, can not be used for Static Routes creation for the VPC Private Gateway",
|
||||
"routes",
|
||||
ConfigKey.Scope.Zone.toString()),
|
||||
InternalLbVmServiceOfferingId(
|
||||
"Advanced",
|
||||
ManagementServer.class,
|
||||
|
||||
@ -575,11 +575,11 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
||||
} catch (Throwable e) {
|
||||
throw new CloudRuntimeException("Failed to update storage.network.device2 in host_details due to exception ", e);
|
||||
}
|
||||
} else if (Config.SystemVMUseLocalStorage.key().equalsIgnoreCase(name)) {
|
||||
} else if (DataCenter.SystemVMUseLocalStorageCK.equalsIgnoreCase(name)) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Config 'system.vm.use.local.storage' changed to value:" + value + ", need to update System VM offerings");
|
||||
}
|
||||
boolean useLocalStorage = Boolean.parseBoolean(_configDao.getValue(Config.SystemVMUseLocalStorage.key()));
|
||||
boolean useLocalStorage = Boolean.parseBoolean(_configDao.getValue(DataCenter.SystemVMUseLocalStorageCK));
|
||||
ServiceOfferingVO serviceOffering = _serviceOfferingDao.findByName(ServiceOffering.consoleProxyDefaultOffUniqueName);
|
||||
if (serviceOffering != null) {
|
||||
serviceOffering.setUseLocalStorage(useLocalStorage);
|
||||
|
||||
@ -1208,7 +1208,7 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
|
||||
_disableRpFilter = true;
|
||||
}
|
||||
|
||||
value = configs.get(Config.SystemVMUseLocalStorage.key());
|
||||
value = configs.get(DataCenter.SystemVMUseLocalStorageCK);
|
||||
if (value != null && value.equalsIgnoreCase("true")) {
|
||||
_useLvm = true;
|
||||
}
|
||||
@ -1238,7 +1238,7 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
|
||||
|
||||
_itMgr.registerGuru(VirtualMachine.Type.ConsoleProxy, this);
|
||||
|
||||
boolean useLocalStorage = Boolean.parseBoolean(configs.get(Config.SystemVMUseLocalStorage.key()));
|
||||
boolean useLocalStorage = Boolean.parseBoolean(configs.get(DataCenter.SystemVMUseLocalStorageCK));
|
||||
|
||||
//check if there is a default service offering configured
|
||||
String cpvmSrvcOffIdStr = configs.get(Config.ConsoleProxyServiceOffering.key());
|
||||
|
||||
@ -45,6 +45,8 @@ import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||
import org.apache.cloudstack.framework.config.Configurable;
|
||||
import org.apache.cloudstack.framework.messagebus.MessageBus;
|
||||
import org.apache.cloudstack.framework.messagebus.MessageSubscriber;
|
||||
import org.apache.cloudstack.managed.context.ManagedContextTimerTask;
|
||||
@ -132,7 +134,7 @@ import com.cloud.vm.dao.VMInstanceDao;
|
||||
|
||||
@Local(value = {DeploymentPlanningManager.class})
|
||||
public class DeploymentPlanningManagerImpl extends ManagerBase implements DeploymentPlanningManager, Manager, Listener,
|
||||
StateListener<State, VirtualMachine.Event, VirtualMachine> {
|
||||
StateListener<State, VirtualMachine.Event, VirtualMachine>, Configurable {
|
||||
|
||||
private static final Logger s_logger = Logger.getLogger(DeploymentPlanningManagerImpl.class);
|
||||
@Inject
|
||||
@ -199,8 +201,6 @@ StateListener<State, VirtualMachine.Event, VirtualMachine> {
|
||||
@Inject
|
||||
protected StoragePoolHostDao _poolHostDao;
|
||||
|
||||
@Inject
|
||||
protected DataCenterDao _zoneDao;
|
||||
@Inject
|
||||
protected VolumeDao _volsDao;
|
||||
@Inject
|
||||
@ -762,6 +762,16 @@ StateListener<State, VirtualMachine.Event, VirtualMachine> {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getConfigComponentName() {
|
||||
return DeploymentPlanningManagerImpl.class.getSimpleName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigKey<?>[] getConfigKeys() {
|
||||
return new ConfigKey<?>[] {DataCenter.UseSystemVMLocalStorage};
|
||||
}
|
||||
|
||||
class HostReservationReleaseChecker extends ManagedContextTimerTask {
|
||||
@Override
|
||||
protected void runInContext() {
|
||||
@ -1290,20 +1300,21 @@ StateListener<State, VirtualMachine.Event, VirtualMachine> {
|
||||
DiskProfile diskProfile = new DiskProfile(toBeCreated, diskOffering, vmProfile.getHypervisorType());
|
||||
boolean useLocalStorage = false;
|
||||
if (vmProfile.getType() != VirtualMachine.Type.User) {
|
||||
String ssvmUseLocalStorage = _configDao.getValue(Config.SystemVMUseLocalStorage.key());
|
||||
|
||||
DataCenterVO zone = _zoneDao.findById(plan.getDataCenterId());
|
||||
|
||||
DataCenterVO zone = _dcDao.findById(plan.getDataCenterId());
|
||||
// It should not happen to have a "null" zone here. There can be NO instance if there is NO zone,
|
||||
// so this part of the code would never be reached if no zone has been created.
|
||||
//
|
||||
// Added the check and the comment just to make it clear.
|
||||
boolean zoneUsesLocalStorage = zone != null ? zone.isLocalStorageEnabled() : false;
|
||||
|
||||
boolean ssvmUseLocalStorage = DataCenter.UseSystemVMLocalStorage.value();
|
||||
if (zone != null) {
|
||||
ssvmUseLocalStorage = DataCenter.UseSystemVMLocalStorage.valueIn(plan.getDataCenterId());
|
||||
}
|
||||
s_logger.debug("Checking if we need local storage for systemvms is needed for zone id=" + plan.getDataCenterId() + " with system.vm.use.local.storage=" + ssvmUseLocalStorage);
|
||||
// Local storage is used for the NON User VMs if, and only if, the Zone is marked to use local storage AND
|
||||
// the global settings (ssvmUseLocalStorage) is set to true. Otherwise, the global settings won't be applied.
|
||||
if (ssvmUseLocalStorage.equalsIgnoreCase("true") && zoneUsesLocalStorage) {
|
||||
if (ssvmUseLocalStorage && zoneUsesLocalStorage) {
|
||||
useLocalStorage = true;
|
||||
s_logger.debug("SystemVMs will use local storage for zone id=" + plan.getDataCenterId());
|
||||
}
|
||||
} else {
|
||||
useLocalStorage = diskOffering.getUseLocalStorage();
|
||||
|
||||
@ -631,8 +631,7 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
|
||||
|
||||
_agentMgr.registerForHostEvents(new SshKeysDistriMonitor(_agentMgr, _hostDao, _configDao), true, false, false);
|
||||
|
||||
final boolean useLocalStorage = Boolean.parseBoolean(configs.get(Config.SystemVMUseLocalStorage.key()));
|
||||
|
||||
final boolean useLocalStorage = Boolean.parseBoolean(configs.get(DataCenter.SystemVMUseLocalStorageCK));
|
||||
ServiceOfferingVO offering = new ServiceOfferingVO("System Offering For Software Router", 1, _routerRamSize, _routerCpuMHz, null, null, true, null, ProvisioningType.THIN,
|
||||
useLocalStorage, true, null, true, VirtualMachine.Type.DomainRouter, true);
|
||||
offering.setUniqueName(ServiceOffering.routerDefaultOffUniqueName);
|
||||
|
||||
@ -875,7 +875,7 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
|
||||
if(_serviceOffering == null || !_serviceOffering.getSystemUse()){
|
||||
int ramSize = NumbersUtil.parseInt(_configDao.getValue("ssvm.ram.size"), DEFAULT_SS_VM_RAMSIZE);
|
||||
int cpuFreq = NumbersUtil.parseInt(_configDao.getValue("ssvm.cpu.mhz"), DEFAULT_SS_VM_CPUMHZ);
|
||||
_useLocalStorage = Boolean.parseBoolean(configs.get(Config.SystemVMUseLocalStorage.key()));
|
||||
_useLocalStorage = Boolean.parseBoolean(configs.get(DataCenter.SystemVMUseLocalStorageCK));
|
||||
_serviceOffering =
|
||||
new ServiceOfferingVO("System Offering For Secondary Storage VM", 1, ramSize, cpuFreq, null, null, false, null,
|
||||
Storage.ProvisioningType.THIN, _useLocalStorage, true, null, true, VirtualMachine.Type.SecondaryStorageVm, true);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user