@@ -114,8 +114,7 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis
114114 private String _instance ;
115115
116116 @ Inject AgentManager _agentMgr ;
117- @ Inject
118- protected NetworkManager _netMgr ;
117+ @ Inject NetworkManager _netMgr ;
119118 @ Inject HostDao _hostDao ;
120119 @ Inject ClusterDao _clusterDao ;
121120 @ Inject ClusterDetailsDao _clusterDetailsDao ;
@@ -125,8 +124,8 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis
125124 @ Inject SecondaryStorageVmManager _ssvmMgr ;
126125 @ Inject CiscoNexusVSMDeviceDao _nexusDao ;
127126 @ Inject ClusterVSMMapDao _vsmMapDao ;
128-
129- ConfigurationServer _configServer ;
127+ @ Inject ConfigurationDao _configDao ;
128+ @ Inject ConfigurationServer _configServer ;
130129
131130 String _mountParent ;
132131 StorageLayer _storage ;
@@ -174,24 +173,18 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
174173
175174 _name = name ;
176175
177- ComponentLocator locator = ComponentLocator .getCurrentLocator ();
178- ConfigurationDao configDao = locator .getDao (ConfigurationDao .class );
179- if (configDao == null ) {
180- throw new ConfigurationException ("Unable to get the configuration dao." );
181- }
182-
183- if (!configDao .isPremium ()) {
176+ if (!_configDao .isPremium ()) {
184177 s_logger .error ("Vmware component can only run under premium distribution" );
185178 throw new ConfigurationException ("Vmware component can only run under premium distribution" );
186179 }
187180
188- _instance = configDao .getValue (Config .InstanceName .key ());
181+ _instance = _configDao .getValue (Config .InstanceName .key ());
189182 if (_instance == null ) {
190183 _instance = "DEFAULT" ;
191184 }
192185 s_logger .info ("VmwareManagerImpl config - instance.name: " + _instance );
193186
194- _mountParent = configDao .getValue (Config .MountParent .key ());
187+ _mountParent = _configDao .getValue (Config .MountParent .key ());
195188 if (_mountParent == null ) {
196189 _mountParent = File .separator + "mnt" ;
197190 }
@@ -220,7 +213,7 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
220213 }
221214 }
222215
223- value = configDao .getValue (Config .VmwareUseNexusVSwitch .key ());
216+ value = _configDao .getValue (Config .VmwareUseNexusVSwitch .key ());
224217 if (value == null ) {
225218 _nexusVSwitchActive = false ;
226219 }
@@ -229,7 +222,7 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
229222 _nexusVSwitchActive = Boolean .parseBoolean (value );
230223 }
231224
232- _privateNetworkVSwitchName = configDao .getValue (Config .VmwarePrivateNetworkVSwitch .key ());
225+ _privateNetworkVSwitchName = _configDao .getValue (Config .VmwarePrivateNetworkVSwitch .key ());
233226
234227 if (_privateNetworkVSwitchName == null ) {
235228 if (_nexusVSwitchActive ) {
@@ -239,7 +232,7 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
239232 }
240233 }
241234
242- _publicNetworkVSwitchName = configDao .getValue (Config .VmwarePublicNetworkVSwitch .key ());
235+ _publicNetworkVSwitchName = _configDao .getValue (Config .VmwarePublicNetworkVSwitch .key ());
243236
244237 if (_publicNetworkVSwitchName == null ) {
245238 if (_nexusVSwitchActive ) {
@@ -249,7 +242,7 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
249242 }
250243 }
251244
252- _guestNetworkVSwitchName = configDao .getValue (Config .VmwareGuestNetworkVSwitch .key ());
245+ _guestNetworkVSwitchName = _configDao .getValue (Config .VmwareGuestNetworkVSwitch .key ());
253246
254247 if (_guestNetworkVSwitchName == null ) {
255248 if (_nexusVSwitchActive ) {
@@ -259,69 +252,66 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
259252 }
260253 }
261254
262- _serviceConsoleName = configDao .getValue (Config .VmwareServiceConsole .key ());
255+ _serviceConsoleName = _configDao .getValue (Config .VmwareServiceConsole .key ());
263256 if (_serviceConsoleName == null ) {
264257 _serviceConsoleName = "Service Console" ;
265258 }
266259
267- _managemetPortGroupName = configDao .getValue (Config .VmwareManagementPortGroup .key ());
260+ _managemetPortGroupName = _configDao .getValue (Config .VmwareManagementPortGroup .key ());
268261 if (_managemetPortGroupName == null ) {
269262 _managemetPortGroupName = "Management Network" ;
270263 }
271264
272- _defaultSystemVmNicAdapterType = configDao .getValue (Config .VmwareSystemVmNicDeviceType .key ());
265+ _defaultSystemVmNicAdapterType = _configDao .getValue (Config .VmwareSystemVmNicDeviceType .key ());
273266 if (_defaultSystemVmNicAdapterType == null )
274267 _defaultSystemVmNicAdapterType = VirtualEthernetCardType .E1000 .toString ();
275268
276- _additionalPortRangeStart = NumbersUtil .parseInt (configDao .getValue (Config .VmwareAdditionalVncPortRangeStart .key ()), 59000 );
269+ _additionalPortRangeStart = NumbersUtil .parseInt (_configDao .getValue (Config .VmwareAdditionalVncPortRangeStart .key ()), 59000 );
277270 if (_additionalPortRangeStart > 65535 ) {
278271 s_logger .warn ("Invalid port range start port (" + _additionalPortRangeStart + ") for additional VNC port allocation, reset it to default start port 59000" );
279272 _additionalPortRangeStart = 59000 ;
280273 }
281274
282- _additionalPortRangeSize = NumbersUtil .parseInt (configDao .getValue (Config .VmwareAdditionalVncPortRangeSize .key ()), 1000 );
275+ _additionalPortRangeSize = NumbersUtil .parseInt (_configDao .getValue (Config .VmwareAdditionalVncPortRangeSize .key ()), 1000 );
283276 if (_additionalPortRangeSize < 0 || _additionalPortRangeStart + _additionalPortRangeSize > 65535 ) {
284277 s_logger .warn ("Invalid port range size (" + _additionalPortRangeSize + " for range starts at " + _additionalPortRangeStart );
285278 _additionalPortRangeSize = Math .min (1000 , 65535 - _additionalPortRangeStart );
286279 }
287280
288- _routerExtraPublicNics = NumbersUtil .parseInt (configDao .getValue (Config .RouterExtraPublicNics .key ()), 2 );
281+ _routerExtraPublicNics = NumbersUtil .parseInt (_configDao .getValue (Config .RouterExtraPublicNics .key ()), 2 );
289282
290- _maxHostsPerCluster = NumbersUtil .parseInt (configDao .getValue (Config .VmwarePerClusterHostMax .key ()), VmwareManager .MAX_HOSTS_PER_CLUSTER );
291- _cpuOverprovisioningFactor = configDao .getValue (Config .CPUOverprovisioningFactor .key ());
283+ _maxHostsPerCluster = NumbersUtil .parseInt (_configDao .getValue (Config .VmwarePerClusterHostMax .key ()), VmwareManager .MAX_HOSTS_PER_CLUSTER );
284+ _cpuOverprovisioningFactor = _configDao .getValue (Config .CPUOverprovisioningFactor .key ());
292285 if (_cpuOverprovisioningFactor == null || _cpuOverprovisioningFactor .isEmpty ())
293286 _cpuOverprovisioningFactor = "1" ;
294287
295- _memOverprovisioningFactor = configDao .getValue (Config .MemOverprovisioningFactor .key ());
288+ _memOverprovisioningFactor = _configDao .getValue (Config .MemOverprovisioningFactor .key ());
296289 if (_memOverprovisioningFactor == null || _memOverprovisioningFactor .isEmpty ())
297290 _memOverprovisioningFactor = "1" ;
298291
299- _reserveCpu = configDao .getValue (Config .VmwareReserveCpu .key ());
292+ _reserveCpu = _configDao .getValue (Config .VmwareReserveCpu .key ());
300293 if (_reserveCpu == null || _reserveCpu .isEmpty ())
301294 _reserveCpu = "false" ;
302- _reserveMem = configDao .getValue (Config .VmwareReserveMem .key ());
295+ _reserveMem = _configDao .getValue (Config .VmwareReserveMem .key ());
303296 if (_reserveMem == null || _reserveMem .isEmpty ())
304297 _reserveMem = "false" ;
305298
306- _recycleHungWorker = configDao .getValue (Config .VmwareRecycleHungWorker .key ());
299+ _recycleHungWorker = _configDao .getValue (Config .VmwareRecycleHungWorker .key ());
307300 if (_recycleHungWorker == null || _recycleHungWorker .isEmpty ())
308301 _recycleHungWorker = "false" ;
309302
310- _rootDiskController = configDao .getValue (Config .VmwareRootDiskControllerType .key ());
303+ _rootDiskController = _configDao .getValue (Config .VmwareRootDiskControllerType .key ());
311304 if (_rootDiskController == null || _rootDiskController .isEmpty ())
312305 _rootDiskController = DiskControllerType .ide .toString ();
313306
314307 s_logger .info ("Additional VNC port allocation range is settled at " + _additionalPortRangeStart + " to " + (_additionalPortRangeStart + _additionalPortRangeSize ));
315308
316- value = configDao .getValue ("vmware.host.scan.interval" );
309+ value = _configDao .getValue ("vmware.host.scan.interval" );
317310 _hostScanInterval = NumbersUtil .parseLong (value , DEFAULT_HOST_SCAN_INTERVAL );
318311 s_logger .info ("VmwareManagerImpl config - vmware.host.scan.interval: " + _hostScanInterval );
319312
320313 ((VmwareStorageManagerImpl )_storageMgr ).configure (params );
321314
322- if (_configServer == null )
323- _configServer = (ConfigurationServer )ComponentLocator .getComponent (ConfigurationServer .Name );
324-
325315 _agentMgr .registerForHostEvents (this , true , true , true );
326316
327317 s_logger .info ("VmwareManagerImpl has been successfully configured" );
0 commit comments