@@ -353,7 +353,6 @@ public void setDiscoverers(final List<? extends Discoverer> discoverers) {
353353 private final HashMap <String , ResourceStateAdapter > _resourceStateAdapters = new HashMap <>();
354354
355355 private final HashMap <Integer , List <ResourceListener >> _lifeCycleListeners = new HashMap <>();
356- private HypervisorType _defaultSystemVMHypervisor ;
357356
358357 private static final int ACQUIRE_GLOBAL_LOCK_TIMEOUT_FOR_COOPERATION = 30 ; // seconds
359358
@@ -2956,7 +2955,6 @@ public DataCenter getZone(Long zoneId) {
29562955
29572956 @ Override
29582957 public boolean configure (final String name , final Map <String , Object > params ) throws ConfigurationException {
2959- _defaultSystemVMHypervisor = HypervisorType .getType (_configDao .getValue (Config .SystemVMDefaultHypervisor .toString ()));
29602958 _gson = GsonHelper .getGson ();
29612959
29622960 _hypervisorsInDC = _hostDao .createSearchBuilder (String .class );
@@ -3002,10 +3000,7 @@ public List<HypervisorType> getSupportedHypervisorTypes(final long zoneId, final
30023000
30033001 @ Override
30043002 public HypervisorType getDefaultHypervisor (final long zoneId ) {
3005- HypervisorType defaultHyper = HypervisorType .None ;
3006- if (_defaultSystemVMHypervisor != HypervisorType .None ) {
3007- defaultHyper = _defaultSystemVMHypervisor ;
3008- }
3003+ HypervisorType systemVMDefaultHypervisor = HypervisorType .getType (ResourceManager .SystemVMDefaultHypervisor .value ());
30093004
30103005 final DataCenterVO dc = _dcDao .findById (zoneId );
30113006 if (dc == null ) {
@@ -3014,27 +3009,27 @@ public HypervisorType getDefaultHypervisor(final long zoneId) {
30143009 _dcDao .loadDetails (dc );
30153010 final String defaultHypervisorInZone = dc .getDetail ("defaultSystemVMHypervisorType" );
30163011 if (defaultHypervisorInZone != null ) {
3017- defaultHyper = HypervisorType .getType (defaultHypervisorInZone );
3012+ systemVMDefaultHypervisor = HypervisorType .getType (defaultHypervisorInZone );
30183013 }
30193014
30203015 final List <VMTemplateVO > systemTemplates = _templateDao .listAllSystemVMTemplates ();
30213016 boolean isValid = false ;
30223017 for (final VMTemplateVO template : systemTemplates ) {
3023- if (template .getHypervisorType () == defaultHyper ) {
3018+ if (template .getHypervisorType () == systemVMDefaultHypervisor ) {
30243019 isValid = true ;
30253020 break ;
30263021 }
30273022 }
30283023
30293024 if (isValid ) {
3030- final List <ClusterVO > clusters = _clusterDao .listByDcHyType (zoneId , defaultHyper .toString ());
3025+ final List <ClusterVO > clusters = _clusterDao .listByDcHyType (zoneId , systemVMDefaultHypervisor .toString ());
30313026 if (clusters .isEmpty ()) {
30323027 isValid = false ;
30333028 }
30343029 }
30353030
30363031 if (isValid ) {
3037- return defaultHyper ;
3032+ return systemVMDefaultHypervisor ;
30383033 } else {
30393034 return HypervisorType .None ;
30403035 }
@@ -4630,7 +4625,8 @@ public ConfigKey<?>[] getConfigKeys() {
46304625 KvmSshToAgentEnabled ,
46314626 KvmSshPort ,
46324627 HOST_MAINTENANCE_LOCAL_STRATEGY ,
4633- SystemVmPreferredArchitecture
4628+ SystemVmPreferredArchitecture ,
4629+ SystemVMDefaultHypervisor
46344630 };
46354631 }
46364632}
0 commit comments