CLOUDSTACK-2131: [Performance][Enhancement] Avoid checking for providers that are not enabled while creating network.
For some scenarios like prepare nic, all network service providers are checked which is not efficient and also introduces unnecessary dependencies.
The check to use only the required providers is already there for implement, shutdown operation on network. Put the same check for all missing cases.
CLOUDSTACK-3441: [Load Test] High delays between VM being allocated to Pod and network implementation causing delays in VM deployment
The locking code in implement/shutdown network code was not efficient. Even in order to check the current state of the network lock was getting acquired which is not required. This resulted in delays in deploy VM as can be seen from attached logs where the code waited on the lock just to check if network is implemented.
As part of the fix moved out code that is checking if the network is already implemented or shutdowned outside the lock.