Skip to content

Commit e66f4e9

Browse files
Gabrielerikbocks
authored andcommitted
refactor configuration SystemVMDefaultHypervisor
1 parent f958896 commit e66f4e9

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-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
@@ -75,6 +75,11 @@ public interface ResourceManager extends ResourceService, Configurable {
7575
ConfigKey.Kind.Select,
7676
"," + CPU.CPUArch.getTypesAsCSV());
7777

78+
ConfigKey<String> SystemVMDefaultHypervisor = new ConfigKey<String>(String.class,
79+
"system.vm.default.hypervisor", "Advanced", "Any", "Hypervisor type used to create System VMs. Valid values are: XenServer, KVM, VMware, Hyperv, VirtualBox, " +
80+
"Parralels, BareMetal, Ovm, LXC, Any", true, ConfigKey.Scope.Global, null, null, null, null, null, ConfigKey.Kind.Select, "XenServer, KVM, VMware, Hyperv, " +
81+
"VirtualBox, Parralels, BareMetal, Ovm, LXC, Any");
82+
7883
/**
7984
* Register a listener for different types of resource life cycle events.
8085
* 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
@@ -642,13 +642,6 @@ public enum Config {
642642
"true",
643643
"Indicates whether or not to automatically reserver system VM standby capacity.",
644644
null),
645-
SystemVMDefaultHypervisor("Advanced",
646-
ManagementServer.class,
647-
String.class,
648-
"system.vm.default.hypervisor",
649-
null,
650-
"Hypervisor type used to create system vm, valid values are: XenServer, KVM, VMware, Hyperv, VirtualBox, Parralels, BareMetal, Ovm, LXC, Any",
651-
null),
652645
SystemVMRandomPassword(
653646
"Advanced",
654647
ManagementServer.class,

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

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

322322
private final HashMap<Integer, List<ResourceListener>> _lifeCycleListeners = new HashMap<>();
323-
private HypervisorType _defaultSystemVMHypervisor;
324323

325324
private static final int ACQUIRE_GLOBAL_LOCK_TIMEOUT_FOR_COOPERATION = 30; // seconds
326325

@@ -2784,7 +2783,6 @@ public DataCenter getZone(Long zoneId) {
27842783

27852784
@Override
27862785
public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
2787-
_defaultSystemVMHypervisor = HypervisorType.getType(_configDao.getValue(Config.SystemVMDefaultHypervisor.toString()));
27882786
_gson = GsonHelper.getGson();
27892787

27902788
_hypervisorsInDC = _hostDao.createSearchBuilder(String.class);
@@ -2830,10 +2828,7 @@ public List<HypervisorType> getSupportedHypervisorTypes(final long zoneId, final
28302828

28312829
@Override
28322830
public HypervisorType getDefaultHypervisor(final long zoneId) {
2833-
HypervisorType defaultHyper = HypervisorType.None;
2834-
if (_defaultSystemVMHypervisor != HypervisorType.None) {
2835-
defaultHyper = _defaultSystemVMHypervisor;
2836-
}
2831+
HypervisorType defaultHyper = HypervisorType.getType(ResourceManager.SystemVMDefaultHypervisor.value());
28372832

28382833
final DataCenterVO dc = _dcDao.findById(zoneId);
28392834
if (dc == null) {
@@ -4313,7 +4308,8 @@ public ConfigKey<?>[] getConfigKeys() {
43134308
return new ConfigKey<?>[] {
43144309
KvmSshToAgentEnabled,
43154310
HOST_MAINTENANCE_LOCAL_STRATEGY,
4316-
SystemVmPreferredArchitecture
4311+
SystemVmPreferredArchitecture,
4312+
SystemVMDefaultHypervisor
43174313
};
43184314
}
43194315
}

0 commit comments

Comments
 (0)