shwstppr commented on code in PR #11780:
URL: https://github.com/apache/cloudstack/pull/11780#discussion_r2400920619
##########
server/src/main/java/com/cloud/user/DomainManagerImpl.java:
##########
@@ -573,7 +580,8 @@ private void removeServiceOfferings(Long domainId, String
domainIdString) {
List<Long> serviceOfferingsDetailsToRemove = new ArrayList<>();
List<ServiceOfferingJoinVO> serviceOfferingsForThisDomain =
serviceOfferingJoinDao.findByDomainId(domainId);
for (ServiceOfferingJoinVO serviceOffering :
serviceOfferingsForThisDomain) {
- if (domainIdString.equals(serviceOffering.getDomainId())) {
+ List<UserVmJoinVO> userVms =
userVmJoinDao.listByServiceOfferingId(serviceOffering.getId());
Review Comment:
better to use vmInstanceDao and only get count. UserVmJoin will be more
expensive and we don't need any details from it, just the count of VMs
##########
server/src/main/java/com/cloud/user/DomainManagerImpl.java:
##########
@@ -588,7 +596,8 @@ private void removeDiskOfferings(Long domainId, String
domainIdString) {
List<Long> diskOfferingsDetailsToRemove = new ArrayList<>();
List<DiskOfferingJoinVO> diskOfferingsForThisDomain =
diskOfferingJoinDao.findByDomainId(domainId);
for (DiskOfferingJoinVO diskOffering : diskOfferingsForThisDomain) {
- if (domainIdString.equals(diskOffering.getDomainId())) {
+ List<UserVmJoinVO> userVms =
userVmJoinDao.listByDiskOfferingId(diskOffering.getId());
Review Comment:
find current volumes count using the disk offering
##########
server/src/main/java/com/cloud/user/DomainManagerImpl.java:
##########
@@ -558,7 +564,8 @@ private void removeNetworkOfferings(Long domainId, String
domainIdString) {
List<Long> networkOfferingsDetailsToRemove = new ArrayList<>();
List<NetworkOfferingJoinVO> networkOfferingsForThisDomain =
networkOfferingJoinDao.findByDomainId(domainId, false);
for (NetworkOfferingJoinVO networkOffering :
networkOfferingsForThisDomain) {
- if (domainIdString.equals(networkOffering.getDomainId())) {
+ List<UserVmJoinVO> userVms =
userVmJoinDao.listByNetworkOfferingId(networkOffering.getId());
Review Comment:
instead checking VMs, should check if there is a network using offering
##########
server/src/main/java/com/cloud/user/DomainManagerImpl.java:
##########
@@ -543,7 +548,8 @@ private void removeVpcOfferings(Long domainId, String
domainIdString) {
List<Long> vpcOfferingsDetailsToRemove = new ArrayList<>();
List<VpcOfferingJoinVO> vpcOfferingsForThisDomain =
vpcOfferingJoinDao.findByDomainId(domainId);
for (VpcOfferingJoinVO vpcOffering : vpcOfferingsForThisDomain) {
- if (domainIdString.equals(vpcOffering.getDomainId())) {
+ List<UserVmJoinVO> userVms =
userVmJoinDao.listByVpcOfferingId(vpcOffering.getId());
Review Comment:
instead checking VMs, should check if there is a VPC
--
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]