nova/doc/notification_samples/flavor-delete.json
Matt Riedemann 3936a3cfda 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
2017-05-02 13:45:03 -04:00

26 lines
713 B
JSON

{
"priority": "INFO",
"payload": {
"nova_object.namespace": "nova",
"nova_object.version": "1.3",
"nova_object.name": "FlavorPayload",
"nova_object.data": {
"name": "test_flavor",
"memory_mb": 1024,
"ephemeral_gb": 0,
"disabled": false,
"vcpus": 2,
"swap": 0,
"rxtx_factor": 2.0,
"is_public": true,
"root_gb": 10,
"vcpu_weight": 0,
"flavorid": "a22d5517-147c-4147-a0d1-e698df5cd4e3",
"extra_specs": null,
"projects": null
}
},
"event_type": "flavor.delete",
"publisher_id": "nova-api:fake-mini"
}