The nova.openstack.common.plugin.callbackplugin Module

class CallbackPlugin(service_name)

Bases: nova.openstack.common.plugin.plugin.Plugin

Plugin with a simple callback interface.

This class is provided as a convenience for producing a simple plugin that only watches a couple of events. For example, here’s a subclass which prints a line the first time an instance is created.

class HookInstanceCreation(CallbackPlugin):

def __init__(self, _service_name):
super(HookInstanceCreation, self).__init__() self._add_callback(self.magic, ‘compute.instance.create.start’)
def magic(self):
print “An instance was created!” self._remove_callback(self, self.magic)

Previous topic

The nova.openstack.common.notifier.test_notifier Module

Next topic

The nova.openstack.common.plugin.plugin Module

This Page