@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); }