Re: [openstack-dev] [oslo_messaging]Notification listener for nova

2015-03-04 Thread Sandy Walsh
I assume you have notifications enabled in nova.conf?


See the Enabling notifications in OpenStack section 
http://www.stacktach.com/about.html


Oh, there are couple more flags that could be useful too:


notify_on_state_change=vm_and_task_state
notify_on_any_change=True

?



From: Eduard Matei eduard.ma...@cloudfounders.com
Sent: Wednesday, March 4, 2015 3:14 AM
To: OpenStack Development Mailing List (not for usage questions)
Subject: [openstack-dev] [oslo_messaging]Notification listener for nova

Hi,
I'm trying to listen to events of type compute.instance.* (e.g. 
compute.instance.update).
I tried the following code:

from oslo_config import cfg
import oslo_messaging

class NotificationEndpoint(object):
filter_rule = oslo_messaging.NotificationFilter(publisher_id='compute.*',

event_type='compute.instance.update',
context={'ctxt_key': 
'regexp'})

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

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

transport = oslo_messaging.get_transport(cfg.CONF)
targets = [oslo_messaging.Target(topic='notifications'),?
   oslo_messaging.Target(topic='notifications_bis')]
endpoints = [NotificationEndpoint()]
pool = listener-workers
server = oslo_messaging.get_notification_listener(transport=transport,
  targets=targets,
  endpoints=endpoints,
  pool=pool)
server.start()
server.wait()

then, from Horizon i changed an instance name (which should call 
_send_instance_update_notification)  but i didn't get any notification.

Any ideas?
Thanks,

--

Eduard Biceri Matei, Senior Software Developer
www.cloudfounders.comhttp://www.cloudfounders.com/
 | eduard.ma...@cloudfounders.commailto:eduard.ma...@cloudfounders.com



CloudFounders, The Private Cloud Software Company

Disclaimer:
This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed.
If you are not the named addressee or an employee or agent responsible for 
delivering this message to the named addressee, you are hereby notified that 
you are not authorized to read, print, retain, copy or disseminate this message 
or any part of it. If you have received this email in error we request you to 
notify us by reply e-mail and to delete all electronic files of the message. If 
you are not the intended recipient you are notified that disclosing, copying, 
distributing or taking any action in reliance on the contents of this 
information is strictly prohibited.
E-mail transmission cannot be guaranteed to be secure or error free as 
information could be intercepted, corrupted, lost, destroyed, arrive late or 
incomplete, or contain viruses. The sender therefore does not accept liability 
for any errors or omissions in the content of this message, and shall have no 
liability for any loss or damage suffered by the user, which arise as a result 
of e-mail transmission.

__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


[openstack-dev] [oslo_messaging]Notification listener for nova

2015-03-03 Thread Eduard Matei
Hi,
I'm trying to listen to events of type compute.instance.* (e.g.
compute.instance.update).
I tried the following code:

from oslo_config import cfg
import oslo_messaging

class NotificationEndpoint(object):
filter_rule =
oslo_messaging.NotificationFilter(publisher_id='compute.*',

event_type='compute.instance.update',
context={'ctxt_key':
'regexp'})

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

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

transport = oslo_messaging.get_transport(cfg.CONF)
targets = [oslo_messaging.Target(topic='notifications'),
   oslo_messaging.Target(topic='notifications_bis')]
endpoints = [NotificationEndpoint()]
pool = listener-workers
server = oslo_messaging.get_notification_listener(transport=transport,
  targets=targets,
  endpoints=endpoints,
  pool=pool)
server.start()
server.wait()

then, from Horizon i changed an instance name (which should call
_send_instance_update_notification)  but i didn't get any notification.

Any ideas?
Thanks,

-- 

*Eduard Biceri Matei, Senior Software Developer*
www.cloudfounders.com
 | eduard.ma...@cloudfounders.com



*CloudFounders, The Private Cloud Software Company*

Disclaimer:
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed.
If you are not the named addressee or an employee or agent responsible
for delivering this message to the named addressee, you are hereby
notified that you are not authorized to read, print, retain, copy or
disseminate this message or any part of it. If you have received this
email in error we request you to notify us by reply e-mail and to
delete all electronic files of the message. If you are not the
intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
information is strictly prohibited.
E-mail transmission cannot be guaranteed to be secure or error free as
information could be intercepted, corrupted, lost, destroyed, arrive
late or incomplete, or contain viruses. The sender therefore does not
accept liability for any errors or omissions in the content of this
message, and shall have no liability for any loss or damage suffered
by the user, which arise as a result of e-mail transmission.
__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev