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

Bug #1827628 reported by Surya Seetharaman
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Surya Seetharaman
Queens
Fix Committed
Medium
Matt Riedemann
Rocky
Fix Committed
Medium
Matt Riedemann
Stein
Fix Committed
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)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

Changed in nova:
status: Confirmed → In Progress
Revision history for this message
Matt Riedemann (mriedem) wrote :

This is closer to bug 1777591 than bug 1805984.

Revision history for this message
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)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

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
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/stein)

Fix proposed to branch: stable/stein
Review: https://review.opendev.org/659239

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

Fix proposed to branch: stable/rocky
Review: https://review.opendev.org/659246

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.opendev.org/659247

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

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)

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

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

Matt Riedemann (mriedem)
Changed in nova:
assignee: Matt Riedemann (mriedem) → Surya Seetharaman (tssurya)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/rocky)

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)

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

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)

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

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

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

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

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

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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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