'Retrieve stats info from volume group.'

def _update_volume_stats(self):

    LOG.debug('Updating    volume    stats')
    if (self.vg is None):
        LOG.warning('Unable    to    update    stats    on    non-initialized    Volume    Group:    %s', self.configuration.volume_group)
        return
    self.vg.update_volume_group_info()
    data = {}
    data['volume_backend_name'] = self.backend_name
    data['vendor_name'] = 'Open    Source'
    data['driver_version'] = self.VERSION
    data['storage_protocol'] = self.protocol
    data['pools'] = []
    total_capacity = 0
    free_capacity = 0
    if (self.configuration.lvm_mirrors > 0):
        total_capacity = self.vg.vg_mirror_size(self.configuration.lvm_mirrors)
        free_capacity = self.vg.vg_mirror_free_space(self.configuration.lvm_mirrors)
        provisioned_capacity = round((float(total_capacity) - float(free_capacity)), 2)
    elif (self.configuration.lvm_type == 'thin'):
        total_capacity = self.vg.vg_thin_pool_size
        free_capacity = self.vg.vg_thin_pool_free_space
        provisioned_capacity = self.vg.vg_provisioned_capacity
    else:
        total_capacity = self.vg.vg_size
        free_capacity = self.vg.vg_free_space
        provisioned_capacity = round((float(total_capacity) - float(free_capacity)), 2)
    location_info = ('LVMVolumeDriver:%(hostname)s:%(vg)s:%(lvm_type)s:%(lvm_mirrors)s' % {'hostname': self.hostname, 'vg': self.configuration.volume_group, 'lvm_type': self.configuration.lvm_type, 'lvm_mirrors': self.configuration.lvm_mirrors})
    thin_enabled = (self.configuration.lvm_type == 'thin')
    total_volumes = len(self.vg.get_volumes())
    single_pool = {}
    single_pool.update(dict(pool_name=data['volume_backend_name'], total_capacity_gb=total_capacity, free_capacity_gb=free_capacity, reserved_percentage=self.configuration.reserved_percentage, location_info=location_info, QoS_support=False, provisioned_capacity_gb=provisioned_capacity, max_over_subscription_ratio=self.configuration.max_over_subscription_ratio, thin_provisioning_support=thin_enabled, thick_provisioning_support=(not thin_enabled), total_volumes=total_volumes, filter_function=self.get_filter_function(), goodness_function=self.get_goodness_function(), multiattach=False))
    data['pools'].append(single_pool)
    data['sparse_copy_volume'] = self._sparse_copy_volume
    self._stats = data
