'Volume in K2 exists in a volume group.
- delete the volume
- delete the corresponding volume group'

@kaminario_logger
def delete_volume(self, volume):

    vg_name = self.get_volume_group_name(volume.id)
    vol_name = self.get_volume_name(volume.id)
    try:
        if (self._get_is_replica(volume.volume_type) and self.replica):
            self._delete_volume_replica(volume, vg_name, vol_name)
        LOG.debug('Searching    and    deleting    volume:    %s    in    K2.', vol_name)
        vol_rs = self.client.search('volumes', name=vol_name)
        if (vol_rs.total != 0):
            vol_rs.hits[0].delete()
        LOG.debug('Searching    and    deleting    vg:    %s    in    K2.', vg_name)
        vg_rs = self.client.search('volume_groups', name=vg_name)
        if (vg_rs.total != 0):
            vg_rs.hits[0].delete()
    except Exception as ex:
        LOG.exception('Deletion    of    volume    %s    failed.', vol_name)
        raise exception.KaminarioCinderDriverException(reason=ex)
