@@ -2131,7 +2131,8 @@ private void ensureVmRunningContext(long hostId, VMInstanceVO vm, Event cause) t
21312131 List <NicVO > nics = _nicsDao .listByVmId (profile .getId ());
21322132 for (NicVO nic : nics ) {
21332133 Network network = _networkMgr .getNetwork (nic .getNetworkId ());
2134- NicProfile nicProfile = new NicProfile (nic , network , nic .getBroadcastUri (), nic .getIsolationUri (), null , _networkMgr .isSecurityGroupSupportedInNetwork (network ), _networkMgr .getNetworkTag (profile .getHypervisorType (), network ));
2134+ NicProfile nicProfile = new NicProfile (nic , network , nic .getBroadcastUri (), nic .getIsolationUri (), null ,
2135+ _networkMgr .isSecurityGroupSupportedInNetwork (network ), _networkMgr .getNetworkTag (profile .getHypervisorType (), network ));
21352136 profile .addNic (nicProfile );
21362137 }
21372138
@@ -2469,7 +2470,7 @@ public NicProfile addVmToNetwork(VirtualMachine vm, Network network) throws Conc
24692470 VirtualMachineTO vmTO = hvGuru .implement (vmProfile );
24702471
24712472 //4) Convert nicProfile to NicTO
2472- NicTO nicTO = hvGuru . toNicTO (nic );
2473+ NicTO nicTO = toNicTO (nic , vmProfile . getVirtualMachine (). getHypervisorType () );
24732474
24742475 //5) plug the nic to the vm
24752476 VirtualMachineGuru <VMInstanceVO > vmGuru = getVmGuru (vmVO );
@@ -2483,6 +2484,14 @@ public NicProfile addVmToNetwork(VirtualMachine vm, Network network) throws Conc
24832484 }
24842485
24852486 }
2487+
2488+ @ Override
2489+ public NicTO toNicTO (NicProfile nic , HypervisorType hypervisorType ) {
2490+ HypervisorGuru hvGuru = _hvGuruMgr .getGuru (hypervisorType );
2491+
2492+ NicTO nicTO = hvGuru .toNicTO (nic );
2493+ return nicTO ;
2494+ }
24862495
24872496 @ Override
24882497 public boolean removeVmFromNetwork (VirtualMachine vm , Network network ) throws ConcurrentOperationException , ResourceUnavailableException {
@@ -2506,8 +2515,7 @@ public boolean removeVmFromNetwork(VirtualMachine vm, Network network) throws Co
25062515 HypervisorGuru hvGuru = _hvGuruMgr .getGuru (vmProfile .getVirtualMachine ().getHypervisorType ());
25072516 VirtualMachineTO vmTO = hvGuru .implement (vmProfile );
25082517
2509- //3) Convert nicProfile to NicTO
2510- NicTO nicTO = hvGuru .toNicTO (nic );
2518+ NicTO nicTO = toNicTO (nic , vmProfile .getVirtualMachine ().getHypervisorType ());
25112519
25122520 boolean result = vmGuru .unplugNic (network , nicTO , vmTO , context , dest );
25132521 //4) Unplug the nic
0 commit comments