Hi,

Indeed, Vitrage now uses the Nova versioned notifications (we pushed that code a few days ago).
I'm only interested at the instance.create.* notifications, so I'll try to add the OS-EXT-SRV-ATTR:instance_name where you suggested. 

Thanks!
Ifat

On Wed, Dec 19, 2018 at 7:52 PM Matt Riedemann <mriedemos@gmail.com> wrote:
On 12/19/2018 11:29 AM, Ifat Afek wrote:
> Is there a way to get Nova extended server attributes (and
> specifically, OS-EXT-SRV-ATTR:instance_name) as part of the notification
> that is sent upon instance creation?
>
> In Vitrage we are using the immediate notifications from Nova, but this
> specific information is missing.

We could add it into the versioned notification payload if that works
for you (I heard vitrage was moving to using versioned notifications).

If you only need it on create, it could go here:

https://github.com/openstack/nova/blob/86a23f417a3e569afd74b513dc977780b40ead35/nova/notifications/objects/instance.py#L213

or more generically here:

https://github.com/openstack/nova/blob/86a23f417a3e569afd74b513dc977780b40ead35/nova/notifications/objects/instance.py#L25

The tricky thing about that value is it gets generated from config:

https://github.com/openstack/nova/blob/86a23f417a3e569afd74b513dc977780b40ead35/nova/objects/instance.py#L285

So depending on what "instance_name_template" is configured to be on
each service that sends the notification, the value could be different,
which could break unsuspecting consumers.

It looks like the instance.create.* versioned notifications all get sent
from the nova-compute service though which aligns with how
"instance_name_template" is used to generate the guest name in the
hypervisor. If you only need that value for instance.create
notifications, maybe we should just restrict it to that rather than
*all* InstancePayload-generated versioned notifications since the value
isn't stored in the database.

--

Thanks,

Matt