'Deletes a volume on the Storage machine.'

@proxy._trace_time
def delete_volume(self, volume):

    LOG.debug('delete_volume:    %(volume)s', {'volume': volume['name']})
    specs = self._get_extra_specs(volume.get('volume_type_id', None))
    replication_info = self._get_replication_info(specs)
    if replication_info['enabled']:
        try:
            repl.VolumeReplication(self).delete_replication(volume.name, replication_info)
        except Exception as e:
            error = self._get_code_and_status_or_message(e)
            LOG.error(DELETE_VOLUME_BASE_ERROR, {'volume': volume['name'], 'error': error})
        target = None
        try:
            (target, params) = self._get_replication_target_params()
            LOG.info('Target    %(target)s:    %(params)s', {'target': target, 'params': params})
        except Exception as e:
            LOG.error("Unable    to    delete    replicated    volume    '%(volume)s':    %(error)s.", {'error': self._get_code_and_status_or_message(e), 'volume': volume['name']})
        if target:
            try:
                self._call_remote_xiv_xcli('vol_delete', vol=volume['name'])
            except errors.XCLIError as e:
                LOG.error("Unable    to    delete    replicated    volume    '%(volume)s':    %(error)s.", {'error': self._get_code_and_status_or_message(e), 'volume': volume['name']})
    try:
        self._delete_volume(volume['name'])
    except errors.XCLIError as e:
        LOG.error(DELETE_VOLUME_BASE_ERROR, {'volume': volume['name'], 'error': self._get_code_and_status_or_message(e)})
