Fixed deleteZone API - used to return empty response instead of success=true/false

This commit is contained in:
alena 2010-11-03 11:32:45 -07:00
parent 8c0e2fa7ec
commit 15a316484e
2 changed files with 18 additions and 7 deletions

View File

@ -232,7 +232,7 @@ public interface ConfigurationManager extends Manager {
* @param userId
* @param zoneId
*/
void deleteZone(DeleteZoneCmd cmd);
boolean deleteZone(DeleteZoneCmd cmd);
/**
* Associates an ip address list to an account. The list of ip addresses are all addresses associated with the given vlan id.

View File

@ -785,7 +785,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager {
@Override
@DB
public void deleteZone(DeleteZoneCmd cmd) {
public boolean deleteZone(DeleteZoneCmd cmd) {
Long userId = UserContext.current().getUserId();
Long zoneId = cmd.getId();
@ -803,12 +803,23 @@ public class ConfigurationManagerImpl implements ConfigurationManager {
DataCenterVO zone = _zoneDao.findById(zoneId);
_zoneDao.expunge(zoneId);
boolean success = _zoneDao.expunge(zoneId);
// Delete vNet
_zoneDao.deleteVnet(zoneId);
saveConfigurationEvent(userId, null, EventTypes.EVENT_ZONE_DELETE, "Successfully deleted zone with name: " + zone.getName() + ".", "dcId=" + zoneId);
try {
// Delete vNet
_zoneDao.deleteVnet(zoneId);
} catch (Exception ex) {
s_logger.error("Failed to delete zone " + zoneId);
throw new CloudRuntimeException("Failed to delete zone " + zoneId);
}
if (success){
saveConfigurationEvent(userId, null, EventTypes.EVENT_ZONE_DELETE, "Successfully deleted zone with name: " + zone.getName() + ".", "dcId=" + zoneId);
return true;
} else{
return false;
}
}
@Override