[openstack-dev] [Quantum] Adding event handler for each CRUD method in db_base_plugin

Nachi Ueno nachi at nttmcl.com
Mon Oct 22 19:56:14 UTC 2012


Hi Mark

Thank you for your comment

Here is examples
OVSplugin and Linuxbridge plugin both have very similar code.

https://github.com/openstack/quantum/blob/master/quantum/plugins/linuxbridge/lb_quantum_plugin.py#L365
https://github.com/openstack/quantum/blob/master/quantum/plugins/openvswitch/ovs_quantum_plugin.py#L444

I wanna move these code for extension mixin class.

l3_db.py

def post_update_network(self, context, id, network):
    self._process_l3_update(context, network['network'], id)

def __init__():
    ...
    utils.register_event('post_update_network', self.post_update_network )
    ...

Thanks
Nachi

2012/10/22 Mark McClain <mark.mcclain at dreamhost.com>:
> I'm not sure I'm understanding the need to add these hooks.  Are these hooks to notification or data modification purposes?  Do you have an example use case in mind?
>
> mark
>
> On Oct 22, 2012, at 2:22 PM, Nachi Ueno <nachi at nttmcl.com> wrote:
>
>> Hi Quantum folks
>>
>> Now, when we add new extension, we should update for each plugins. (
>> l3 , security groups etc)
>> As the result, similar code are distributed between multiple plugins
>>
>> Instead of doing this, how about to add event handler for each CRUD
>> method in db_base_plugin?
>>
>> From extension we can do this.
>>
>> register_pre_create_network(event_handler, method)
>> or
>> register_post_create_network(event_handler, method)
>>
>> Best,
>> Nachi Ueno
>>
>> _______________________________________________
>> OpenStack-dev mailing list
>> OpenStack-dev at lists.openstack.org
>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
>
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev



More information about the OpenStack-dev mailing list