Unnecessary instance lazy-loads during rebuild

Bug #1696221 reported by Matt Riedemann
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Matt Riedemann
Ocata
Fix Committed
Low
Matt Riedemann

Bug Description

The rebuild code in the compute manager also handles evacuate. Rebuild is rebuild on the same host, no migration. Evacuate is rebuild the instance on another host, and has a migration context.

This code:

https://github.com/openstack/nova/blob/e01ae75d52900d96355dfcb39ef9b136f0c0d5c4/nova/compute/manager.py#L2718

Is using the mutated_migration_context() context manager which lazy-loads numa_topology, pci_requests and pci_devices and then, since self.migration_context isn't set on the instance, yields as a noop.

Seen here:

http://logs.openstack.org/82/471082/1/gate/gate-novaclient-dsvm-functional-neutron-ubuntu-xenial/796acb7/logs/screen-n-cpu.txt.gz#_Jun_06_13_14_02_547424

Jun 06 13:14:02.547424 ubuntu-xenial-infracloud-chocolate-9158824 nova-compute[20994]: DEBUG nova.objects.instance [None req-5b3770c1-d332-4875-8933-97de8a9890b4 admin admin] Lazy-loading 'pci_requests' on Instance uuid 573258a4-9416-4e13-a765-7c90683f3526 {{(pid=20994) obj_load_attr /opt/stack/new/nova/nova/objects/instance.py:1038}}
Jun 06 13:14:02.562243 ubuntu-xenial-infracloud-chocolate-9158824 nova-compute[20994]: DEBUG nova.objects.instance [None req-5b3770c1-d332-4875-8933-97de8a9890b4 admin admin] Lazy-loading 'pci_devices' on Instance uuid 573258a4-9416-4e13-a765-7c90683f3526 {{(pid=20994) obj_load_attr /opt/stack/new/nova/nova/objects/instance.py:1038}}
Jun 06 13:14:02.577132 ubuntu-xenial-infracloud-chocolate-9158824 nova-compute[20994]: DEBUG nova.objects.instance [None req-5b3770c1-d332-4875-8933-97de8a9890b4 admin admin] Lazy-loading 'migration_context' on Instance uuid 573258a4-9416-4e13-a765-7c90683f3526 {{(pid=20994) obj_load_attr /opt/stack/new/nova/nova/objects/instance.py:1038}}
Jun 06 13:14:02.590554 ubuntu-xenial-infracloud-chocolate-9158824 nova-compute[20994]: DEBUG nova.objects.instance [None req-5b3770c1-d332-4875-8933-97de8a9890b4 admin admin] [instance: 573258a4-9416-4e13-a765-7c90683f3526] Trying to apply a migration context that does not seem to be set for this instance {{(pid=20994) apply_migration_context /opt/stack/new/nova/nova/objects/instance.py:977}}

This is wasteful as each lazy-loaded field is a round trip to the database via conductor to set the field. If self.migration_context isn't set, mutated_migration_context() should just yield and return.

Tags: rebuild
Matt Riedemann (mriedem)
Changed in nova:
status: New → Triaged
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/471486

Changed in nova:
assignee: nobody → Matt Riedemann (mriedem)
status: Triaged → In Progress
Matt Riedemann (mriedem)
Changed in nova:
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

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

commit c3d466dd4d9739844404fdd9c4170c4a8284a4aa
Author: Matt Riedemann <email address hidden>
Date: Tue Jun 6 17:28:42 2017 -0400

    Avoid unnecessary lazy-loads in mutated_migration_context

    If the instance isn't being migrated and has the
    migration_context attribute set to None, like during a rebuild
    operation, we should detect that and exit early rather
    than lazy-load several fields (numa_topology, pci_requests,
    and pci_devices - all separately) and then just not use/need
    them.

    Change-Id: I071ab575bfd80db029d542cebfdb3d4e34227881
    Closes-Bug: #1696221

Changed in nova:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 16.0.0.0b3

This issue was fixed in the openstack/nova 16.0.0.0b3 development milestone.

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

Fix proposed to branch: stable/ocata
Review: https://review.openstack.org/515581

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

Reviewed: https://review.openstack.org/515581
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=8c4db90d0398cefaac99fcef44a9e19d1bf40ad2
Submitter: Zuul
Branch: stable/ocata

commit 8c4db90d0398cefaac99fcef44a9e19d1bf40ad2
Author: Matt Riedemann <email address hidden>
Date: Tue Jun 6 17:28:42 2017 -0400

    Avoid unnecessary lazy-loads in mutated_migration_context

    If the instance isn't being migrated and has the
    migration_context attribute set to None, like during a rebuild
    operation, we should detect that and exit early rather
    than lazy-load several fields (numa_topology, pci_requests,
    and pci_devices - all separately) and then just not use/need
    them.

    Change-Id: I071ab575bfd80db029d542cebfdb3d4e34227881
    Closes-Bug: #1696221
    (cherry picked from commit c3d466dd4d9739844404fdd9c4170c4a8284a4aa)

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

This issue was fixed in the openstack/nova 15.1.1 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.