JoaoJandre commented on code in PR #9546: URL: https://github.com/apache/cloudstack/pull/9546#discussion_r1881921059
########## server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java: ########## @@ -4367,8 +4368,11 @@ public boolean deleteDiskOffering(final DeleteDiskOfferingCmd cmd) { } annotationDao.removeByEntityType(AnnotationService.EntityType.DISK_OFFERING.name(), offering.getUuid()); - offering.setState(DiskOffering.State.Inactive); - if (_diskOfferingDao.update(offering.getId(), offering)) { + List<VolumeVO> volumesUsingOffering = _volumeDao.findByDiskOfferingId(diskOfferingId); + if (!volumesUsingOffering.isEmpty()) { + throw new InvalidParameterValueException(String.format("Unable to delete disk offering: %s [%s] because there are volumes using it", offering.getUuid(), offering.getName())); + } Review Comment: How is this related to the main change? Why should we start blocking this now? ########## server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java: ########## @@ -4440,15 +4444,17 @@ public boolean deleteServiceOffering(final DeleteServiceOfferingCmd cmd) { throw new InvalidParameterValueException(String.format("Unable to delete service offering: %s by user: %s because it is not root-admin or domain-admin", offering.getUuid(), user.getUuid())); } + List<VMInstanceVO> vmsUsingOffering = _vmInstanceDao.listByOfferingId(offeringId); + if (!vmsUsingOffering.isEmpty()) { + throw new CloudRuntimeException(String.format("Unable to delete service offering %s as it is in use", offering.getUuid())); + } Review Comment: How is this related to the main change? Why should we start blocking this now? -- 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-unsubscr...@cloudstack.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org