'Deletes a volume.'

@utils.trace_method
def delete_volume(self, volume):

    LOG.debug('Delete    volume    with    id    %s', volume['id'])
    if (not volume['provider_location']):
        LOG.warning('Volume    %s    does    not    have    provider_location    specified', volume['name'])
        raise exception.VolumeMetadataNotFound(volume_id=volume['id'], metadata_key='provider_location')
    message_body = {'display_name': volume['name']}
    rt_key = None
    metadata = self._get_volume_metadata(volume)
    rt_key = self._get_volume_metadata_value(metadata, 'Secondary_datanode_key')
    rt_dn_ip = self._get_volume_metadata_value(metadata, 'Secondary_datanode_ip')
    current_dn_ip = self._get_volume_metadata_value(metadata, 'current_dn_ip')
    if ((current_dn_ip is not None) and (rt_dn_ip == current_dn_ip)):
        rt_key = None
    try:
        if (rt_key is not None):
            util.message_data_plane(rt_key, 'hyperscale.storage.dm.volume.delete', **message_body)
        util.message_data_plane(self.dn_routing_key, 'hyperscale.storage.dm.volume.delete', **message_body)
    except (exception.UnableToProcessHyperScaleCmdOutput, exception.ErrorInSendingMsg):
        LOG.error('Exception    while    deleting    volume', exc_info=True)
        raise exception.VolumeIsBusy(volume_name=volume['name'])
