abh1sar commented on code in PR #12451:
URL: https://github.com/apache/cloudstack/pull/12451#discussion_r2703669346
##########
server/src/main/java/com/cloud/storage/StorageManagerImpl.java:
##########
@@ -1564,8 +1564,12 @@ protected String
getStoragePoolNonDestroyedVolumesLog(long storagePoolId) {
sb.append("[");
for (VolumeVO vol : nonDestroyedVols) {
- volInstance = _vmInstanceDao.findById(vol.getInstanceId());
- logMessageInfo.add(String.format("Volume [%s] (attached to VM
[%s])", vol.getUuid(), volInstance.getUuid()));
+ if (vol.getInstanceId() != null) {
+ volInstance = _vmInstanceDao.findById(vol.getInstanceId());
+ if (volInstance != null) {
+ logMessageInfo.add(String.format("Volume [%s] (attached to
VM [%s])", vol.getUuid(), volInstance.getUuid()));
+ }
+ }
Review Comment:
I think we should log detached volumes also is that all non-destroyed
volumes are logged in the caller
```
logger.debug("Cannot delete storage pool {} as the following non-destroyed
volumes are on it: {}.", sPool::toString, () ->
getStoragePoolNonDestroyedVolumesLog(sPool.getId()));
```
Something like
`logMessageInfo.add(String.format("Volume [%s] (not attached to any VM)",
vol.getUuid());`
--
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]