Skip to content

Commit 9d226fe

Browse files
author
Gabriel
committed
refactor configuration SystemVMDefaultHypervisor
1 parent 3fd5680 commit 9d226fe

File tree

3 files changed

+7
-14
lines changed

3 files changed

+7
-14
lines changed

engine/components-api/src/main/java/com/cloud/resource/ResourceManager.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ public interface ResourceManager extends ResourceService, Configurable {
6161
+ "To force-stop VMs, choose 'ForceStop' strategy",
6262
true, ConfigKey.Scope.Global, null, null, null, null, null, ConfigKey.Kind.Select, "Error,Migration,ForceStop");
6363

64+
ConfigKey<String> SystemVMDefaultHypervisor = new ConfigKey<String>(String.class,
65+
"system.vm.default.hypervisor", "Advanced", "Any", "Hypervisor type used to create System VMs. Valid values are: XenServer, KVM, VMware, Hyperv, VirtualBox, " +
66+
"Parralels, BareMetal, Ovm, LXC, Any", true, ConfigKey.Scope.Global, null, null, null, null, null, ConfigKey.Kind.Select, "XenServer, KVM, VMware, Hyperv, " +
67+
"VirtualBox, Parralels, BareMetal, Ovm, LXC, Any");
68+
6469
/**
6570
* Register a listener for different types of resource life cycle events.
6671
* There can only be one type of listener per type of host.

server/src/main/java/com/cloud/configuration/Config.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -645,13 +645,6 @@ public enum Config {
645645
"true",
646646
"Indicates whether or not to automatically reserver system VM standby capacity.",
647647
null),
648-
SystemVMDefaultHypervisor("Advanced",
649-
ManagementServer.class,
650-
String.class,
651-
"system.vm.default.hypervisor",
652-
null,
653-
"Hypervisor type used to create system vm, valid values are: XenServer, KVM, VMware, Hyperv, VirtualBox, Parralels, BareMetal, Ovm, LXC, Any",
654-
null),
655648
SystemVMRandomPassword(
656649
"Advanced",
657650
ManagementServer.class,

server/src/main/java/com/cloud/resource/ResourceManagerImpl.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,6 @@ public void setDiscoverers(final List<? extends Discoverer> discoverers) {
312312
private final HashMap<String, ResourceStateAdapter> _resourceStateAdapters = new HashMap<String, ResourceStateAdapter>();
313313

314314
private final HashMap<Integer, List<ResourceListener>> _lifeCycleListeners = new HashMap<Integer, List<ResourceListener>>();
315-
private HypervisorType _defaultSystemVMHypervisor;
316315

317316
private static final int ACQUIRE_GLOBAL_LOCK_TIMEOUT_FOR_COOPERATION = 30; // seconds
318317

@@ -2022,7 +2021,6 @@ public DataCenter getZone(Long zoneId) {
20222021

20232022
@Override
20242023
public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
2025-
_defaultSystemVMHypervisor = HypervisorType.getType(_configDao.getValue(Config.SystemVMDefaultHypervisor.toString()));
20262024
_gson = GsonHelper.getGson();
20272025

20282026
_hypervisorsInDC = _hostDao.createSearchBuilder(String.class);
@@ -2068,10 +2066,7 @@ public List<HypervisorType> getSupportedHypervisorTypes(final long zoneId, final
20682066

20692067
@Override
20702068
public HypervisorType getDefaultHypervisor(final long zoneId) {
2071-
HypervisorType defaultHyper = HypervisorType.None;
2072-
if (_defaultSystemVMHypervisor != HypervisorType.None) {
2073-
defaultHyper = _defaultSystemVMHypervisor;
2074-
}
2069+
HypervisorType defaultHyper = HypervisorType.getType(ResourceManager.SystemVMDefaultHypervisor.value());
20752070

20762071
final DataCenterVO dc = _dcDao.findById(zoneId);
20772072
if (dc == null) {
@@ -3534,6 +3529,6 @@ public String getConfigComponentName() {
35343529

35353530
@Override
35363531
public ConfigKey<?>[] getConfigKeys() {
3537-
return new ConfigKey<?>[] {KvmSshToAgentEnabled, HOST_MAINTENANCE_LOCAL_STRATEGY};
3532+
return new ConfigKey<?>[] {KvmSshToAgentEnabled, HOST_MAINTENANCE_LOCAL_STRATEGY, SystemVMDefaultHypervisor};
35383533
}
35393534
}

0 commit comments

Comments
 (0)