@Override public void execute() { try { boolean result = _vpcService.deleteVpc(getId()); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete VPC"); } } catch (ResourceUnavailableException ex) { s_logger.warn("Exception: ", ex); throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); } catch (ConcurrentOperationException ex) { s_logger.warn("Exception: ", ex); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage()); } }
@Override public void deleteCopyOfVpc(long vpcCopyId, long originalVpcId) { VpcVO copyOfvpc = _vpcDao.findById(vpcCopyId); VpcVO originalVpc = _vpcDao.findById(originalVpcId); //Be sure that when we delete the vpc, it has the uuid with what it was created. swapUuids(copyOfvpc, originalVpc); try { if(!_vpcService.deleteVpc(vpcCopyId)) { throw new CloudRuntimeException("Deletion of VPC failed. Clean up was not successful."); } } catch (ResourceUnavailableException e) { throw new CloudRuntimeException(e.getMessage()); } finally { swapUuids(originalVpc, copyOfvpc); } _resourceTagDao.removeByResourceIdAndKey(originalVpcId, ResourceTag.ResourceObjectType.Vpc, MIGRATION); }
@Override public void execute() { try { final boolean result = _vpcService.deleteVpc(getId()); if (result) { final SuccessResponse response = new SuccessResponse(getCommandName()); setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete VPC"); } } catch (final ResourceUnavailableException ex) { s_logger.warn("Exception: ", ex); throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); } catch (final ConcurrentOperationException ex) { s_logger.warn("Exception: ", ex); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage()); } }