You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2022/04/22 22:34:49 UTC

[GitHub] [cloudstack] GutoVeronezi commented on a diff in pull request #6269: Improve error message on storage tags update

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


##########
engine/schema/src/main/java/com/cloud/storage/dao/VolumeDao.java:
##########
@@ -131,4 +131,12 @@ public interface VolumeDao extends GenericDao<VolumeVO, Long>, StateDao<Volume.S
      *  Updates the disk offering for the given volume.
      */
     void updateDiskOffering(long volumeId, long diskOfferingId);
+
+    /**
+     *  Get volumes by the disk offering ID.

Review Comment:
   ```suggestion
        *  Gets volumes by the disk offering ID.
   ```



##########
server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java:
##########
@@ -3801,7 +3803,15 @@ protected void updateOfferingTagsIfIsNotNull(String tags, DiskOfferingVO diskOff
                 for (StoragePoolVO storagePoolVO : pools) {
                     List<String> tagsOnPool = storagePoolTagDao.getStoragePoolTags(storagePoolVO.getId());
                     if (CollectionUtils.isEmpty(tagsOnPool) || !tagsOnPool.containsAll(listOfTags)) {
-                        throw new InvalidParameterValueException(String.format("There are active volumes using offering [%s], and the pools [%s] don't have the new tags", diskOffering.getId(), pools));
+                                                String offeringUuid = _diskOfferingDao.findById(diskOffering.getId()).getUuid();
+                        List<VolumeVO> volumes = _volumeDao.findByDiskOfferingId(diskOffering.getId());
+                        List<String> listOfVolumesNamesAndUuid = new ArrayList<>();
+                        for (VolumeVO volumeVO : volumes) {
+                            listOfVolumesNamesAndUuid.add(String.format("Name: %s, UUID: %s",volumeVO.getName(), volumeVO.getUuid()));
+                        }
+                        throw new InvalidParameterValueException(String.format("There are active volumes using the disk offering [Name: %s, UUID: %s], and the pool [Name: %s, UUID: %s] doesn't have the new tags. " +

Review Comment:
   We can use `ReflectionToStringBuilderUtils` here.



-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org