<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Rogerio --<br>
<br>
<blockquote
cite="mid:CAKGNp+svM6i7W-sH4_T=Xffs6q+0yWvHsAxacRjrzftJtA9x7Q@mail.gmail.com"
type="cite">I'm developing a application to work along with
openstack. My application needs to keep track of all instances
being started or terminated such as feeding it information about
the location, status and other information about launched and
terminated instances.<br>
</blockquote>
<br>
Nova already includes a notification framework which works well for
this sort of thing.<br>
<br>
If you want your code to run on a different host or even a separate
process, you should enable queue-based notifications on nova
commandline with something like<br>
<br>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<span class="str">--notification_driver =
nova.notifier.rabbit_notifier</span><br>
<br>
Then you can set up your code as a queue consumer to receive these
messages.<br>
<br>
That's not the approach that I'm using currently, though. What I
did is easier but somewhat more intrusive: I wrote a custom
notification driver that checks for interesting messages and does my
work inline.<br>
<br>
<span class="str">--notification_driver =
nova.notifier.list_notifier</span><br>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<span class="str">--list_notifier_drivers = </span><span
class="str">nova.sharedfs.sharedfs_notifier.SharedFSNotifier</span><br>
<br>
That results in SharedFSNotifier's notify(message) function getting
called for each notification, where it vets the messages and
responds as needed:<br>
<br>
event_type = message.get('event_type')<br>
if event_type not in ['compute.instance.delete.start',<br>
'compute.instance.create.end']:<br>
etc.<br>
<br>
You can see the complete class in this patch:
<a class="moz-txt-link-freetext" href="https://review.openstack.org/#change,5292">https://review.openstack.org/#change,5292</a> . Look for the file
'sharedfs_notifier.py'.<br>
<br>
Hope that helps!<br>
<br>
-Andrew<br>
</body>
</html>