)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"7735da93ed630663c79da67390d1ef81c7a77871","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Fix callback registry notification for security group rule"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Move callback registry notifications to"},{"line_number":10,"context_line":"create_security_group_rule_bulk_native() so"},{"line_number":11,"context_line":"notifications are sent in case of bulk rules creation"},{"line_number":12,"context_line":"as well, as it should be."},{"line_number":13,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"5afe65bd_91b7e885","line":10,"updated":"2015-06-03 14:24:44.000000000","message":"Nice catch. Can we add docstrings to document both methods? This is a weird way of bypassing inheritance, and I didn\u0027t notice this at the time.\n\nThat said, that makes me wonder why the mixins do not call super, which is really the way they should go for.","commit_id":"3acca8050460aa4842de1869074e6ac6e6619263"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"8711b404d85bc5d1f1cb99db88152849cdbe87f7","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Fix callback registry notification for security group rule"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Move callback registry notifications to"},{"line_number":10,"context_line":"create_security_group_rule_bulk_native() so"},{"line_number":11,"context_line":"notifications are sent in case of bulk rules creation"},{"line_number":12,"context_line":"as well, as it should be."},{"line_number":13,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"5afe65bd_5add05df","line":10,"in_reply_to":"5afe65bd_17ac0833","updated":"2015-06-03 16:46:35.000000000","message":"I was suggesting to add docstrings to the methods explaining what they are for, and warning devs of the potential danger of changing one or the other. Even a #NOTE would do.","commit_id":"3acca8050460aa4842de1869074e6ac6e6619263"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"9197fca3161835090a7ffe5fffa102be9fb45e7d","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Fix callback registry notification for security group rule"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Move callback registry notifications to"},{"line_number":10,"context_line":"create_security_group_rule_bulk_native() so"},{"line_number":11,"context_line":"notifications are sent in case of bulk rules creation"},{"line_number":12,"context_line":"as well, as it should be."},{"line_number":13,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"5afe65bd_9bc36357","line":10,"in_reply_to":"5afe65bd_5add05df","updated":"2015-06-04 09:27:43.000000000","message":"Main confusion for me is between bulk() and bulk_native(). Need to figure out if both are needed and what\u0027s the difference","commit_id":"3acca8050460aa4842de1869074e6ac6e6619263"},{"author":{"_account_id":11343,"name":"Gal Sagie","email":"gal.sagie@gmail.com","username":"GalSagie"},"change_message_id":"b17c0a45f6654159b971ad20f7fdf01022ffd88c","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Fix callback registry notification for security group rule"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Move callback registry notifications to"},{"line_number":10,"context_line":"create_security_group_rule_bulk_native() so"},{"line_number":11,"context_line":"notifications are sent in case of bulk rules creation"},{"line_number":12,"context_line":"as well, as it should be."},{"line_number":13,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"5afe65bd_578ba0c3","line":10,"in_reply_to":"5afe65bd_91b7e885","updated":"2015-06-03 14:55:06.000000000","message":"Added explanation in the next comment you made..","commit_id":"3acca8050460aa4842de1869074e6ac6e6619263"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"63627e084cc87774a8b8c2abf1ad5c7d370912ab","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Fix callback registry notification for security group rule"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Move callback registry notifications to"},{"line_number":10,"context_line":"create_security_group_rule_bulk_native() so"},{"line_number":11,"context_line":"notifications are sent in case of bulk rules creation"},{"line_number":12,"context_line":"as well, as it should be."},{"line_number":13,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"5afe65bd_17ac0833","line":10,"in_reply_to":"5afe65bd_91b7e885","updated":"2015-06-03 14:58:54.000000000","message":"create_security_group_rule() was the only overriden method not calling super, if I\u0027m not mistaken. Now it\u0027s fixed. Not sure I got what you suggest to be documented, can you please clarify?","commit_id":"3acca8050460aa4842de1869074e6ac6e6619263"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"6bf3d2385688a2d2deb99bbf5e35abd4b1773261","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Fix callback registry notification for security group rule"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Some housekeeping was done in"},{"line_number":10,"context_line":" - SecurityGroupDbMixin: single bulk method left;"},{"line_number":11,"context_line":"   create_rule_bulk() calls to create_rule();"},{"line_number":12,"context_line":"   registry notification is in create_rule();"},{"line_number":13,"context_line":"   separate validation for a single rule and for a group of rules"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":5,"id":"3afb71cf_4a37d7e3","line":10,"updated":"2015-06-04 20:21:22.000000000","message":"Another way to look at this would be that you made the job of create_security_group_rule_bulk what it used to be create_security_group_rule_bulk_native and you eliminated the use of middleman _create_bulk, whose job is to collate the creation of multiple objects in a single transaction. I think we retained that as we have nested the rule insertion loop in its own transactional context in  create_security_group_rule_bulk, so I think we\u0027re good.","commit_id":"6bffe7ca8c99a7c66b005ff168fe948afb42992c"}],"neutron/db/securitygroups_db.py":[{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"9197fca3161835090a7ffe5fffa102be9fb45e7d","unresolved":false,"context_lines":[{"line_number":342,"context_line":"            for binding in bindings:"},{"line_number":343,"context_line":"                context.session.delete(binding)"},{"line_number":344,"context_line":""},{"line_number":345,"context_line":"    def create_security_group_rule_bulk(self, context, security_group_rule):"},{"line_number":346,"context_line":"        return self._create_bulk(\u0027security_group_rule\u0027, context,"},{"line_number":347,"context_line":"                                 security_group_rule)"},{"line_number":348,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"5afe65bd_deae69e5","line":345,"updated":"2015-06-04 09:27:43.000000000","message":"I don\u0027t see the reason for having both this and native() bulk methods below. I\u0027m going to delete this one to reduce the mess","commit_id":"3acca8050460aa4842de1869074e6ac6e6619263"},{"author":{"_account_id":11343,"name":"Gal Sagie","email":"gal.sagie@gmail.com","username":"GalSagie"},"change_message_id":"2f951879ee54a003a5516575819a37071c73d6c6","unresolved":false,"context_lines":[{"line_number":342,"context_line":"            for binding in bindings:"},{"line_number":343,"context_line":"                context.session.delete(binding)"},{"line_number":344,"context_line":""},{"line_number":345,"context_line":"    def create_security_group_rule_bulk(self, context, security_group_rule):"},{"line_number":346,"context_line":"        return self._create_bulk(\u0027security_group_rule\u0027, context,"},{"line_number":347,"context_line":"                                 security_group_rule)"},{"line_number":348,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"5afe65bd_a92a558e","line":345,"in_reply_to":"5afe65bd_deae69e5","updated":"2015-06-04 09:39:06.000000000","message":"Potentially cant this be used by other plugins?","commit_id":"3acca8050460aa4842de1869074e6ac6e6619263"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"9197fca3161835090a7ffe5fffa102be9fb45e7d","unresolved":false,"context_lines":[{"line_number":400,"context_line":""},{"line_number":401,"context_line":"    def create_security_group_rule(self, context, security_group_rule):"},{"line_number":402,"context_line":"        bulk_rule \u003d {\u0027security_group_rules\u0027: [security_group_rule]}"},{"line_number":403,"context_line":"        return self.create_security_group_rule_bulk_native("},{"line_number":404,"context_line":"            context, bulk_rule)[0]"},{"line_number":405,"context_line":""},{"line_number":406,"context_line":"    def _get_ip_proto_number(self, protocol):"}],"source_content_type":"text/x-python","patch_set":3,"id":"5afe65bd_fefb65bf","line":403,"updated":"2015-06-04 09:27:43.000000000","message":"I\u0027m also not sure for what good reason we should use bulk_native() here to create just one rule.","commit_id":"3acca8050460aa4842de1869074e6ac6e6619263"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"6bf3d2385688a2d2deb99bbf5e35abd4b1773261","unresolved":false,"context_lines":[{"line_number":345,"context_line":"    def create_security_group_rule_bulk(self, context, security_group_rules):"},{"line_number":346,"context_line":"        rules \u003d security_group_rules[\u0027security_group_rules\u0027]"},{"line_number":347,"context_line":"        scoped_session(context.session)"},{"line_number":348,"context_line":"        security_group_id \u003d self._validate_single_tenant_and_group("},{"line_number":349,"context_line":"            security_group_rules)"},{"line_number":350,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":351,"context_line":"            if not self.get_security_group(context, security_group_id):"}],"source_content_type":"text/x-python","patch_set":5,"id":"3afb71cf_eabb2374","line":348,"updated":"2015-06-04 20:21:22.000000000","message":"have you considered passing rules instead to stop the nonsense or doing security_group_rules[\u0027security_group_rules\u0027] everywhere? :)\n\nOr is it painful?","commit_id":"6bffe7ca8c99a7c66b005ff168fe948afb42992c"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"5d06cf884ce457282a2f503ee94f67f52cc4b3dd","unresolved":false,"context_lines":[{"line_number":345,"context_line":"    def create_security_group_rule_bulk(self, context, security_group_rules):"},{"line_number":346,"context_line":"        rules \u003d security_group_rules[\u0027security_group_rules\u0027]"},{"line_number":347,"context_line":"        scoped_session(context.session)"},{"line_number":348,"context_line":"        security_group_id \u003d self._validate_single_tenant_and_group("},{"line_number":349,"context_line":"            security_group_rules)"},{"line_number":350,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":351,"context_line":"            if not self.get_security_group(context, security_group_id):"}],"source_content_type":"text/x-python","patch_set":5,"id":"3afb71cf_fc251f5c","line":348,"in_reply_to":"3afb71cf_eabb2374","updated":"2015-06-05 07:13:03.000000000","message":"I was thinking about it but on the other hand I\u0027d like to keep the patch more readable and related to the bug as much as possible :)","commit_id":"6bffe7ca8c99a7c66b005ff168fe948afb42992c"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"278c7df1ca8a50ec0159ec6900828afc34c25e19","unresolved":false,"context_lines":[{"line_number":344,"context_line":""},{"line_number":345,"context_line":"    def create_security_group_rule_bulk(self, context, security_group_rules):"},{"line_number":346,"context_line":"        return self._create_bulk(\u0027security_group_rule\u0027, context,"},{"line_number":347,"context_line":"                                 security_group_rules)"},{"line_number":348,"context_line":""},{"line_number":349,"context_line":"    def create_security_group_rule_bulk_native(self, context,"},{"line_number":350,"context_line":"                                               security_group_rule):"}],"source_content_type":"text/x-python","patch_set":9,"id":"1af86dd1_a96887bb","side":"PARENT","line":347,"updated":"2015-06-12 10:07:46.000000000","message":"I believe here you are changing the behaviour of this method. Who\u0027s using it? That needs to be understood because now you\u0027re doing a single DB operation (like the native version does), where as the previous behaviour was to call the plugin method for every operation (it was an \u0027emulated\u0027 bulk actually)","commit_id":"8d0c7fea0333cb6061bb3f257354d0f1cebb5ca7"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"2df119e3f5cb3cb032a0dd91d2acfa1666670acc","unresolved":false,"context_lines":[{"line_number":344,"context_line":""},{"line_number":345,"context_line":"    def create_security_group_rule_bulk(self, context, security_group_rules):"},{"line_number":346,"context_line":"        return self._create_bulk(\u0027security_group_rule\u0027, context,"},{"line_number":347,"context_line":"                                 security_group_rules)"},{"line_number":348,"context_line":""},{"line_number":349,"context_line":"    def create_security_group_rule_bulk_native(self, context,"},{"line_number":350,"context_line":"                                               security_group_rule):"}],"source_content_type":"text/x-python","patch_set":9,"id":"fa32b979_f69f535d","side":"PARENT","line":347,"in_reply_to":"1af86dd1_a96887bb","updated":"2015-06-15 15:43:29.000000000","message":"That\u0027s a valid concern and seems we better preserve both methods at this point. Thanks\n\nIt seems when dealing with DB mixins composition would do a better job than inheritance. IMO db mixins should provide reliable straightforward methods to work with db and not worry about possible overrides.","commit_id":"8d0c7fea0333cb6061bb3f257354d0f1cebb5ca7"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"6f6e40178824c2e5f9ab981680eab693b3d5be50","unresolved":false,"context_lines":[{"line_number":344,"context_line":""},{"line_number":345,"context_line":"    def create_security_group_rule_bulk(self, context, security_group_rules):"},{"line_number":346,"context_line":"        return self._create_bulk(\u0027security_group_rule\u0027, context,"},{"line_number":347,"context_line":"                                 security_group_rules)"},{"line_number":348,"context_line":""},{"line_number":349,"context_line":"    def create_security_group_rule_bulk_native(self, context,"},{"line_number":350,"context_line":"                                               security_group_rule):"}],"source_content_type":"text/x-python","patch_set":9,"id":"1af86dd1_ed02026f","side":"PARENT","line":347,"in_reply_to":"1af86dd1_a96887bb","updated":"2015-06-12 15:36:05.000000000","message":"This is indeed true as I noted partially in a previous PS; if we\u0027re not careful, we might not be calling into backends anymore! I am actually being torn by this change: on one hand, I\u0027d like to preserve the existing logic, on the other hand, I\u0027d like to clear up the nonsense....I feel responsible for having unveiled the mess :)\n\nUltimately the issue we\u0027re facing stems from the fact that we\u0027ve been mixing DB logic and backend logic together into one gigantic tentacular hierarchy across all the plugins out there; surely polymorphism is great, but the way we\u0027ve been using it here is problematic to say the least.","commit_id":"8d0c7fea0333cb6061bb3f257354d0f1cebb5ca7"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"6f6e40178824c2e5f9ab981680eab693b3d5be50","unresolved":false,"context_lines":[{"line_number":371,"context_line":"            self._check_for_duplicate_rules(context, rules)"},{"line_number":372,"context_line":"            ret \u003d []"},{"line_number":373,"context_line":"            for rule_dict in rules:"},{"line_number":374,"context_line":"                res_rule_dict \u003d self._create_security_group_rule("},{"line_number":375,"context_line":"                    context, rule_dict, validate\u003dFalse)"},{"line_number":376,"context_line":"                ret.append(res_rule_dict)"},{"line_number":377,"context_line":"            return ret"}],"source_content_type":"text/x-python","patch_set":9,"id":"1af86dd1_4dbc766c","line":374,"updated":"2015-06-12 15:36:05.000000000","message":"perhaps here we should call the public method instead, so that we go into the backends even for bulky requests? Have you considered this?","commit_id":"eb471e73d233b06109f5e5ea2e016955c6d001f3"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"2df119e3f5cb3cb032a0dd91d2acfa1666670acc","unresolved":false,"context_lines":[{"line_number":371,"context_line":"            self._check_for_duplicate_rules(context, rules)"},{"line_number":372,"context_line":"            ret \u003d []"},{"line_number":373,"context_line":"            for rule_dict in rules:"},{"line_number":374,"context_line":"                res_rule_dict \u003d self._create_security_group_rule("},{"line_number":375,"context_line":"                    context, rule_dict, validate\u003dFalse)"},{"line_number":376,"context_line":"                ret.append(res_rule_dict)"},{"line_number":377,"context_line":"            return ret"}],"source_content_type":"text/x-python","patch_set":9,"id":"fa32b979_32c2ae34","line":374,"in_reply_to":"1af86dd1_4dbc766c","updated":"2015-06-15 15:43:29.000000000","message":"One thing to not do this is that we\u0027ll end up with duplicated notifications: one for bulk create and one for each rule in this bulk call (see SecurityGroupServerRpcMixin in next file which overrides create_security_group_rule() as well)\n\nAlso I believe we usually try to avoid access backends inside a transaction.","commit_id":"eb471e73d233b06109f5e5ea2e016955c6d001f3"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"278c7df1ca8a50ec0159ec6900828afc34c25e19","unresolved":false,"context_lines":[{"line_number":380,"context_line":"                                               security_group_rules):"},{"line_number":381,"context_line":"        \"\"\"This method was just left for backwards compatibility\"\"\""},{"line_number":382,"context_line":"        return self._create_security_group_rule_bulk(context,"},{"line_number":383,"context_line":"                                                    security_group_rules)"},{"line_number":384,"context_line":""},{"line_number":385,"context_line":"    def create_security_group_rule(self, context, security_group_rule):"},{"line_number":386,"context_line":"        return self._create_security_group_rule(context, security_group_rule,"}],"source_content_type":"text/x-python","patch_set":9,"id":"1af86dd1_a913e75b","line":383,"updated":"2015-06-12 10:07:46.000000000","message":"I don\u0027t remember the full history for having two version of the bulk method for creating a security group. From what you are doing here it seems they can be easily (and then consumers like the vmware plugin can stop calling the one with the _native suffix).","commit_id":"eb471e73d233b06109f5e5ea2e016955c6d001f3"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"6f6e40178824c2e5f9ab981680eab693b3d5be50","unresolved":false,"context_lines":[{"line_number":380,"context_line":"                                               security_group_rules):"},{"line_number":381,"context_line":"        \"\"\"This method was just left for backwards compatibility\"\"\""},{"line_number":382,"context_line":"        return self._create_security_group_rule_bulk(context,"},{"line_number":383,"context_line":"                                                    security_group_rules)"},{"line_number":384,"context_line":""},{"line_number":385,"context_line":"    def create_security_group_rule(self, context, security_group_rule):"},{"line_number":386,"context_line":"        return self._create_security_group_rule(context, security_group_rule,"}],"source_content_type":"text/x-python","patch_set":9,"id":"1af86dd1_6d7e12b0","line":383,"in_reply_to":"1af86dd1_a913e75b","updated":"2015-06-12 15:36:05.000000000","message":"this sentence is fragmented","commit_id":"eb471e73d233b06109f5e5ea2e016955c6d001f3"}],"neutron/db/securitygroups_rpc_base.py":[{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"5316faf34b5d8f38e9f7c9f4647ccd089039f1c7","unresolved":false,"context_lines":[{"line_number":69,"context_line":"                for device in devices]"},{"line_number":70,"context_line":""},{"line_number":71,"context_line":"    def create_security_group_rule(self, context, security_group_rule):"},{"line_number":72,"context_line":"        rule \u003d super(SecurityGroupServerRpcMixin,"},{"line_number":73,"context_line":"                     self).create_security_group_rule(context,"},{"line_number":74,"context_line":"                                                      security_group_rule)"},{"line_number":75,"context_line":"        sgids \u003d [rule[\u0027security_group_id\u0027]]"}],"source_content_type":"text/x-python","patch_set":3,"id":"5afe65bd_74721aaf","line":72,"updated":"2015-06-03 14:28:39.000000000","message":"but once you do this, which I think is the right fix, why do we move the notification to the _native method? I think it\u0027s unnecessary. the native method is only called here and I wonder if something fishy is going on :)","commit_id":"3acca8050460aa4842de1869074e6ac6e6619263"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"63627e084cc87774a8b8c2abf1ad5c7d370912ab","unresolved":false,"context_lines":[{"line_number":69,"context_line":"                for device in devices]"},{"line_number":70,"context_line":""},{"line_number":71,"context_line":"    def create_security_group_rule(self, context, security_group_rule):"},{"line_number":72,"context_line":"        rule \u003d super(SecurityGroupServerRpcMixin,"},{"line_number":73,"context_line":"                     self).create_security_group_rule(context,"},{"line_number":74,"context_line":"                                                      security_group_rule)"},{"line_number":75,"context_line":"        sgids \u003d [rule[\u0027security_group_id\u0027]]"}],"source_content_type":"text/x-python","patch_set":3,"id":"5afe65bd_570e003c","line":72,"in_reply_to":"5afe65bd_17e768b1","updated":"2015-06-03 14:58:54.000000000","message":"So yeah, bulk_native is also the public API method and in theory it can be used. Since non_bulk method still uses bulk_native for actual rule creation in DB, I think it makes sense to add notification to bulk_native() only","commit_id":"3acca8050460aa4842de1869074e6ac6e6619263"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"62d92f32f6b8aabef60eb25338bec71b7c1a869e","unresolved":false,"context_lines":[{"line_number":69,"context_line":"                for device in devices]"},{"line_number":70,"context_line":""},{"line_number":71,"context_line":"    def create_security_group_rule(self, context, security_group_rule):"},{"line_number":72,"context_line":"        rule \u003d super(SecurityGroupServerRpcMixin,"},{"line_number":73,"context_line":"                     self).create_security_group_rule(context,"},{"line_number":74,"context_line":"                                                      security_group_rule)"},{"line_number":75,"context_line":"        sgids \u003d [rule[\u0027security_group_id\u0027]]"}],"source_content_type":"text/x-python","patch_set":3,"id":"5afe65bd_bfa29eac","line":72,"in_reply_to":"5afe65bd_29f55c82","updated":"2015-06-03 19:43:52.000000000","message":"Do you mean to refer to line 81 below? I think that\u0027s a pretty awful violation of OO principles.","commit_id":"3acca8050460aa4842de1869074e6ac6e6619263"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"c9e6d863355ebdd9fe904551f922dc5f78b1b696","unresolved":false,"context_lines":[{"line_number":69,"context_line":"                for device in devices]"},{"line_number":70,"context_line":""},{"line_number":71,"context_line":"    def create_security_group_rule(self, context, security_group_rule):"},{"line_number":72,"context_line":"        rule \u003d super(SecurityGroupServerRpcMixin,"},{"line_number":73,"context_line":"                     self).create_security_group_rule(context,"},{"line_number":74,"context_line":"                                                      security_group_rule)"},{"line_number":75,"context_line":"        sgids \u003d [rule[\u0027security_group_id\u0027]]"}],"source_content_type":"text/x-python","patch_set":3,"id":"5afe65bd_5a974548","line":72,"in_reply_to":"5afe65bd_570e003c","updated":"2015-06-03 15:09:36.000000000","message":"Currently in case of bulk rules creation by user, wsgi controller will use create_security_group_rule_bulk() [1] of SecurityGroupServerRpcMixin class, which in turn calls to parent\u0027s create_security_group_rule_bulk_native() [2]. Thus we really need notification there.\n\n[1] https://github.com/openstack/neutron/blob/master/neutron/api/v2/base.py#L441-L444\n[2] https://github.com/openstack/neutron/blob/master/neutron/db/securitygroups_rpc_base.py#L82","commit_id":"3acca8050460aa4842de1869074e6ac6e6619263"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"8711b404d85bc5d1f1cb99db88152849cdbe87f7","unresolved":false,"context_lines":[{"line_number":69,"context_line":"                for device in devices]"},{"line_number":70,"context_line":""},{"line_number":71,"context_line":"    def create_security_group_rule(self, context, security_group_rule):"},{"line_number":72,"context_line":"        rule \u003d super(SecurityGroupServerRpcMixin,"},{"line_number":73,"context_line":"                     self).create_security_group_rule(context,"},{"line_number":74,"context_line":"                                                      security_group_rule)"},{"line_number":75,"context_line":"        sgids \u003d [rule[\u0027security_group_id\u0027]]"}],"source_content_type":"text/x-python","patch_set":3,"id":"5afe65bd_8b0d6d39","line":72,"in_reply_to":"5afe65bd_5a974548","updated":"2015-06-03 16:46:35.000000000","message":"But eventually someone needs to call the single rule method?! In [1] I see that we call create_security_group_rule_bulk that in turns call _create_bulk that calls call create_security_group_rule. I must be missing something.\n\n[1] https://github.com/openstack/neutron/blob/master/neutron/api/v2/base.py#L444\n\noh boy what an utter mess!","commit_id":"3acca8050460aa4842de1869074e6ac6e6619263"},{"author":{"_account_id":11343,"name":"Gal Sagie","email":"gal.sagie@gmail.com","username":"GalSagie"},"change_message_id":"3c4c1879d5777ab629bd77351ecc20b6017e4c7a","unresolved":false,"context_lines":[{"line_number":69,"context_line":"                for device in devices]"},{"line_number":70,"context_line":""},{"line_number":71,"context_line":"    def create_security_group_rule(self, context, security_group_rule):"},{"line_number":72,"context_line":"        rule \u003d super(SecurityGroupServerRpcMixin,"},{"line_number":73,"context_line":"                     self).create_security_group_rule(context,"},{"line_number":74,"context_line":"                                                      security_group_rule)"},{"line_number":75,"context_line":"        sgids \u003d [rule[\u0027security_group_id\u0027]]"}],"source_content_type":"text/x-python","patch_set":3,"id":"5afe65bd_17e768b1","line":72,"in_reply_to":"5afe65bd_74721aaf","updated":"2015-06-03 14:54:30.000000000","message":"Hi Armando, i was confused by that as well, the problem is that both the base and the parent implement different API\u0027s for creating one rule and bulk rules and thats the base problem (the unified point is the method that Oleg added the notification in)\n\nI am not sure he can change it without breaking plugins backword compatability since the base class also have the bulk API","commit_id":"3acca8050460aa4842de1869074e6ac6e6619263"},{"author":{"_account_id":11343,"name":"Gal Sagie","email":"gal.sagie@gmail.com","username":"GalSagie"},"change_message_id":"a4788f3d4647991d2586e5f2b98d8afe9615ebd5","unresolved":false,"context_lines":[{"line_number":69,"context_line":"                for device in devices]"},{"line_number":70,"context_line":""},{"line_number":71,"context_line":"    def create_security_group_rule(self, context, security_group_rule):"},{"line_number":72,"context_line":"        rule \u003d super(SecurityGroupServerRpcMixin,"},{"line_number":73,"context_line":"                     self).create_security_group_rule(context,"},{"line_number":74,"context_line":"                                                      security_group_rule)"},{"line_number":75,"context_line":"        sgids \u003d [rule[\u0027security_group_id\u0027]]"}],"source_content_type":"text/x-python","patch_set":3,"id":"5afe65bd_29f55c82","line":72,"in_reply_to":"5afe65bd_8b0d6d39","updated":"2015-06-03 18:52:54.000000000","message":"If you look at SecurityGroupServerRpcMixin class, in the method create_security_group_rule_bulk\n\nThe problem is that this method calls create_security_group_rule_bulk_native directly instead of maybe calling the base (SecurityGroupDbMixin) create_security_group_rule_bulk method\n\nI think using that might solve this as it seems the base should be calling the single creates, however i assumed it was done that way for performance (doing the bulk inserts in the same transaction)\n\nHope i got that right..","commit_id":"3acca8050460aa4842de1869074e6ac6e6619263"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"62d92f32f6b8aabef60eb25338bec71b7c1a869e","unresolved":false,"context_lines":[{"line_number":79,"context_line":"    def create_security_group_rule_bulk(self, context,"},{"line_number":80,"context_line":"                                        security_group_rule):"},{"line_number":81,"context_line":"        rules \u003d super(SecurityGroupServerRpcMixin,"},{"line_number":82,"context_line":"                      self).create_security_group_rule_bulk_native("},{"line_number":83,"context_line":"                          context, security_group_rule)"},{"line_number":84,"context_line":"        sgids \u003d set([r[\u0027security_group_id\u0027] for r in rules])"},{"line_number":85,"context_line":"        self.notifier.security_groups_rule_updated(context, list(sgids))"}],"source_content_type":"text/x-python","patch_set":3,"id":"5afe65bd_9f93624f","line":82,"updated":"2015-06-03 19:43:52.000000000","message":"this should probably call a local _native than in turns calls its super. That\u0027s no way to make things polyform, yuk. If we did that, would it be enough to keep the notification in its original place?\n\nHaving said that I am still wrapping my head around why the code is so convoluted as it is, no wonder it\u0027s easy to makes these mistakes.","commit_id":"3acca8050460aa4842de1869074e6ac6e6619263"},{"author":{"_account_id":11343,"name":"Gal Sagie","email":"gal.sagie@gmail.com","username":"GalSagie"},"change_message_id":"84fb9c736825be950246175978312734d05a0890","unresolved":false,"context_lines":[{"line_number":79,"context_line":"    def create_security_group_rule_bulk(self, context,"},{"line_number":80,"context_line":"                                        security_group_rule):"},{"line_number":81,"context_line":"        rules \u003d super(SecurityGroupServerRpcMixin,"},{"line_number":82,"context_line":"                      self).create_security_group_rule_bulk_native("},{"line_number":83,"context_line":"                          context, security_group_rule)"},{"line_number":84,"context_line":"        sgids \u003d set([r[\u0027security_group_id\u0027] for r in rules])"},{"line_number":85,"context_line":"        self.notifier.security_groups_rule_updated(context, list(sgids))"}],"source_content_type":"text/x-python","patch_set":3,"id":"5afe65bd_89be7963","line":82,"in_reply_to":"5afe65bd_9f93624f","updated":"2015-06-04 09:37:06.000000000","message":"Yes, this is what i suggested above, this will solve this.\nHowever this will split the rules into separate db transactions (and i assumed this code was meant to be more \"efficient\")","commit_id":"3acca8050460aa4842de1869074e6ac6e6619263"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"278c7df1ca8a50ec0159ec6900828afc34c25e19","unresolved":false,"context_lines":[{"line_number":79,"context_line":"    def create_security_group_rule_bulk(self, context, security_group_rules):"},{"line_number":80,"context_line":"        rules \u003d super(SecurityGroupServerRpcMixin,"},{"line_number":81,"context_line":"                      self).create_security_group_rule_bulk("},{"line_number":82,"context_line":"                          context, security_group_rules)"},{"line_number":83,"context_line":"        sgids \u003d set([r[\u0027security_group_id\u0027] for r in rules])"},{"line_number":84,"context_line":"        self.notifier.security_groups_rule_updated(context, list(sgids))"},{"line_number":85,"context_line":"        return rules"}],"source_content_type":"text/x-python","patch_set":9,"id":"1af86dd1_09d55b42","line":82,"updated":"2015-06-12 10:07:46.000000000","message":"I believe here \"super\" works by chance, because of the way in which inheritance is implemented in python. Technically one should not be calling super, because this class is overriding create_security_group_rule_bulk.\n\nThe correct behaviour imho would be to install a callback, but perhaps that goes beyond the scope of your patch.\nPerhaps from here you can just call self._create_security_group_rule_bulk, and then notify the agent","commit_id":"eb471e73d233b06109f5e5ea2e016955c6d001f3"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"2df119e3f5cb3cb032a0dd91d2acfa1666670acc","unresolved":false,"context_lines":[{"line_number":79,"context_line":"    def create_security_group_rule_bulk(self, context, security_group_rules):"},{"line_number":80,"context_line":"        rules \u003d super(SecurityGroupServerRpcMixin,"},{"line_number":81,"context_line":"                      self).create_security_group_rule_bulk("},{"line_number":82,"context_line":"                          context, security_group_rules)"},{"line_number":83,"context_line":"        sgids \u003d set([r[\u0027security_group_id\u0027] for r in rules])"},{"line_number":84,"context_line":"        self.notifier.security_groups_rule_updated(context, list(sgids))"},{"line_number":85,"context_line":"        return rules"}],"source_content_type":"text/x-python","patch_set":9,"id":"fa32b979_2c18151d","line":82,"in_reply_to":"1af86dd1_09d55b42","updated":"2015-06-15 15:43:29.000000000","message":"Not sure I got your first point: isn\u0027t it quite common to call super() when overriding parent\u0027s methods in order to add some more functional?","commit_id":"eb471e73d233b06109f5e5ea2e016955c6d001f3"}],"neutron/tests/unit/db/test_securitygroups_db.py":[{"author":{"_account_id":6788,"name":"Rossella Sblendido","email":"rsblendido@suse.com","username":"rossella-o"},"change_message_id":"5ad44cd9f3311aa4d3b9cc7dcb41d510c4a97010","unresolved":false,"context_lines":[{"line_number":63,"context_line":""},{"line_number":64,"context_line":"    def test_create_security_group_rule_conflict(self):"},{"line_number":65,"context_line":"        with mock.patch.object(self.mixin,"},{"line_number":66,"context_line":"                               \u0027_validate_security_group_rules\u0027),\\"},{"line_number":67,"context_line":"                mock.patch.object(self.mixin, \u0027get_security_group\u0027),\\"},{"line_number":68,"context_line":"                mock.patch.object(self.mixin, \u0027_check_for_duplicate_rules\u0027),\\"},{"line_number":69,"context_line":"                mock.patch.object(registry, \"notify\") as mock_notify:"}],"source_content_type":"text/x-python","patch_set":3,"id":"5afe65bd_9d6ee02d","line":66,"updated":"2015-06-03 12:58:28.000000000","message":"remove the backslash?","commit_id":"3acca8050460aa4842de1869074e6ac6e6619263"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"3352e1c15d6ac34cb4aaffcac6a80838a8ac6179","unresolved":false,"context_lines":[{"line_number":63,"context_line":""},{"line_number":64,"context_line":"    def test_create_security_group_rule_conflict(self):"},{"line_number":65,"context_line":"        with mock.patch.object(self.mixin,"},{"line_number":66,"context_line":"                               \u0027_validate_security_group_rules\u0027),\\"},{"line_number":67,"context_line":"                mock.patch.object(self.mixin, \u0027get_security_group\u0027),\\"},{"line_number":68,"context_line":"                mock.patch.object(self.mixin, \u0027_check_for_duplicate_rules\u0027),\\"},{"line_number":69,"context_line":"                mock.patch.object(registry, \"notify\") as mock_notify:"}],"source_content_type":"text/x-python","patch_set":3,"id":"5afe65bd_f8bf225e","line":66,"in_reply_to":"5afe65bd_9d6ee02d","updated":"2015-06-03 13:15:41.000000000","message":"Well, it\u0027s needed actually..","commit_id":"3acca8050460aa4842de1869074e6ac6e6619263"}]}
