Skip to content

Commit 13becce

Browse files
GabrielGaOrtiga
authored andcommitted
refactor configuration SystemVMDefaultHypervisor
1 parent b19c069 commit 13becce

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
@@ -644,13 +644,6 @@ public enum Config {
644644
"true",
645645
"Indicates whether or not to automatically reserver system VM standby capacity.",
646646
null),
647-
SystemVMDefaultHypervisor("Advanced",
648-
ManagementServer.class,
649-
String.class,
650-
"system.vm.default.hypervisor",
651-
null,
652-
"Hypervisor type used to create system vm, valid values are: XenServer, KVM, VMware, Hyperv, VirtualBox, Parralels, BareMetal, Ovm, LXC, Any",
653-
null),
654647
SystemVMRandomPassword(
655648
"Advanced",
656649
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
@@ -313,7 +313,6 @@ public void setDiscoverers(final List<? extends Discoverer> discoverers) {
313313
private final HashMap<String, ResourceStateAdapter> _resourceStateAdapters = new HashMap<String, ResourceStateAdapter>();
314314

315315
private final HashMap<Integer, List<ResourceListener>> _lifeCycleListeners = new HashMap<Integer, List<ResourceListener>>();
316-
private HypervisorType _defaultSystemVMHypervisor;
317316

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

@@ -2031,7 +2030,6 @@ public DataCenter getZone(Long zoneId) {
20312030

20322031
@Override
20332032
public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
2034-
_defaultSystemVMHypervisor = HypervisorType.getType(_configDao.getValue(Config.SystemVMDefaultHypervisor.toString()));
20352033
_gson = GsonHelper.getGson();
20362034

20372035
_hypervisorsInDC = _hostDao.createSearchBuilder(String.class);
@@ -2077,10 +2075,7 @@ public List<HypervisorType> getSupportedHypervisorTypes(final long zoneId, final
20772075

20782076
@Override
20792077
public HypervisorType getDefaultHypervisor(final long zoneId) {
2080-
HypervisorType defaultHyper = HypervisorType.None;
2081-
if (_defaultSystemVMHypervisor != HypervisorType.None) {
2082-
defaultHyper = _defaultSystemVMHypervisor;
2083-
}
2078+
HypervisorType defaultHyper = HypervisorType.getType(ResourceManager.SystemVMDefaultHypervisor.value());
20842079

20852080
final DataCenterVO dc = _dcDao.findById(zoneId);
20862081
if (dc == null) {
@@ -3567,6 +3562,6 @@ public String getConfigComponentName() {
35673562

35683563
@Override
35693564
public ConfigKey<?>[] getConfigKeys() {
3570-
return new ConfigKey<?>[] {KvmSshToAgentEnabled, HOST_MAINTENANCE_LOCAL_STRATEGY};
3565+
return new ConfigKey<?>[] {KvmSshToAgentEnabled, HOST_MAINTENANCE_LOCAL_STRATEGY, SystemVMDefaultHypervisor};
35713566
}
35723567
}

0 commit comments

Comments
 (0)