[openstack-dev] [nova] objects notifications
Jay Lau
jay.lau.513 at gmail.com
Wed Jul 30 13:10:42 UTC 2014
So we need to create a decorator method for create(), save(), destroy() etc
as following?
NOTIFICATION_FIELDS = ['host', 'metadata', ...]
@notify_on_save(NOTIFICATION_FIELDS)
@base.remotable
def save(context):
@notify_on_create(NOTIFICATION_FIELDS)
@base.remotable
def create(context):
Or can we just make the decorator method as generic as possible as
following:
@notify(NOTIFICATION_FIELDS)
@base.remotable
def save(context):
@notify(NOTIFICATION_FIELDS)
@base.remotable
def create(context):
For above case, the notify() method can handle all cases including create,
delete, update etc
Comments?
2014-07-30 12:26 GMT+08:00 Dan Smith <dms at danplanet.com>:
> > When reviewing https://review.openstack.org/#/c/107954/ it occurred to
> > me that maybe we should consider having some kind of generic object
> > wrapper that could do notifications for objects. Any thoughts on this?
>
> I think it might be good to do this in a repeatable, but perhaps not
> totally automatic way. I can see that any time instance gets changed in
> certain ways, that we'd want a notification about it. However, there are
> probably some cases that don't fit that. For example,
> instance.system_metadata is mostly private to nova I think, so I'm not
> sure we'd want to emit a notification for that. Plus, we'd probably end
> up with some serious duplication if we just do it implicitly.
>
> What if we provided a way to declare the fields of an object that we
> want to trigger a notification? Something like:
>
> NOTIFICATION_FIELDS = ['host', 'metadata', ...]
>
> @notify_on_save(NOTIFICATION_FIELDS)
> @base.remotable
> def save(context):
> ...
>
> --Dan
>
>
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
>
--
Thanks,
Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140730/4134a2d3/attachment.html>
More information about the OpenStack-dev
mailing list