Comment 0 for bug 2071365

Revision history for this message
Bram Kranendonk (bramkranendonk) wrote :

Summary
Octavia Oslo notifications currently do not include the flavor_id attribute.

Why is this needed
Including flavor_id in Oslo notifications is necessary for accurate metric retrieval, such as in Gnocchi.

Steps to Reproduce

Deploy a load balancer using Octavia.

Trigger any event that sends an Oslo notification (e.g., creating, updating, or deleting a load balancer).
Inspect the content of the Oslo notification and observe that flavor_id is missing.

Expected Behavior
The flavor_id should be included in the Oslo notification context, allowing systems like Gnocchi to correctly retrieve and process metrics related to the load balancer's flavor.

Actual Behavior
The flavor_id is not present in the Oslo notification context, leading to potential issues in metric retrieval and processing.

Proposed Fix
Modify the RequestContext to include flavor_id in the notification_tasks.py file. Below is the proposed code change:

class BaseNotificationTask(task.Task):
    event_type = None

    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self._rpc_notifier = rpc.get_notifier()

    def execute(self, loadbalancer):
        ctx = context.RequestContext(
            project_id=loadbalancer[constants.PROJECT_ID],
            flavor_id=loadbalancer[constants.FLAVOR_ID]
        )
        LOG.debug(f"Sending rpc notification: {self.event_type} "
                  f"{loadbalancer[constants.LOADBALANCER_ID]}")
        self._rpc_notifier.info(
            ctx,
            self.event_type,
            loadbalancer
        )

https://github.com/openstack/octavia/blob/7376a4ad0c305113a2aabc091f1bb761a532b14d/octavia/controller/worker/v2/tasks/notification_tasks.py#L32