After the scheduler is started or restarted, the scheduler stats API will return an empty list of stats, despite the fact that many volume services are running and many volumes have been created in the past. Creating a new volume triggers the stats to be available.
Steps to reproduce:
1. Restart the scheduler, and wait for messages about "Received volume service update" to appear. This ensures that the scheduler has received volume stats from the volume service(s)
2. curl -s -H "X-Auth-Token: $OS_TOKEN" $CINDER_URL/scheduler-stats/get_pools
will return {"pools": []}.
3. Create a volume: cinder create 1
4. curl -s -H "X-Auth-Token: $OS_TOKEN" $CINDER_URL/scheduler-stats/get_pools now returns a structure with all of the backends listed: {"pools": [{"name": "host@backend#pool"}, {"name": "host@backend2#pool2"}, {"name": "host@backend3#poole"}]}
The problem is in host_manager.py: The HostState.get_pools function is driven off of a dictionary, host_state_map, that is created as a side-effect to the call to get_all_host_states, which is only called by the FilterSchduler at volume creation time.
Fix proposed to branch: master /review. openstack. org/142361
Review: https:/