@@ -352,7 +352,6 @@ public void setDiscoverers(final List<? extends Discoverer> discoverers) {
352352 private final HashMap <String , ResourceStateAdapter > _resourceStateAdapters = new HashMap <>();
353353
354354 private final HashMap <Integer , List <ResourceListener >> _lifeCycleListeners = new HashMap <>();
355- private HypervisorType _defaultSystemVMHypervisor ;
356355
357356 private static final int ACQUIRE_GLOBAL_LOCK_TIMEOUT_FOR_COOPERATION = 30 ; // seconds
358357
@@ -2935,7 +2934,6 @@ public DataCenter getZone(Long zoneId) {
29352934
29362935 @ Override
29372936 public boolean configure (final String name , final Map <String , Object > params ) throws ConfigurationException {
2938- _defaultSystemVMHypervisor = HypervisorType .getType (_configDao .getValue (Config .SystemVMDefaultHypervisor .toString ()));
29392937 _gson = GsonHelper .getGson ();
29402938
29412939 _hypervisorsInDC = _hostDao .createSearchBuilder (String .class );
@@ -2981,10 +2979,7 @@ public List<HypervisorType> getSupportedHypervisorTypes(final long zoneId, final
29812979
29822980 @ Override
29832981 public HypervisorType getDefaultHypervisor (final long zoneId ) {
2984- HypervisorType defaultHyper = HypervisorType .None ;
2985- if (_defaultSystemVMHypervisor != HypervisorType .None ) {
2986- defaultHyper = _defaultSystemVMHypervisor ;
2987- }
2982+ HypervisorType systemVMDefaultHypervisor = HypervisorType .getType (ResourceManager .SystemVMDefaultHypervisor .value ());
29882983
29892984 final DataCenterVO dc = _dcDao .findById (zoneId );
29902985 if (dc == null ) {
@@ -2993,27 +2988,27 @@ public HypervisorType getDefaultHypervisor(final long zoneId) {
29932988 _dcDao .loadDetails (dc );
29942989 final String defaultHypervisorInZone = dc .getDetail ("defaultSystemVMHypervisorType" );
29952990 if (defaultHypervisorInZone != null ) {
2996- defaultHyper = HypervisorType .getType (defaultHypervisorInZone );
2991+ systemVMDefaultHypervisor = HypervisorType .getType (defaultHypervisorInZone );
29972992 }
29982993
29992994 final List <VMTemplateVO > systemTemplates = _templateDao .listAllSystemVMTemplates ();
30002995 boolean isValid = false ;
30012996 for (final VMTemplateVO template : systemTemplates ) {
3002- if (template .getHypervisorType () == defaultHyper ) {
2997+ if (template .getHypervisorType () == systemVMDefaultHypervisor ) {
30032998 isValid = true ;
30042999 break ;
30053000 }
30063001 }
30073002
30083003 if (isValid ) {
3009- final List <ClusterVO > clusters = _clusterDao .listByDcHyType (zoneId , defaultHyper .toString ());
3004+ final List <ClusterVO > clusters = _clusterDao .listByDcHyType (zoneId , systemVMDefaultHypervisor .toString ());
30103005 if (clusters .isEmpty ()) {
30113006 isValid = false ;
30123007 }
30133008 }
30143009
30153010 if (isValid ) {
3016- return defaultHyper ;
3011+ return systemVMDefaultHypervisor ;
30173012 } else {
30183013 return HypervisorType .None ;
30193014 }
@@ -4578,7 +4573,8 @@ public ConfigKey<?>[] getConfigKeys() {
45784573 return new ConfigKey <?>[] {
45794574 KvmSshToAgentEnabled ,
45804575 HOST_MAINTENANCE_LOCAL_STRATEGY ,
4581- SystemVmPreferredArchitecture
4576+ SystemVmPreferredArchitecture ,
4577+ SystemVMDefaultHypervisor
45824578 };
45834579 }
45844580}
0 commit comments