availability_zone field is missing from the service.update notification payload

Bug #1653221 reported by Balazs Gibizer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Balazs Gibizer

Bug Description

Description
===========

The payload of the service.update notification is defined to contain the availability_zone of the service however if there is no availability zone is associated to the service the field was missing from the notification payload.

Steps to reproduce
==================
1) set up a devstack with log notification driver
2) disable the state of one of the nova service with
nova service disable
3) check the log to see the content of the emitted service.update notification

Expected result
===============
{
    "priority": "INFO",
    "payload": {
        "nova_object.namespace": "nova",
        "nova_object.name": "ServiceStatusPayload",
        "nova_object.version": "1.0",
        "nova_object.data": {
            "host": "host1",
            "disabled": false,
            "last_seen_up": "2012-10-29T13:42:05Z",
            "binary": "nova-compute",
            "topic": "compute",
            "disabled_reason": null,
            "report_count": 1,
            "forced_down": false,
            "version": 15
            "availability_zone": null
        }
    },
    "event_type": "service.update",
    "publisher_id": "nova-compute:host1"
}

Actual result
=============
{
    "priority": "INFO",
    "payload": {
        "nova_object.namespace": "nova",
        "nova_object.name": "ServiceStatusPayload",
        "nova_object.version": "1.0",
        "nova_object.data": {
            "host": "host1",
            "disabled": false,
            "last_seen_up": "2012-10-29T13:42:05Z",
            "binary": "nova-compute",
            "topic": "compute",
            "disabled_reason": null,
            "report_count": 1,
            "forced_down": false,
            "version": 15
        }
    },
    "event_type": "service.update",
    "publisher_id": "nova-compute:host1"
}

Environment
===========
devstack with nova master a74d3ae4e815e3727961ef67bd801dada0267a0b

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/415857

Changed in nova:
assignee: nobody → Balazs Gibizer (balazs-gibizer)
status: New → In Progress
Matt Riedemann (mriedem)
Changed in nova:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to nova (master)

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to nova (master)

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

commit 0082c47896475e968840a5f6c4e0f194523e10e8
Author: Balazs Gibizer <email address hidden>
Date: Wed Mar 1 17:44:50 2017 +0100

    re-orphan flavor after rpc deserialization

    The flavor objects stored in the instance object should not be used
    to lazy load any data from the db as they are not connected to real
    flavors in the db. These flavor objects are orphaned when created
    but durin rpc deserialization every deserialized nova object
    automatically gets a valid context. This can lead to unintended
    lazy loading of the projects field of such flavor objects during
    notification payload generation.

    This patch orphans the flavor objects stored in the instance object
    after every deserialization.

    Change-Id: I458f81931bad7874e951e1c0fd464d149f61b244
    Related-Bug: #1653221

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

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

commit 655942069aa77abad90a742cd47690a81987e9d7
Author: Balazs Gibizer <email address hidden>
Date: Fri Jan 13 11:00:25 2017 +0100

    handle uninited fields in notification payload

    Due to the not strict handling of uninitialized fields during
    notification payload population it is possible that the emitted
    notification missing some of the fields defined in the schema.

    There are two problematic cases:
    1) no load tirggered for lazy loaded fields. If the field was not
       loaded it is not added to the payload.
    2) uninitialized, not lazy loadable fields are not added to the
       payload.

    This patch makes sure that lazy load is triggered. If the field is
    not lazy loadable and also not initialized then related payload
    field will be set to None. If the payload field is not nullable
    the code will fail to make sure that the inconsistency is detected.

    The following changes cannot be split to different commits because
    as soon as the generic schema population code is fixed every listed
    notification starts behaving differently.

    In some cases the availability_zone field of the Service object is left
    unitialized by both the constructor and the obj_load_attr function this
    caused that the availability_zone field of the service.update
    notification was missing from the emitted notification payload.

    The extra_specs field of the Flavor object is not lazy loadable and not
    initialized in the Flavor destroy case. So the extra_specs field of the
    FlavorPayload needed to be made nullable.

    The projects field of the Flavor object is lazy loaded but when the
    Flavor object is loaded as part of an Instance object Flavor is
    orphaned and no lazy load is allowed on that Flavor object. In this
    case the projects field of the FlavorPayload will be set to None to
    signal that the information is not available. This also means that
    the projects field of the FlavorPayload needed to be changed to
    nullable.

    The hosts and id fields of the Aggregate object is not initialized
    during the create of the Aggregate before the aggregate.create.start
    needs to be sent. Therefore these fields needs to be nullable.

    Closes-Bug: #1653221
    Change-Id: Ib122cd98ee0cc31938d5ff1d5c753053267a3bd4

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.0b1

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

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.