mirror of https://github.com/apache/cloudstack.git
bug 8188: removing service and disk offerings associated with a domain, when we delete a domain
status 8188: resolved fixed
This commit is contained in:
parent
28bbba3cea
commit
fc5ec096f5
|
|
@ -329,6 +329,10 @@ public class ApiDBUtils {
|
|||
public static DomainVO findDomainById(Long domainId) {
|
||||
return _domainDao.findById(domainId);
|
||||
}
|
||||
|
||||
public static DomainVO findDomainByIdIncludingRemoved(Long domainId) {
|
||||
return _domainDao.findByIdIncludingRemoved(domainId);
|
||||
}
|
||||
|
||||
public static DomainRouterVO findDomainRouterById(Long routerId) {
|
||||
return _domainRouterDao.findById(routerId);
|
||||
|
|
|
|||
|
|
@ -2981,6 +2981,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||
} else {
|
||||
throw new InvalidParameterValueException("Failed to delete domain nable " + domainId + ", domain not found");
|
||||
}
|
||||
cleanupDomainOfferings(domainId);
|
||||
return true;
|
||||
} catch (InvalidParameterValueException ex) {
|
||||
throw ex;
|
||||
|
|
@ -2990,6 +2991,19 @@ public class ManagementServerImpl implements ManagementServer {
|
|||
}
|
||||
}
|
||||
|
||||
private void cleanupDomainOfferings(Long domainId) {
|
||||
//delete the service and disk offerings associated with this domain
|
||||
List<DiskOfferingVO> diskOfferingsForThisDomain = _diskOfferingDao.listByDomainId(domainId);
|
||||
for(DiskOfferingVO diskOffering : diskOfferingsForThisDomain) {
|
||||
_diskOfferingDao.remove(diskOffering.getId());
|
||||
}
|
||||
|
||||
List<ServiceOfferingVO> serviceOfferingsForThisDomain = _offeringsDao.findServiceOfferingByDomainId(domainId);
|
||||
for(ServiceOfferingVO serviceOffering : serviceOfferingsForThisDomain) {
|
||||
_offeringsDao.remove(serviceOffering.getId());
|
||||
}
|
||||
}
|
||||
|
||||
private boolean cleanupDomain(Long domainId, Long ownerId) throws ConcurrentOperationException, ResourceUnavailableException{
|
||||
boolean success = true;
|
||||
{
|
||||
|
|
@ -3012,7 +3026,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||
success = (success && _accountMgr.cleanupAccount(account, UserContext.current().getCallerUserId(), UserContext.current().getCaller()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// delete the domain itself
|
||||
boolean deleteDomainSuccess = _domainDao.remove(domainId);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue