Skip to content

Commit

Permalink
refactor configuration SystemVMDefaultHypervisor
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel committed Apr 10, 2024
1 parent 3fd5680 commit 9d226fe
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ public interface ResourceManager extends ResourceService, Configurable {
+ "To force-stop VMs, choose 'ForceStop' strategy",
true, ConfigKey.Scope.Global, null, null, null, null, null, ConfigKey.Kind.Select, "Error,Migration,ForceStop");

ConfigKey<String> SystemVMDefaultHypervisor = new ConfigKey<String>(String.class,
"system.vm.default.hypervisor", "Advanced", "Any", "Hypervisor type used to create System VMs. Valid values are: XenServer, KVM, VMware, Hyperv, VirtualBox, " +
"Parralels, BareMetal, Ovm, LXC, Any", true, ConfigKey.Scope.Global, null, null, null, null, null, ConfigKey.Kind.Select, "XenServer, KVM, VMware, Hyperv, " +
"VirtualBox, Parralels, BareMetal, Ovm, LXC, Any");

/**
* Register a listener for different types of resource life cycle events.
* There can only be one type of listener per type of host.
Expand Down
7 changes: 0 additions & 7 deletions server/src/main/java/com/cloud/configuration/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -645,13 +645,6 @@ public enum Config {
"true",
"Indicates whether or not to automatically reserver system VM standby capacity.",
null),
SystemVMDefaultHypervisor("Advanced",
ManagementServer.class,
String.class,
"system.vm.default.hypervisor",
null,
"Hypervisor type used to create system vm, valid values are: XenServer, KVM, VMware, Hyperv, VirtualBox, Parralels, BareMetal, Ovm, LXC, Any",
null),
SystemVMRandomPassword(
"Advanced",
ManagementServer.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,6 @@ public void setDiscoverers(final List<? extends Discoverer> discoverers) {
private final HashMap<String, ResourceStateAdapter> _resourceStateAdapters = new HashMap<String, ResourceStateAdapter>();

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

private static final int ACQUIRE_GLOBAL_LOCK_TIMEOUT_FOR_COOPERATION = 30; // seconds

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

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

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

@Override
public HypervisorType getDefaultHypervisor(final long zoneId) {
HypervisorType defaultHyper = HypervisorType.None;
if (_defaultSystemVMHypervisor != HypervisorType.None) {
defaultHyper = _defaultSystemVMHypervisor;
}
HypervisorType defaultHyper = HypervisorType.getType(ResourceManager.SystemVMDefaultHypervisor.value());

Check warning on line 2069 in server/src/main/java/com/cloud/resource/ResourceManagerImpl.java

View check run for this annotation

Codecov / codecov/patch

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

Added line #L2069 was not covered by tests

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

@Override
public ConfigKey<?>[] getConfigKeys() {
return new ConfigKey<?>[] {KvmSshToAgentEnabled, HOST_MAINTENANCE_LOCAL_STRATEGY};
return new ConfigKey<?>[] {KvmSshToAgentEnabled, HOST_MAINTENANCE_LOCAL_STRATEGY, SystemVMDefaultHypervisor};
}
}

0 comments on commit 9d226fe

Please sign in to comment.