def _clean_temporary_volume(self, ctxt, volume, new_volume, clean_db_only=False):
    if (volume.migration_status == 'migrating'):
        try:
            if clean_db_only:
                new_volume.destroy()
            else:
                rpcapi = volume_rpcapi.VolumeAPI()
                rpcapi.delete_volume(ctxt, new_volume)
        except exception.VolumeNotFound:
            LOG.info(_LI("Couldn't find the temporary volume %(vol)s in the database. There is no need to clean up this volume."), {'vol': new_volume.id})
    else:
        try:
            new_volume.migration_status = None
            new_volume.save()
        except exception.VolumeNotFound:
            LOG.info(_LI("Couldn't find destination volume %(vol)s in the database. The entry might be successfully deleted during migration completion phase."), {'vol': new_volume.id})
            LOG.warning(_LW('Failed to migrate volume. The destination volume %(vol)s is not deleted since the source volume may have been deleted.'), {'vol': new_volume.id})
def _clean_temporary_volume(self, ctxt, volume, new_volume, clean_db_only=False):
    if (volume.migration_status == 'migrating'):
        try:
            if clean_db_only:
                new_volume.destroy()
            else:
                rpcapi = volume_rpcapi.VolumeAPI()
                rpcapi.delete_volume(ctxt, new_volume)
        except exception.VolumeNotFound:
            LOG.info(_LI("Couldn't find the temporary volume %(vol)s in the database. There is no need to clean up this volume."), {'vol': new_volume.id})
    else:
        try:
            new_volume.migration_status = None
            new_volume.save()
        except exception.VolumeNotFound:
            LOG.info(_LI("Couldn't find destination volume %(vol)s in the database. The entry might be successfully deleted during migration completion phase."), {'vol': new_volume.id})
            LOG.warning(_LW('Failed to migrate volume. The destination volume %(vol)s is not deleted since the source volume may have been deleted.'), {'vol': new_volume.id})