vishesh92 commented on code in PR #13354:
URL: https://github.com/apache/cloudstack/pull/13354#discussion_r4267280583


##########
engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java:
##########
@@ -2266,8 +2279,13 @@ public void prepareNicForMigration(final 
VirtualMachineProfile vm, final DeployD
         }
         final List<NicVO> nics = _nicDao.listByVmId(vm.getId());
         final ReservationContext context = new 
ReservationContextImpl(UUID.randomUUID().toString(), null, null);
+        final Map<Long, NetworkVO> networksById = 
batchLoadNetworksForNics(nics);
         for (final NicVO nic : nics) {
-            final NetworkVO network = 
_networksDao.findById(nic.getNetworkId());
+            final NetworkVO network = networksById.get(nic.getNetworkId());
+            if (network == null) {

Review Comment:
   just an additional check. this will only fail when the network itself is 
deleted even from the db but somehow nic is left over. this shouldn't even 
occur at all.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to