GutoVeronezi commented on code in PR #8649:
URL: https://github.com/apache/cloudstack/pull/8649#discussion_r1729249659


##########
server/src/main/java/com/cloud/storage/StorageManagerImpl.java:
##########
@@ -1514,6 +1515,25 @@ private boolean deleteDataStoreInternal(StoragePoolVO 
sPool, boolean forced) {
         return lifeCycle.deleteDataStore(store);
     }
 
+    protected String getStoragePoolNonDestroyedVolumesLog(long storagePoolId) {
+        StringBuilder sb = new StringBuilder();
+        List<VolumeVO> nonDestroyedVols = 
volumeDao.findByPoolId(storagePoolId, null).stream().filter(vol -> 
vol.getState() != Volume.State.Destroy).collect(Collectors.toList());
+        VMInstanceVO volInstance;
+
+        sb.append("[");
+        for (int i = 0; i < nonDestroyedVols.size()-1; i++) {
+            VolumeVO vol = nonDestroyedVols.get(i);
+            volInstance = _vmInstanceDao.findById(vol.getInstanceId());
+            sb.append(String.format("Volume [%s] (attached to VM [%s]), ", 
vol.getUuid(), volInstance.getUuid()));
+        }
+        VolumeVO lastVol = nonDestroyedVols.get(nonDestroyedVols.size()-1);
+        volInstance = _vmInstanceDao.findById(lastVol.getInstanceId());
+        sb.append(String.format("Volume [%s] (attached to VM [%s])", 
lastVol.getUuid(), volInstance.getUuid()));

Review Comment:
   ```suggestion
           for (VolumeVO vol : nonDestroyedVols) {
               volInstance = _vmInstanceDao.findById(vol.getInstanceId());
               sb.append(String.format("Volume [%s] (attached to VM [%s]), ", 
vol.getUuid(), volInstance.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]

Reply via email to