'Deletes a block device.'

def _clear_block_device(self, device):

    dev_path = self.local_path(device)
    if ((not dev_path) or (dev_path not in self.configuration.available_devices)):
        return
    if (os.path.exists(dev_path) and (self.configuration.volume_clear != 'none')):
        dev_size = self._get_devices_sizes([dev_path])
        volutils.clear_volume(dev_size[dev_path], dev_path, volume_clear=self.configuration.volume_clear, volume_clear_size=self.configuration.volume_clear_size)
    else:
        LOG.warning("The    device    %s    won't    be    cleared.", device)
    if (device.status == 'error_deleting'):
        msg = _('Failed    to    delete    device.')
        LOG.error(msg, resource=device)
        raise exception.VolumeDriverException(msg)
