← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1687012] Re: flavor-delete notification should not try to lazy-load projects

 

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

commit 3936a3cfda406f4cea7984a307482ac67ed1a365
Author: Matt Riedemann <mriedem.os@xxxxxxxxx>
Date:   Fri Apr 28 09:38:06 2017 -0400

    Don't lazy-load flavor.projects during destroy()
    
    When we destroy a flavor it's happening in the API database now.
    Right after we delete the flavor, we send a delete notification
    which will attempt to lazy-load projects, but because the flavor
    is deleted, that will result in a FlavorNotFound from the API DB
    in method _get_projects_from_db. Because of our fallback code to
    the main cell DB we'll then call flavor_access_get_by_flavor_id
    which returns an empty list and that's what goes into the
    notification, but it's not accurate since the empty list implies
    there are/were no projects with access to that flavor, when in
    reality we don't know.
    
    This handles the delete notification case by orphaning the flavor
    object so that when the notification emit happens, the
    NotificationPayloadBase gets an OrphanedObjectError and just
    sets projects to None, which is a better representation in the
    notification payload that we don't have that data.
    
    The tests needed some work since they were not actually comparing
    the payload to the flavor object before, they were comparing to
    fields in the DB representation of the flavor, which doesn't
    include the projects field as it's a joined column.
    
    Change-Id: I6868efab22cf9f1eb9006589a5b62618434c3ba3
    Closes-Bug: #1687012


** Changed in: nova
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1687012

Title:
  flavor-delete notification should not try to lazy-load projects

Status in OpenStack Compute (nova):
  Fix Released

Bug description:
  When we destroy a flavor from the api database we send a notification:

  https://github.com/openstack/nova/blob/5a363a0d72e7dd8d79d7e950effc1d8a5fdc801b/nova/objects/flavor.py#L608

  However if flavor.projects isn't loaded we try to lazy-load it:

  https://github.com/openstack/nova/blob/5a363a0d72e7dd8d79d7e950effc1d8a5fdc801b/nova/objects/flavor.py#L617

  Which is going to result in a FlavorNotFound error because we just
  deleted the flavor from the API database:

  https://github.com/openstack/nova/blob/5a363a0d72e7dd8d79d7e950effc1d8a5fdc801b/nova/objects/flavor.py#L65

  This doesn't blow everything up because we fallback to the main cell
  database to get the flavor projects:

  https://github.com/openstack/nova/blob/5a363a0d72e7dd8d79d7e950effc1d8a5fdc801b/nova/db/sqlalchemy/api.py#L5194

  Which just returns an empty list.

  I noticed this when removing the main db fallback paths in this change
  and had to workaround it:

  https://review.openstack.org/#/c/460377/

  But it's really a separate bug fix.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1687012/+subscriptions


References