nova-scheduler calculates alternative hosts incorrectly

Bug #1775625 reported by Matt Riedemann
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Dan Smith
Queens
Fix Committed
Medium
Dan Smith

Bug Description

The alternative hosts calculation code in the scheduler (since Queens) uses max_attempts incorrectly, as if it's max_retries, but max_attempts can be set to 1 meaning no retries, but the scheduler would still calculate that as 1 retry so 1 alternate host.

This is fixed in Rocky with change: https://review.openstack.org/#/c/569127/

But this bug report is for fixing it in Queens also.

Tags: scheduler
Matt Riedemann (mriedem)
Changed in nova:
assignee: nobody → Dan Smith (danms)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/queens)

Fix proposed to branch: stable/queens
Review: https://review.openstack.org/573254

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/queens)

Reviewed: https://review.openstack.org/573254
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=4e3dd818a3e23c942bb2d475c6fc2138518276fc
Submitter: Zuul
Branch: stable/queens

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)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 17.0.6

This issue was fixed in the openstack/nova 17.0.6 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.