]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commit
Don't clear host_state_map when scheduling
authorZhiteng Huang <zhithuang@ebaysf.com>
Thu, 27 Feb 2014 01:58:17 +0000 (09:58 +0800)
committerZhiteng Huang <zhithuang@ebaysf.com>
Thu, 27 Feb 2014 02:25:05 +0000 (10:25 +0800)
commitbe340fbd74e0778e04c6e96210947cdb9379fdef
treef6f34f8312034d6d6a86663d007855cd3ce42a9d
parentcefca3957dc28742322d6079e7fb704e32fae7d9
Don't clear host_state_map when scheduling

host_state_map was added to scheduler for the purpose of caching latest
host_state in memory for scheduler.  With this cache, scheduler has the
latest host_state (e.g. free_capacity, allocated_capacity, etc) of hosts
even hosts haven't reported their updated status to scheduler.

Unfortunately, this cache is flushed when scheduling pulling all available
volume services from DB in current implementation, which is a bug.

This change remove the host_state_map.clear() so that scheduler is able to
maintain an up-to-date (well, mostly) view of all volume services in memory.
Also, added code to remove non-active host from the cache every time when
scheduler handles a new request.  Multi-line docstrings in cinder/scheduler/
host_manager.py are also fixed.

Change-Id: Ib47be483fa26631a1483721e2ae6d972994e150f
Fixes-bug: 1271162
cinder/scheduler/host_manager.py