Cannot model affinity (and/or anti) with placement "limits" parameter

Bug #1827628 reported by Surya Seetharaman on 2019-05-03
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Medium
Surya Seetharaman
Queens
Medium
Matt Riedemann
Rocky
Medium
Matt Riedemann
Stein
Medium
Surya Seetharaman

Bug Description

It is currently not possible to use affinity/anti-affinity with the placement "limits" parameter since if you want your instance to land on a node where another instance lives you cannot rely on what placement GET/allocation_candidates would return and this could result in a no valid host. Current workaround is to unset the limits parameter.

We already have the same-ish problem for disabled computes (https://bugs.launchpad.net/nova/+bug/1805984). We could just do a more generic solution that fits both these cases.

The same problem is also applicable to https://docs.openstack.org/nova/latest/admin/configuration/schedulers.html#samehostfilter and https://docs.openstack.org/nova/latest/admin/configuration/schedulers.html#differenthostfilter

Changed in nova:
status: New → Confirmed
importance: Undecided → Medium
Changed in nova:
assignee: nobody → Surya Seetharaman (tssurya)

Fix proposed to branch: master
Review: https://review.opendev.org/658110

Changed in nova:
status: Confirmed → In Progress
Matt Riedemann (mriedem) wrote :

This is closer to bug 1777591 than bug 1805984.

Matt Riedemann (mriedem) wrote :

I believe the same issue would exist if using the same_host or different_host hints which are used by the SameHostFilter and DifferentHostFilter. Those aren't for server groups, they are for saying "I want my server on the same host as some other server(s)" or "I don't want my server on the same host as some other server(s)". I think it predates groups.

description: updated
Changed in nova:
assignee: Surya Seetharaman (tssurya) → Matt Riedemann (mriedem)

Reviewed: https://review.opendev.org/658110
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=2f9e972ba3358fc5bc9bdc06faf47b21d509e20f
Submitter: Zuul
Branch: master

commit 2f9e972ba3358fc5bc9bdc06faf47b21d509e20f
Author: Surya Seetharaman <email address hidden>
Date: Thu May 9 16:22:13 2019 +0200

    Disable limit if affinity(anti)/same(different)host is requested

    When max_placement_results is less than the total number of nodes in
    a deployment it may not be possible to use the affinity, anti-affinity,
    same host or different host filters as there is no guarantee
    for placement to return the expected hosts under such situations. This
    patch disables the max_placement_results parameter when nova queries
    placement for ``GET /allocation_candidates`` if the
    request_spec.scheduler_hints containts any of group, same_host or
    different_host keys.

    Change-Id: Ia2d5f80b6db59a8f6da03344aeaa6aa599407672
    Closes-Bug: #1827628

Changed in nova:
status: In Progress → Fix Released

Reviewed: https://review.opendev.org/659239
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=c094a6ef0c220ace7f717a07bef6fbd87a019190
Submitter: Zuul
Branch: stable/stein

commit c094a6ef0c220ace7f717a07bef6fbd87a019190
Author: Surya Seetharaman <email address hidden>
Date: Thu May 9 16:22:13 2019 +0200

    Disable limit if affinity(anti)/same(different)host is requested

    When max_placement_results is less than the total number of nodes in
    a deployment it may not be possible to use the affinity, anti-affinity,
    same host or different host filters as there is no guarantee
    for placement to return the expected hosts under such situations. This
    patch disables the max_placement_results parameter when nova queries
    placement for ``GET /allocation_candidates`` if the
    request_spec.scheduler_hints containts any of group, same_host or
    different_host keys.

    Note that due to change If7ea02df42d220c5042947efdef4777509492a0b only
    being in Train the test in the backport calls resources_from_request_spec
    without the context or fake HostManager parameters.

    Change-Id: Ia2d5f80b6db59a8f6da03344aeaa6aa599407672
    Closes-Bug: #1827628
    (cherry picked from commit 2f9e972ba3358fc5bc9bdc06faf47b21d509e20f)

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

Matt Riedemann (mriedem) on 2019-06-11
Changed in nova:
assignee: Matt Riedemann (mriedem) → Surya Seetharaman (tssurya)

Reviewed: https://review.opendev.org/659246
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=aa19788d7849780e4ca30ea0bd7577a349ece704
Submitter: Zuul
Branch: stable/rocky

commit aa19788d7849780e4ca30ea0bd7577a349ece704
Author: Surya Seetharaman <email address hidden>
Date: Thu May 9 16:22:13 2019 +0200

    Disable limit if affinity(anti)/same(different)host is requested

    When max_placement_results is less than the total number of nodes in
    a deployment it may not be possible to use the affinity, anti-affinity,
    same host or different host filters as there is no guarantee
    for placement to return the expected hosts under such situations. This
    patch disables the max_placement_results parameter when nova queries
    placement for ``GET /allocation_candidates`` if the
    request_spec.scheduler_hints containts any of group, same_host or
    different_host keys.

    NOTE(mriedem): The RequestGroup used in this backport has to use
    nova.api.openstack.placement.lib.RequestGroup because
    nova.objects.RequestGroup didn't exist until Stein with change
    I46c97d2641d9685ef59771314665a17a5236097d.

    Change-Id: Ia2d5f80b6db59a8f6da03344aeaa6aa599407672
    Closes-Bug: #1827628
    (cherry picked from commit 2f9e972ba3358fc5bc9bdc06faf47b21d509e20f)
    (cherry picked from commit c094a6ef0c220ace7f717a07bef6fbd87a019190)

Reviewed: https://review.opendev.org/659247
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=472b9993550f1ffbcce769843f793652162cb8dc
Submitter: Zuul
Branch: stable/queens

commit 472b9993550f1ffbcce769843f793652162cb8dc
Author: Surya Seetharaman <email address hidden>
Date: Thu May 9 16:22:13 2019 +0200

    Disable limit if affinity(anti)/same(different)host is requested

    When max_placement_results is less than the total number of nodes in
    a deployment it may not be possible to use the affinity, anti-affinity,
    same host or different host filters as there is no guarantee
    for placement to return the expected hosts under such situations. This
    patch disables the max_placement_results parameter when nova queries
    placement for ``GET /allocation_candidates`` if the
    request_spec.scheduler_hints containts any of group, same_host or
    different_host keys.

    NOTE(mriedem): The test is modified to remove the to_querystring
    call since change I496e8d64907fdcb0e2da255725aed1fc529725f2 that
    added it was in Rocky. As such, assertResourceRequestsEqual is
    changed to also assert the expected limit value.

    Change-Id: Ia2d5f80b6db59a8f6da03344aeaa6aa599407672
    Closes-Bug: #1827628
    (cherry picked from commit 2f9e972ba3358fc5bc9bdc06faf47b21d509e20f)
    (cherry picked from commit c094a6ef0c220ace7f717a07bef6fbd87a019190)
    (cherry picked from commit aa19788d7849780e4ca30ea0bd7577a349ece704)

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

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

This issue was fixed in the openstack/nova 20.0.0.0rc1 release candidate.

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

Other bug subscribers