commit 4e3dd818a3e23c942bb2d475c6fc2138518276fc
Author: Dan Smith <email address hidden>
Date: Thu May 17 07:28:59 2018 -0700
Fix interpretation of max_attempts for scheduling alternates
Since max_attempts is not max_retries, we should look for max_attempts-1
alternate hosts. This change makes the num_alts variable actually reflect
the number of alternates we are looking for, and doesn't actually change
the logic at all. This also adds functional tests to verify max_attempts
behavior with 1 (no retries) and 2 (one retry), just to make sure it is
doing what we expect.
Further, we optimize _get_alternate_hosts() to only re-filter/weigh the
host list if we're looking for alternates for multiple instances. Now
that it's clear that num_alts is only nonzero if we are going to look
at the host list again to find those alternates, it can be more clearly
(and accurately) used to optimize out that extra step if we are not
getting alternates.
Closes-Bug: #1775625
Change-Id: I16ba29385dd2db5467829e6c17fc395096b5cfd3
(cherry picked from commit 5d86aa7edb60ec35fa43c670ae1f0513dc1e9ad5)
Reviewed: https:/ /review. openstack. org/573254 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=4e3dd818a3e 23c942bb2d475c6 fc2138518276fc
Committed: https:/
Submitter: Zuul
Branch: stable/queens
commit 4e3dd818a3e23c9 42bb2d475c6fc21 38518276fc
Author: Dan Smith <email address hidden>
Date: Thu May 17 07:28:59 2018 -0700
Fix interpretation of max_attempts for scheduling alternates
Since max_attempts is not max_retries, we should look for max_attempts-1
alternate hosts. This change makes the num_alts variable actually reflect
the number of alternates we are looking for, and doesn't actually change
the logic at all. This also adds functional tests to verify max_attempts
behavior with 1 (no retries) and 2 (one retry), just to make sure it is
doing what we expect.
Further, we optimize _get_alternate_ hosts() to only re-filter/weigh the
host list if we're looking for alternates for multiple instances. Now
that it's clear that num_alts is only nonzero if we are going to look
at the host list again to find those alternates, it can be more clearly
(and accurately) used to optimize out that extra step if we are not
getting alternates.
Closes-Bug: #1775625 5467829e6c17fc3 95096b5cfd3 5fa43c670ae1f05 13dc1e9ad5)
Change-Id: I16ba29385dd2db
(cherry picked from commit 5d86aa7edb60ec3