'Retrieve stats info.'

@retry_wrapper
def update_volume_stats(self):

    LOG.debug('Updating    volume    stats')
    self.authenticate_user()
    try:
        self.stats['consistencygroup_support'] = True
        self.stats['consistent_group_snapshot_enabled'] = True
        vols = self.volume_obj.list_volumes(((self.configuration.coprhd_tenant + '/') + self.configuration.coprhd_project))
        vpairs = set()
        if (len(vols) > 0):
            for vol in vols:
                if vol:
                    vpair = (vol['vpool']['id'], vol['varray']['id'])
                    if (vpair not in vpairs):
                        vpairs.add(vpair)
        if (len(vpairs) > 0):
            free_gb = 0.0
            used_gb = 0.0
            for vpair in vpairs:
                if vpair:
                    (s, h) = coprhd_utils.service_json_request(self.configuration.coprhd_hostname, self.configuration.coprhd_port, 'GET', URI_VPOOL_VARRAY_CAPACITY.format(vpair[0], vpair[1]), body=None)
                    capacity = coprhd_utils.json_decode(s)
                    free_gb += float(capacity['free_gb'])
                    used_gb += float(capacity['used_gb'])
            self.stats['free_capacity_gb'] = free_gb
            self.stats['total_capacity_gb'] = (free_gb + used_gb)
            self.stats['reserved_percentage'] = self.configuration.reserved_percentage
        return self.stats
    except coprhd_utils.CoprHdError:
        with excutils.save_and_reraise_exception():
            LOG.exception('Update    volume    stats    failed')
