@@ -925,7 +925,7 @@ protected NicTO toNicTO(NicVO nic, NicProfile profile, NetworkVO config) {
925925
926926 boolean isNetworkImplemented (NetworkVO network ) {
927927 Network .State state = network .getState ();
928- if (state == Network .State .Implemented ) {
928+ if (state == Network .State .Implemented || state == Network . State . Implementing ) {
929929 return true ;
930930 } else if (state == Network .State .Setup ) {
931931 DataCenterVO zone = _dcDao .findById (network .getDataCenterId ());
@@ -1277,19 +1277,7 @@ public int compare(NicVO nic1, NicVO nic2) {
12771277 });
12781278
12791279 for (NicVO nic : nics ) {
1280- Pair <NetworkGuru , NetworkVO > implemented = null ;
1281- if (vmProfile .getVirtualMachine ().getType () != Type .DomainRouter ) {
1282- implemented = implementNetwork (nic .getNetworkId (), dest , context );
1283- } else {
1284- // At the time of implementing network (using implementNetwork() method), if the VR needs to be deployed then
1285- // it follows the same path of regular VM deployment. This leads to a nested call to implementNetwork() while
1286- // preparing VR nics. This flow creates issues in dealing with network state transitions. The original call
1287- // puts network in "Implementing" state and then the nested call again tries to put it into same state resulting
1288- // in issues. In order to avoid it, implementNetwork() call for VR is replaced with below code.
1289- NetworkVO network = _networksDao .findById (nic .getNetworkId ());
1290- NetworkGuru guru = AdapterBase .getAdapterByName (networkGurus , network .getGuruName ());
1291- implemented = new Pair <NetworkGuru , NetworkVO >(guru , network );
1292- }
1280+ Pair <NetworkGuru , NetworkVO > implemented = implementNetwork (nic .getNetworkId (), dest , context );
12931281 if (implemented == null || implemented .first () == null ) {
12941282 s_logger .warn ("Failed to implement network id=" + nic .getNetworkId () + " as a part of preparing nic id=" + nic .getId ());
12951283 throw new CloudRuntimeException ("Failed to implement network id=" + nic .getNetworkId () + " as a part preparing nic id=" + nic .getId ());
0 commit comments