<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none"><!-- p { margin-top: 0px; margin-bottom: 0px; }--></style>
</head>
<body dir="ltr" style="font-size:10pt;color:#000000;background-color:#FFFFFF;font-family:'Courier New',monospace;">
<p>I assume you have notifications enabled in nova.conf?<br>
</p>
<p><br>
</p>
<p>See the "Enabling notifications in OpenStack" section <a href="http://www.stacktach.com/about.html">http://www.stacktach.com/about.html</a><br>
</p>
<p><br>
</p>
<p>Oh, there are couple more flags that could be useful too:<br>
</p>
<p><br>
</p>
<pre style="box-sizing: border-box; font-family: Consolas, 'Andale Mono WT', 'Andale Mono', 'Lucida Console', 'Lucida Sans Typewriter', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Liberation Mono', 'Nimbus Mono L', Monaco, 'Courier New', Courier, monospace; font-size: 12px; margin-top: 0px; margin-bottom: 0px; padding: 12px; line-height: 1.5; overflow: auto; color: rgb(64, 64, 64); background-color: rgb(255, 255, 255);">notify_on_state_change=vm_and_task_state
notify_on_any_change=True<br></pre>
<p>​<br>
</p>
<p><br>
</p>
<div style="color: rgb(33, 33, 33);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Eduard Matei <eduard.matei@cloudfounders.com><br>
<b>Sent:</b> Wednesday, March 4, 2015 3:14 AM<br>
<b>To:</b> OpenStack Development Mailing List (not for usage questions)<br>
<b>Subject:</b> [openstack-dev] [oslo_messaging]Notification listener for nova</font>
<div> </div>
</div>
<div>
<div dir="ltr">Hi, 
<div>I'm trying to listen to events of type "compute.instance.*" (e.g. compute.instance.update).</div>
<div>I tried the following code:</div>
<div><br>
</div>
<div>
<div>from oslo_config import cfg</div>
<div>import oslo_messaging</div>
<div><br>
</div>
<div>class NotificationEndpoint(object):</div>
<div>    filter_rule = oslo_messaging.NotificationFilter(publisher_id='compute.*',</div>
<div>                                                    event_type='compute.instance.update',</div>
<div>                                                    context={'ctxt_key': 'regexp'})</div>
<div><br>
</div>
<div>    def info(self, ctxt, publisher_id, event_type, payload, metadata):</div>
<div>        print(payload)<br>
</div>
<div><br>
</div>
<div>    def warn(self, ctxt, publisher_id, event_type, payload, metadata):</div>
<div>        print(payload)</div>
<div><br>
</div>
<div>transport = oslo_messaging.get_transport(cfg.CONF)</div>
<div>targets = [oslo_messaging.Target(topic='notifications'),​<br>
</div>
<div>           oslo_messaging.Target(topic='notifications_bis')]</div>
<div>endpoints = [NotificationEndpoint()]</div>
<div>pool = "listener-workers"</div>
<div>server = oslo_messaging.get_notification_listener(transport=transport,</div>
<div>                                                  targets=targets,</div>
<div>                                                  endpoints=endpoints,</div>
<div>                                                  pool=pool)</div>
<div>server.start()</div>
<div>server.wait()</div>
</div>
<div><br>
</div>
<div>then, from Horizon i changed an instance name (which should call <span style="color:rgb(121,93,163); font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace; font-size:12px; line-height:16.7999992370605px; white-space:pre">_send_instance_update_notification</span>)
  but i didn't get any notification.</div>
<div><br>
</div>
<div>Any ideas?</div>
<div>Thanks,</div>
<div><br>
-- <br>
<div class="gmail_signature">
<div dir="ltr">
<pre style="white-space:pre-wrap; font-size:10px; word-wrap:break-word; margin-top:0px; margin-bottom:0px"><div style="font-family:arial,sans-serif; font-size:13px; white-space:normal; margin:0px"><b><span lang="EN-US" style="font-size:10pt; font-family:Arial,sans-serif">Eduard Biceri Matei, Senior Software Developer</span></b></div><div style="color:rgb(0,0,0); font-family:arial,sans-serif; font-size:13px; white-space:normal; margin:0px"><span style="font-size:13.5pt; font-family:Helvetica,sans-serif"><a href="http://www.cloudfounders.com/" target="_blank" style="color:rgb(17,85,204)"><span lang="EN-US" style="font-size:11pt; font-family:Calibri,sans-serif"><font color="#0045a3">www.cloudfounders.com</font></span></a><div style="display:inline-block; width:16px; height:16px"></div><div style="display:inline-block; width:16px; min-height:16px"></div></span><span lang="EN-US" style="font-size:11pt; font-family:Calibri,sans-serif"><font color="#1f497d"> | </font><a href="mailto:eduard.matei@cloudfounders.com" target="_blank" style="color:rgb(17,85,204)"><font color="#0045a3">eduard.matei@cloudfounders.com</font></a></span></div><div style="font-family:arial,sans-serif; font-size:13px; white-space:normal; margin:0px"><span lang="EN-US" style="font-size:11pt; font-family:Calibri,sans-serif; color:rgb(31,73,125)"><u></u> <u></u></span></div><br><div style="font-family:arial,sans-serif; font-size:13px; white-space:normal; margin:0px"><span lang="EN-US" style="font-size:13.5pt; font-family:Arial,sans-serif; color:rgb(80,0,80)"><u></u> <u></u></span></div><div style="font-family:arial,sans-serif; font-size:13px; white-space:normal; margin:0px"><b><span lang="EN-US" style="font-size:13.5pt; font-family:Arial,sans-serif">CloudFounders, The Private Cloud Software Company</span></b><span lang="EN-US" style="font-size:13.5pt; font-family:Arial,sans-serif"><u></u><u></u></span></div><div style="font-family:arial,sans-serif; font-size:13px; white-space:normal; margin:0px"><span lang="EN-US" style="font-size:13.5pt; font-family:Helvetica,sans-serif"><u></u> <u></u></span></div><div style="font-family:arial,sans-serif; font-size:13px; white-space:normal; margin:0px"><span lang="EN-US" style="font-family:Helvetica,sans-serif; font-size:11px">Disclaimer:<u></u><u></u></span></div><div style="font-family:arial,sans-serif; font-size:13px; white-space:normal; margin:0px"><span lang="EN-US" style="font-size:8.5pt; font-family:Calibri,sans-serif; color:rgb(31,73,125)">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.</span><span lang="EN-US" style="font-family:Calibri,sans-serif; color:rgb(31,73,125)"><br><span style="font-size:11px">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. <br>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.</span></span></div></pre>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
</body>
</html>