Ask Your Question
0

How to receive nova notification compute.instance.update?

asked 2015-03-05 09:21:22 -0500

eduard.bicerimatei gravatar image

Hi,

I'm trying to monitor nova instance changes by subscribing to compute.instance.update notifications.

I read that it's disabled by default so i enabled it by adding in nova.conf: notify_on_state_change = vm_and_task_state notification_driver = nova.openstack.common.notifier.rpc_notifier

I also added some debug logging to make sure that _send_instance_update_notification is sent but i can't see the message either in rabbitmqctl list_queues or in my implementation of a notifier listener:

from oslo.config import cfg
from oslo import messaging
import logging

import eventlet

eventlet.monkey_patch()

logging.basicConfig()
log = logging.getLogger()

log.addHandler(logging.StreamHandler())
log.setLevel(logging.INFO)

class NotificationHandler(object):
    def info(self, ctxt, publisher_id, event_type, payload, metadata):
        print(self, ctxt, publisher_id, event_type, payload, metadata)

    def warn(self, ctxt, publisher_id, event_type, payload, metadata):
        print(self, ctxt, publisher_id, event_type, payload, metadata)

    def error(self, ctxt, publisher_id, event_type, payload, metadata):
        print(self, ctxt, publisher_id, event_type, payload, metadata)

log.info('Configuring connection')
transport_url = 'rabbit://stackrabbit:*****@*.*.*.*:5672/'
transport = messaging.get_transport(cfg.CONF, transport_url)

targets = [messaging.Target(topic='compute')]
endpoints = [NotificationHandler()]

server = messaging.get_notification_listener(transport, targets, endpoints, allow_requeue=True, executor='eventlet')
log.info('Starting up server')
server.start()
log.info('Waiting for something')
server.wait()

Thanks,

Eduard

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-03-05 23:26:47 -0500

Rakesh Patnaik gravatar image

please check if you have covered the areas listed in this answer : https://ask.openstack.org/en/question...

edit flag offensive delete link more

Comments

Hi, i checked all the steps in that answer, but still can't see the instance update notification in the notifications.info queue. Added all the "notification" settings into nova.conf, added some debug statements, installed rabbitmqadmin; last place i could see the notification was in oslo_messaging.

eduard.bicerimatei gravatar imageeduard.bicerimatei ( 2015-03-26 08:25:56 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2015-03-05 09:20:41 -0500

Seen: 1,178 times

Last updated: Mar 05 '15