mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	Applied patch https://reviews.apache.org/r/5522/diff/
This commit is contained in:
		
							parent
							
								
									1a6102be1e
								
							
						
					
					
						commit
						66e14e2627
					
				| @ -228,22 +228,24 @@ public class DomainManagerImpl implements DomainManager, DomainService, Manager | |||||||
|             long ownerId = domain.getAccountId(); |             long ownerId = domain.getAccountId(); | ||||||
|             if ((cleanup != null) && cleanup.booleanValue()) { |             if ((cleanup != null) && cleanup.booleanValue()) { | ||||||
|                 if (!cleanupDomain(domain.getId(), ownerId)) { |                 if (!cleanupDomain(domain.getId(), ownerId)) { | ||||||
|                     s_logger.error("Failed to clean up domain resources and sub domains, delete failed on domain " + domain.getName() + " (id: " + domain.getId() + ")."); |                     CloudRuntimeException e = new CloudRuntimeException("Failed to clean up domain resources and sub domains, delete failed on domain " + domain.getName() + " (id: " + domain.getId() + ")."); | ||||||
|                     return false; |                     e.addProxyObject(domain, domain.getId(), "domainId"); | ||||||
|  |                     throw e; | ||||||
|                 } |                 } | ||||||
|             } else { |             } else { | ||||||
|                 List<AccountVO> accountsForCleanup = _accountDao.findCleanupsForRemovedAccounts(domain.getId()); |                 List<AccountVO> accountsForCleanup = _accountDao.findCleanupsForRemovedAccounts(domain.getId()); | ||||||
|                 if (accountsForCleanup.isEmpty()) { |                 if (accountsForCleanup.isEmpty()) { | ||||||
|                     if (!_domainDao.remove(domain.getId())) { |                     if (!_domainDao.remove(domain.getId())) { | ||||||
|                         s_logger.error("Delete failed on domain " + domain.getName() + " (id: " + domain.getId() |  | ||||||
|                                 + "); please make sure all users and sub domains have been removed from the domain before deleting"); |  | ||||||
|                         rollBackState = true; |                         rollBackState = true; | ||||||
|                         return false; |                         CloudRuntimeException e = new CloudRuntimeException("Delete failed on domain " + domain.getName() + " (id: " + domain.getId() + "); Please make sure all users and sub domains have been removed from the domain before deleting"); | ||||||
|  |                         e.addProxyObject(domain, domain.getId(), "domainId"); | ||||||
|  |                         throw e; | ||||||
|                     } |                     } | ||||||
|                 } else { |                 } else { | ||||||
|                     s_logger.warn("Can't delete the domain yet because it has " + accountsForCleanup.size() + "accounts that need a cleanup"); |  | ||||||
|                     rollBackState = true; |                     rollBackState = true; | ||||||
|                     return false; |                     CloudRuntimeException e = new CloudRuntimeException("Can't delete the domain yet because it has " + accountsForCleanup.size() + "accounts that need a cleanup"); | ||||||
|  |                     e.addProxyObject(domain, domain.getId(), "domainId"); | ||||||
|  |                     throw e; | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
| @ -251,6 +253,9 @@ public class DomainManagerImpl implements DomainManager, DomainService, Manager | |||||||
|             return true; |             return true; | ||||||
|         } catch (Exception ex) { |         } catch (Exception ex) { | ||||||
|             s_logger.error("Exception deleting domain with id " + domain.getId(), ex); |             s_logger.error("Exception deleting domain with id " + domain.getId(), ex); | ||||||
|  |             if (ex instanceof CloudRuntimeException) | ||||||
|  |                 throw (CloudRuntimeException)ex; | ||||||
|  |             else | ||||||
|                 return false; |                 return false; | ||||||
|         } finally { |         } finally { | ||||||
|             //when success is false |             //when success is false | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user