'Update storage pools information from backend reported info.'

def update_pools(self, capability, service):

    if (not capability):
        return
    pools = capability.get('pools', None)
    active_pools = set()
    if (pools and isinstance(pools, list)):
        for pool_cap in pools:
            pool_name = pool_cap['pool_name']
            self._append_backend_info(pool_cap)
            cur_pool = self.pools.get(pool_name, None)
            if (not cur_pool):
                cur_pool = PoolState(self.host, self.cluster_name, pool_cap, pool_name)
                self.pools[pool_name] = cur_pool
            cur_pool.update_from_volume_capability(pool_cap, service)
            active_pools.add(pool_name)
    elif (pools is None):
        pool_name = self.volume_backend_name
        if (pool_name is None):
            pool_name = vol_utils.extract_host(self.host, 'pool', True)
        if (len(self.pools) == 0):
            single_pool = PoolState(self.host, self.cluster_name, capability, pool_name)
            self._append_backend_info(capability)
            self.pools[pool_name] = single_pool
        else:
            try:
                single_pool = self.pools[pool_name]
            except KeyError:
                single_pool = PoolState(self.host, self.cluster_name, capability, pool_name)
                self._append_backend_info(capability)
                self.pools[pool_name] = single_pool
        single_pool.update_from_volume_capability(capability, service)
        active_pools.add(pool_name)
    nonactive_pools = (set(self.pools.keys()) - active_pools)
    for pool in nonactive_pools:
        LOG.debug('Removing    non-active    pool    %(pool)s    @    %(host)s    from    scheduler    cache.', {'pool': pool, 'host': self.host})
        del self.pools[pool]
