csquire commented on code in PR #6879:
URL: https://github.com/apache/cloudstack/pull/6879#discussion_r1018246126


##########
server/src/main/java/com/cloud/tags/TaggedResourceManagerImpl.java:
##########
@@ -318,7 +318,11 @@ public Map<String, String> 
getTagsFromResource(ResourceObjectType type, long res
     private void informStoragePoolForVmTags(long vmId, String key, String 
value) {
         List<VolumeVO> volumeVos = volumeDao.findByInstance(vmId);
         for (VolumeVO volume : volumeVos) {
-            DataStore dataStore = 
dataStoreMgr.getDataStore(volume.getPoolId(), DataStoreRole.Primary);
+            Long poolId = volume.getPoolId();
+            if (poolId == null) {
+                continue;
+            }
+            DataStore dataStore = dataStoreMgr.getDataStore(poolId, 
DataStoreRole.Primary);
             if (dataStore == null || !(dataStore.getDriver() instanceof 
PrimaryDataStoreDriver)) {
                 continue;
             }

Review Comment:
   Hi Daan, I extracted it. I'm not sure I follow what the goal is with the 
throwing. It would still require a null check after the catch and another 
`continue`.



-- 
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