csquire opened a new issue, #6878:
URL: https://github.com/apache/cloudstack/issues/6878

   
   
   ##### ISSUE TYPE
    * Bug Report
   
   
   ##### COMPONENT NAME
   API
   ~~~
   
   ~~~
   
   ##### CLOUDSTACK VERSION
   4.17.1.0
   
   ~~~
   
   ~~~
   
   ##### CONFIGURATION
   N/A
   
   
   ##### OS / ENVIRONMENT
   N/A
   
   
   ##### SUMMARY
   When attempting to tag a VM, we're getting a NullPointerException in 
`TaggedResourceManagerImpl`. This NPE is happening in 
`informStoragePoolForVmTags` when the volume does not have a Pool ID associated 
with it. This issue is blocking our upgrade to 4.17.1.0.
   
   ```
   2022-10-27 13:51:55,695 ERROR [c.c.a.ApiServer] 
(qtp1026055550-5193:ctx-3abf03c9 ctx-b53aa077 ctx-cca24aa6) (logid:847d7482) 
unhandled exception executing api command: [Ljava.lang.String;@7e515dd1
   java.lang.NullPointerException
        at 
com.cloud.tags.TaggedResourceManagerImpl.informStoragePoolForVmTags(TaggedResourceManagerImpl.java:321)
        at 
com.cloud.tags.TaggedResourceManagerImpl$1.doInTransactionWithoutResult(TaggedResourceManagerImpl.java:225)
   ```
   
   The issue appears to be that `volume.getPoolId()` returns a `Long` with a 
null value and `dataStoreMgr.getDataStore(long storeId, DataStoreRole role)` 
accepts a `long` (which cannot be null)
   
   
https://github.com/apache/cloudstack/blob/main/server/src/main/java/com/cloud/tags/TaggedResourceManagerImpl.java#L321
   
   Adding a null check for `volume.getPoolId()` before calling 
`dataStoreMgr.getDataStore()` should take care of it.
   
   
   ##### STEPS TO REPRODUCE
   Tag a VM with a volume which does not have a pool id.
   
   <!-- Paste example playbooks or commands between quotes below -->
   ~~~
   
   ~~~
   
   <!-- You can also paste gist.github.com links for larger files -->
   
   ##### EXPECTED RESULTS
   VM is tagged
   
   ~~~
   
   ~~~
   
   ##### ACTUAL RESULTS
   NPE when tagging
   
   <!-- Paste verbatim command output between quotes below -->
   ~~~
   
   ~~~
   


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