)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":11600,"name":"Michał Dulko","email":"michal.dulko@gmail.com","username":"dulek"},"change_message_id":"2c7dc084c571030750cc4728c331bb4dc71d2e4f","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Initialize modifiable list of resources in CacheBackedPluginApi."},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Currently, if one wanted to add any other resources (including custom"},{"line_number":10,"context_line":"objects), there is no simply way to achieve that, since list of defined"},{"line_number":11,"context_line":"resource types are hardcoded in create_cache_for_l2_agent function,"},{"line_number":12,"context_line":"which is called in __init__ of the CacheBackedPluginApi. Even if we"},{"line_number":13,"context_line":"derive from it, we must call super() on descendant, otherwise we end up"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"7faddb67_d6c5e50b","line":10,"range":{"start_line":10,"start_character":22,"end_line":10,"end_character":28},"updated":"2019-07-24 10:18:12.000000000","message":"simple","commit_id":"43b341c09a86f4197663ba7e6064ef39bee205f1"},{"author":{"_account_id":11600,"name":"Michał Dulko","email":"michal.dulko@gmail.com","username":"dulek"},"change_message_id":"2c7dc084c571030750cc4728c331bb4dc71d2e4f","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Currently, if one wanted to add any other resources (including custom"},{"line_number":10,"context_line":"objects), there is no simply way to achieve that, since list of defined"},{"line_number":11,"context_line":"resource types are hardcoded in create_cache_for_l2_agent function,"},{"line_number":12,"context_line":"which is called in __init__ of the CacheBackedPluginApi. Even if we"},{"line_number":13,"context_line":"derive from it, we must call super() on descendant, otherwise we end up"},{"line_number":14,"context_line":"with uninitialized PluginApi part. But if we do the super() on it, we"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"7faddb67_96cf6d28","line":11,"range":{"start_line":11,"start_character":15,"end_line":11,"end_character":18},"updated":"2019-07-24 10:18:12.000000000","message":"is","commit_id":"43b341c09a86f4197663ba7e6064ef39bee205f1"},{"author":{"_account_id":11600,"name":"Michał Dulko","email":"michal.dulko@gmail.com","username":"dulek"},"change_message_id":"2c7dc084c571030750cc4728c331bb4dc71d2e4f","unresolved":false,"context_lines":[{"line_number":14,"context_line":"with uninitialized PluginApi part. But if we do the super() on it, we"},{"line_number":15,"context_line":"end up on having hardcoded resources only, and creating a new remote"},{"line_number":16,"context_line":"resource cache object will make a new set of listeners, while the"},{"line_number":17,"context_line":"listeners for the old object still exists, and may cause memory leaks."},{"line_number":18,"context_line":"RemoteResourceWatcher class have only initializers for those listeners,"},{"line_number":19,"context_line":"and there is no obvious way to stop/clean them."},{"line_number":20,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"7faddb67_76d671c6","line":17,"range":{"start_line":17,"start_character":35,"end_line":17,"end_character":41},"updated":"2019-07-24 10:18:12.000000000","message":"exist","commit_id":"43b341c09a86f4197663ba7e6064ef39bee205f1"}],"neutron/agent/rpc.py":[{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"484245281a65e8d2df676ec529009d1c516661d5","unresolved":false,"context_lines":[{"line_number":202,"context_line":""},{"line_number":203,"context_line":"class CacheBackedPluginApi(PluginApi):"},{"line_number":204,"context_line":""},{"line_number":205,"context_line":"    RESOURCE_TYPES \u003d [resources.PORT,"},{"line_number":206,"context_line":"                      resources.SECURITYGROUP,"},{"line_number":207,"context_line":"                      resources.SECURITYGROUPRULE,"},{"line_number":208,"context_line":"                      resources.NETWORK,"}],"source_content_type":"text/x-python","patch_set":3,"id":"7faddb67_ca588332","line":205,"range":{"start_line":205,"start_character":4,"end_line":205,"end_character":18},"updated":"2019-07-30 13:31:54.000000000","message":"Question: how are going to modify this class variable in case you need to add more resources? Redefining it if needed?","commit_id":"2db02023eec96d825749490d40c750a37b97daec"},{"author":{"_account_id":13692,"name":"Roman Dobosz","email":"gryf73@gmail.com","username":"gryf"},"change_message_id":"906a55e1c67d0f5144777f98006b395a1ad39c59","unresolved":false,"context_lines":[{"line_number":202,"context_line":""},{"line_number":203,"context_line":"class CacheBackedPluginApi(PluginApi):"},{"line_number":204,"context_line":""},{"line_number":205,"context_line":"    RESOURCE_TYPES \u003d [resources.PORT,"},{"line_number":206,"context_line":"                      resources.SECURITYGROUP,"},{"line_number":207,"context_line":"                      resources.SECURITYGROUPRULE,"},{"line_number":208,"context_line":"                      resources.NETWORK,"}],"source_content_type":"text/x-python","patch_set":3,"id":"7faddb67_04a0ab8f","line":205,"range":{"start_line":205,"start_character":4,"end_line":205,"end_character":18},"in_reply_to":"7faddb67_ca588332","updated":"2019-08-01 07:45:26.000000000","message":"Basically - yes. In the inherited class I can easily define list of resource types, which I\u0027d like to have available in the cache. That\u0027s the easiest way for achieve this, without doing a horrible things ;)\n\nMain issue was the fact, that such list was defined within create_cache_for_l2_agent function, which was called during initialization. And since CacheBackedPluginApi inherits from PluginApi, I cannot simply skip the initialization in class derived from CacheBakcedPluginApi, since all of the PluginApi attributes will be lost.\n\nCleanest solution IMHO would be to explicitly call initialization on CacheBackedPluginApi object, i.e.\n\n   (ovs agent code)\n   ...\n   plugin_rpc \u003d OVSPluginApi(topics.PLUGIN)  # derived from CacheBackedPluginApi\n   plugin_rpc.spin_up_the_watchers()\n\nso that before spin_up_the_watchers, I could influence on the list of desired resources to be watched, using some method. The other part is the custom resource type definition, but it\u0027s different story.","commit_id":"2db02023eec96d825749490d40c750a37b97daec"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"484245281a65e8d2df676ec529009d1c516661d5","unresolved":false,"context_lines":[{"line_number":210,"context_line":""},{"line_number":211,"context_line":"    def __init__(self, *args, **kwargs):"},{"line_number":212,"context_line":"        super(CacheBackedPluginApi, self).__init__(*args, **kwargs)"},{"line_number":213,"context_line":"        self.remote_resource_cache \u003d None"},{"line_number":214,"context_line":"        self._create_cache_for_l2_agent()"},{"line_number":215,"context_line":""},{"line_number":216,"context_line":"    def register_legacy_notification_callbacks(self, legacy_interface):"}],"source_content_type":"text/x-python","patch_set":3,"id":"7faddb67_aa1e675c","line":213,"range":{"start_line":213,"start_character":8,"end_line":213,"end_character":41},"updated":"2019-07-30 13:31:54.000000000","message":"nit: Not needed if you are going to assign it in L380 and this function is called in this same function, __init__.","commit_id":"2db02023eec96d825749490d40c750a37b97daec"},{"author":{"_account_id":13692,"name":"Roman Dobosz","email":"gryf73@gmail.com","username":"gryf"},"change_message_id":"906a55e1c67d0f5144777f98006b395a1ad39c59","unresolved":false,"context_lines":[{"line_number":210,"context_line":""},{"line_number":211,"context_line":"    def __init__(self, *args, **kwargs):"},{"line_number":212,"context_line":"        super(CacheBackedPluginApi, self).__init__(*args, **kwargs)"},{"line_number":213,"context_line":"        self.remote_resource_cache \u003d None"},{"line_number":214,"context_line":"        self._create_cache_for_l2_agent()"},{"line_number":215,"context_line":""},{"line_number":216,"context_line":"    def register_legacy_notification_callbacks(self, legacy_interface):"}],"source_content_type":"text/x-python","patch_set":3,"id":"7faddb67_e4d0eff9","line":213,"range":{"start_line":213,"start_character":8,"end_line":213,"end_character":41},"in_reply_to":"7faddb67_aa1e675c","updated":"2019-08-01 07:45:26.000000000","message":"Well, yeah. I prefer to have all the attributes defined during initialization, so that we could at first glance see, what are the attributes of such class.","commit_id":"2db02023eec96d825749490d40c750a37b97daec"}]}
