anti-affinity policy only honored on boot

Bug #1379451 reported by Russell Bryant on 2014-10-09
26
This bug affects 6 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Medium
Sylvain Bauza

Bug Description

If you create a server group with an anti-affinity policy, it is only honored during the initial boot. If you do a cold migrate, live migrate, or evacuate where the scheduler is picking the destination, it seems reasonable to expect that the scheduler will continue to honor that policy. However, it does not.

The reason for this has to do with an implementation optimization in the scheduler. It skips all of the group checking if the 'group' hint is not present. Since scheduler hints are only kept around for the initial boot, this doesn't work. One solution would be to persist scheduler hints. However, a shorter term fix specifically for server groups is to always check the database for group membership when the server group filters are enabled.

Changed in nova:
assignee: nobody → Russell Bryant (russellb)
status: New → Confirmed
importance: Undecided → Medium
no longer affects: nova/icehouse
no longer affects: nova/juno

Related fix proposed to branch: master
Review: https://review.openstack.org/128055

Related fix proposed to branch: master
Review: https://review.openstack.org/128056

Related fix proposed to branch: master
Review: https://review.openstack.org/128057

Changed in nova:
status: Confirmed → In Progress

Reviewed: https://review.openstack.org/128054
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=b4e5a59fac0640db59531f1dfc6889e475f6206f
Submitter: Jenkins
Branch: master

commit b4e5a59fac0640db59531f1dfc6889e475f6206f
Author: Russell Bryant <email address hidden>
Date: Thu Oct 9 19:31:39 2014 +0000

    Add instance_group_get_by_instance to db.api

    Add a new method to the db.api that lets you get an instance group by
    instance UUID.

    Change-Id: I3d2a019c8f97166ec55574c610d12f572afb2bd1
    Related-bug: #1379451

Reviewed: https://review.openstack.org/128055
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=f0624f4446326c3c93611bca12544202096ed2fe
Submitter: Jenkins
Branch: master

commit f0624f4446326c3c93611bca12544202096ed2fe
Author: Russell Bryant <email address hidden>
Date: Thu Oct 9 19:45:11 2014 +0000

    add InstanceGroup.get_by_instance_uuid

    Add a new method to the InstanceGroup object that lets you get a group
    by an instance UUID. Right now Nova only lets you have an instance in
    a single group, so that's why this is a method of InstanceGroup and
    not InstanceGroupList.

    Change-Id: Ic0181e241471ad817284209e6a1093a438962bf1
    Related-bug: #1379451

Reviewed: https://review.openstack.org/128056
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=0eb7f36cfc1cdb65bbb482d3760961e417ccd2d8
Submitter: Jenkins
Branch: master

commit 0eb7f36cfc1cdb65bbb482d3760961e417ccd2d8
Author: Russell Bryant <email address hidden>
Date: Thu Oct 9 18:08:52 2014 +0000

    Minor refactor of _setup_instance_group()

    This patch is a minor refactoring of the _setup_instance_group()
    method in the filter scheduler. The majority of the method was inside
    of a conditional. This primarily reverses that and reduces the
    nesting depth used. There should be no functional changes at all in
    this patch.

    Change-Id: Iab4d63200653a4320c91dc1356091ff9d961cafd
    Related-bug: #1379451

Reviewed: https://review.openstack.org/128057
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=fc82b8b012f56139d3c45bf57c2d5639beb4dc87
Submitter: Jenkins
Branch: master

commit fc82b8b012f56139d3c45bf57c2d5639beb4dc87
Author: Russell Bryant <email address hidden>
Date: Mon Oct 13 19:15:50 2014 +0000

    Remove duplicate test

    Remove a test case that is a duplicate of what is done by
    test_group_details_in_filter_properties.

    Change-Id: I6a6c0b3f9474ca82be05e7ff5d47908a9093b119
    Related-bug: #1379451

Changed in nova:
assignee: Russell Bryant (russellb) → Sylvain Bauza (sylvain-bauza)

Change abandoned by Sylvain Bauza (<email address hidden>) on branch: master
Review: https://review.openstack.org/135351
Reason: Change has been provided to https://review.openstack.org/#/c/128058/

Changed in nova:
assignee: Sylvain Bauza (sylvain-bauza) → Michael Still (mikalstill)
Changed in nova:
assignee: Michael Still (mikalstill) → Sylvain Bauza (sylvain-bauza)

Reviewed: https://review.openstack.org/128058
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=459ca56de2366aea53efc9ad3295fdf4ddcd452c
Submitter: Jenkins
Branch: master

commit 459ca56de2366aea53efc9ad3295fdf4ddcd452c
Author: Sylvain Bauza <email address hidden>
Date: Tue Nov 18 17:34:51 2014 +0100

    Check server group policy on migrate/evacuate

    This patch changes server group checking in the instance group setup.
    Previously, it checked for the presence of the 'group' scheduler hint
    as an indication that the instance was a member of a group. However,
    that hint is only present on initial boot. It is not present when the
    scheduler is being used to pick a destination for a migration or
    evactuate.

    The updated logic checks the database to see if the instance is a
    member of a group. For performance reasons, it only does this is
    server group functionality is enabled in the scheduler (group filters
    are enabled).

    This change makes it so server group policy enforcement will still
    occur for migrations and evactuations, instead of only on first boot.

    It also adds the call to setup_instance_group in evacuate, resize,
    cold migrate and live migrate methods because now it is possible to
    access the group setup.

    Implements blueprint anti-affinity-on-migration

    Closes-bug: #1379451

    Change-Id: I6e9ea6ba69e8658fa5126a3488ee12cf2437460c

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx) on 2014-12-18
Changed in nova:
milestone: none → kilo-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2015-04-30
Changed in nova:
milestone: kilo-1 → 2015.1.0
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers