@@ -272,10 +272,15 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
272272 RemoteAccessVpnService _vpnMgr ;
273273 @ Inject
274274 PodVlanMapDao _podVlanMapDao ;
275- @ com .cloud .utils .component .Inject (adapter = NetworkGuru .class )
276- Adapters <NetworkGuru > _networkGurus ;
277- @ com .cloud .utils .component .Inject (adapter = NetworkElement .class )
278- Adapters <NetworkElement > _networkElements ;
275+
276+ //@com.cloud.utils.component.Inject(adapter = NetworkGuru.class)
277+ @ Inject
278+ List <NetworkGuru > _networkGurus ;
279+
280+ // @com.cloud.utils.component.Inject(adapter = NetworkElement.class)
281+ @ Inject
282+ List <NetworkElement > _networkElements ;
283+
279284 @ Inject
280285 NetworkDomainDao _networkDomainDao ;
281286 @ Inject
@@ -351,7 +356,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
351356 @ Override
352357 public NetworkElement getElementImplementingProvider (String providerName ) {
353358 String elementName = s_providerToNetworkElementMap .get (providerName );
354- NetworkElement element = _networkElements . get ( elementName );
359+ NetworkElement element = Adapters . getAdapterByName ( _networkElements , elementName );
355360 return element ;
356361 }
357362
@@ -1791,7 +1796,7 @@ public Pair<NicProfile,Integer> allocateNic(NicProfile requested, Network networ
17911796
17921797 NetworkVO ntwkVO = _networksDao .findById (network .getId ());
17931798 s_logger .debug ("Allocating nic for vm " + vm .getVirtualMachine () + " in network " + network + " with requested profile " + requested );
1794- NetworkGuru guru = _networkGurus . get ( ntwkVO .getGuruName ());
1799+ NetworkGuru guru = Adapters . getAdapterByName ( _networkGurus , ntwkVO .getGuruName ());
17951800
17961801 if (requested != null && requested .getMode () == null ) {
17971802 requested .setMode (network .getMode ());
@@ -1936,7 +1941,7 @@ public Pair<NetworkGuru, NetworkVO> implementNetwork(long networkId, DeployDesti
19361941 }
19371942
19381943 try {
1939- NetworkGuru guru = _networkGurus . get ( network .getGuruName ());
1944+ NetworkGuru guru = Adapters . getAdapterByName ( _networkGurus , network .getGuruName ());
19401945 Network .State state = network .getState ();
19411946 if (state == Network .State .Implemented || state == Network .State .Setup || state == Network .State .Implementing ) {
19421947 s_logger .debug ("Network id=" + networkId + " is already implemented" );
@@ -2124,7 +2129,7 @@ public NicProfile prepareNic(VirtualMachineProfile<? extends VMInstanceVO> vmPro
21242129 ConcurrentOperationException , InsufficientCapacityException , ResourceUnavailableException {
21252130
21262131 Integer networkRate = getNetworkRate (network .getId (), vmProfile .getId ());
2127- NetworkGuru guru = _networkGurus . get ( network .getGuruName ());
2132+ NetworkGuru guru = Adapters . getAdapterByName ( _networkGurus , network .getGuruName ());
21282133 NicVO nic = _nicDao .findById (nicId );
21292134
21302135 NicProfile profile = null ;
@@ -2186,7 +2191,7 @@ public <T extends VMInstanceVO> void prepareNicForMigration(VirtualMachineProfil
21862191 NetworkVO network = _networksDao .findById (nic .getNetworkId ());
21872192 Integer networkRate = getNetworkRate (network .getId (), vm .getId ());
21882193
2189- NetworkGuru guru = _networkGurus . get ( network .getGuruName ());
2194+ NetworkGuru guru = Adapters . getAdapterByName ( _networkGurus , network .getGuruName ());
21902195 NicProfile profile = new NicProfile (nic , network , nic .getBroadcastUri (), nic .getIsolationUri (), networkRate ,
21912196 isSecurityGroupSupportedInNetwork (network ), getNetworkTag (vm .getHypervisorType (), network ));
21922197 guru .updateNicProfile (profile , network );
@@ -2216,7 +2221,7 @@ protected void releaseNic(VirtualMachineProfile<? extends VMInstanceVO> vmProfil
22162221 if (nic .getState () == Nic .State .Reserved || nic .getState () == Nic .State .Reserving ) {
22172222 Nic .State originalState = nic .getState ();
22182223 if (nic .getReservationStrategy () == Nic .ReservationStrategy .Start ) {
2219- NetworkGuru guru = _networkGurus . get ( network .getGuruName ());
2224+ NetworkGuru guru = Adapters . getAdapterByName ( _networkGurus , network .getGuruName ());
22202225 nic .setState (Nic .State .Releasing );
22212226 _nicDao .update (nic .getId (), nic );
22222227 NicProfile profile = new NicProfile (nic , network , nic .getBroadcastUri (), nic .getIsolationUri (), null ,
@@ -2262,7 +2267,7 @@ public List<NicProfile> getNicProfiles(VirtualMachine vm) {
22622267 NetworkVO network = _networksDao .findById (nic .getNetworkId ());
22632268 Integer networkRate = getNetworkRate (network .getId (), vm .getId ());
22642269
2265- NetworkGuru guru = _networkGurus . get ( network .getGuruName ());
2270+ NetworkGuru guru = Adapters . getAdapterByName ( _networkGurus , network .getGuruName ());
22662271 NicProfile profile = new NicProfile (nic , network , nic .getBroadcastUri (), nic .getIsolationUri (),
22672272 networkRate , isSecurityGroupSupportedInNetwork (network ), getNetworkTag (vm .getHypervisorType (), network ));
22682273 guru .updateNicProfile (profile , network );
@@ -2283,7 +2288,7 @@ public NicProfile getNicProfile(VirtualMachine vm, long networkId, String broadc
22832288 NetworkVO network = _networksDao .findById (networkId );
22842289 Integer networkRate = getNetworkRate (network .getId (), vm .getId ());
22852290
2286- NetworkGuru guru = _networkGurus . get ( network .getGuruName ());
2291+ NetworkGuru guru = Adapters . getAdapterByName ( _networkGurus , network .getGuruName ());
22872292 NicProfile profile = new NicProfile (nic , network , nic .getBroadcastUri (), nic .getIsolationUri (),
22882293 networkRate , isSecurityGroupSupportedInNetwork (network ), getNetworkTag (vm .getHypervisorType (), network ));
22892294 guru .updateNicProfile (profile , network );
@@ -2438,7 +2443,7 @@ protected void removeNic(VirtualMachineProfile<? extends VMInstanceVO> vm, NicVO
24382443 NetworkVO network = _networksDao .findById (nic .getNetworkId ());
24392444 NicProfile profile = new NicProfile (nic , network , null , null , null ,
24402445 isSecurityGroupSupportedInNetwork (network ), getNetworkTag (vm .getHypervisorType (), network ));
2441- NetworkGuru guru = _networkGurus . get ( network .getGuruName ());
2446+ NetworkGuru guru = Adapters . getAdapterByName ( _networkGurus , network .getGuruName ());
24422447 guru .deallocate (network , profile , vm );
24432448 _nicDao .remove (nic .getId ());
24442449 s_logger .debug ("Removed nic id=" + nic .getId ());
@@ -3414,7 +3419,7 @@ public boolean shutdownNetwork(long networkId, ReservationContext context, boole
34143419 if (s_logger .isDebugEnabled ()) {
34153420 s_logger .debug ("Network id=" + networkId + " is shutdown successfully, cleaning up corresponding resources now." );
34163421 }
3417- NetworkGuru guru = _networkGurus . get ( network .getGuruName ());
3422+ NetworkGuru guru = Adapters . getAdapterByName ( _networkGurus , network .getGuruName ());
34183423 NetworkProfile profile = convertNetworkToNetworkProfile (network .getId ());
34193424 guru .shutdown (profile , _networkOfferingDao .findById (network .getNetworkOfferingId ()));
34203425
@@ -3574,7 +3579,7 @@ public boolean destroyNetwork(long networkId, ReservationContext context) {
35743579 if (s_logger .isDebugEnabled ()) {
35753580 s_logger .debug ("Network id=" + networkId + " is destroyed successfully, cleaning up corresponding resources now." );
35763581 }
3577- NetworkGuru guru = _networkGurus . get ( network .getGuruName ());
3582+ NetworkGuru guru = Adapters . getAdapterByName ( _networkGurus , network .getGuruName ());
35783583 Account owner = _accountMgr .getAccount (network .getAccountId ());
35793584
35803585 Transaction txn = Transaction .currentTxn ();
@@ -4258,7 +4263,7 @@ public IpAddress getIp(long ipAddressId) {
42584263 @ Override
42594264 public NetworkProfile convertNetworkToNetworkProfile (long networkId ) {
42604265 NetworkVO network = _networksDao .findById (networkId );
4261- NetworkGuru guru = _networkGurus . get ( network .getGuruName ());
4266+ NetworkGuru guru = Adapters . getAdapterByName ( _networkGurus , network .getGuruName ());
42624267 NetworkProfile profile = new NetworkProfile (network );
42634268 guru .updateNetworkProfile (profile );
42644269
0 commit comments