)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":8726,"name":"Victor Morales","email":"chipahuac@hotmail.com","username":"electrocucaracha"},"change_message_id":"539cf7501013682cd83064750c968b5cb79c3739","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Integration of DistributedPortBinding OVO"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"This patch will replace the use of DistributedPortBinding model"},{"line_number":10,"context_line":"with DistributedPortBinding OVO from objects/ports.py"},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"Partially-Implements: blueprint adopt-oslo-versioned-objects-for-db"},{"line_number":13,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":18,"id":"5a74a57a_b75132db","line":10,"range":{"start_line":9,"start_character":0,"end_line":10,"end_character":53},"updated":"2016-11-29 23:42:53.000000000","message":"Could you mention that are replacing some methods for using context instead of session as an argument?","commit_id":"118697fa60a332a53787dc0fad6989e3a58db245"},{"author":{"_account_id":22776,"name":"Nakul Dahiwade","email":"nakul.dahiwade@intel.com","username":"nakul.dahiwade"},"change_message_id":"9ff4e52de99f026ce19434a59086c7ee113ac533","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Integration of DistributedPortBinding OVO"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"This patch will replace the use of DistributedPortBinding model"},{"line_number":10,"context_line":"with DistributedPortBinding OVO from objects/ports.py"},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"Partially-Implements: blueprint adopt-oslo-versioned-objects-for-db"},{"line_number":13,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":18,"id":"5a74a57a_3f578203","line":10,"range":{"start_line":9,"start_character":0,"end_line":10,"end_character":53},"in_reply_to":"5a74a57a_b75132db","updated":"2016-11-30 21:23:51.000000000","message":"Done","commit_id":"118697fa60a332a53787dc0fad6989e3a58db245"},{"author":{"_account_id":8726,"name":"Victor Morales","email":"chipahuac@hotmail.com","username":"electrocucaracha"},"change_message_id":"3dcdd6bb64e7f1084eb02681dbcc400eb72cac50","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Integration of DistributedPortBinding OVO"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"This patch will replace the use of DistributedPortBinding model"},{"line_number":10,"context_line":"with DistributedPortBinding OVO from objects/ports.py."},{"line_number":11,"context_line":"It will also replace the use of session with context in some"},{"line_number":12,"context_line":"methods used for this integration."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":21,"id":"3a71b18c_03cdb1b6","line":9,"range":{"start_line":9,"start_character":11,"end_line":9,"end_character":23},"updated":"2016-12-05 21:01:45.000000000","message":"nit: s/will replace/replaces","commit_id":"24a727abf8c4cfa4d526cf8ff494803a3c7708d1"},{"author":{"_account_id":8726,"name":"Victor Morales","email":"chipahuac@hotmail.com","username":"electrocucaracha"},"change_message_id":"3dcdd6bb64e7f1084eb02681dbcc400eb72cac50","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Integration of DistributedPortBinding OVO"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"This patch will replace the use of DistributedPortBinding model"},{"line_number":10,"context_line":"with DistributedPortBinding OVO from objects/ports.py."},{"line_number":11,"context_line":"It will also replace the use of session with context in some"},{"line_number":12,"context_line":"methods used for this integration."},{"line_number":13,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":21,"id":"3a71b18c_63bca506","line":10,"range":{"start_line":10,"start_character":28,"end_line":10,"end_character":31},"updated":"2016-12-05 21:01:45.000000000","message":"nit: s/OVO/Oslo-Versioned Object","commit_id":"24a727abf8c4cfa4d526cf8ff494803a3c7708d1"},{"author":{"_account_id":8726,"name":"Victor Morales","email":"chipahuac@hotmail.com","username":"electrocucaracha"},"change_message_id":"3dcdd6bb64e7f1084eb02681dbcc400eb72cac50","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"This patch will replace the use of DistributedPortBinding model"},{"line_number":10,"context_line":"with DistributedPortBinding OVO from objects/ports.py."},{"line_number":11,"context_line":"It will also replace the use of session with context in some"},{"line_number":12,"context_line":"methods used for this integration."},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"Partially-Implements: blueprint adopt-oslo-versioned-objects-for-db"},{"line_number":15,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":21,"id":"3a71b18c_8350e1d5","line":12,"range":{"start_line":11,"start_character":0,"end_line":12,"end_character":34},"updated":"2016-12-05 21:01:45.000000000","message":"can you mention why this replacement is needed?","commit_id":"24a727abf8c4cfa4d526cf8ff494803a3c7708d1"}],"neutron/objects/ports.py":[{"author":{"_account_id":19594,"name":"Yarko Tymciurak","email":"yarko.tymciurak@intel.com","username":"yarkot"},"change_message_id":"d638dab70b7ae053e55bbb91c1ef413be074625e","unresolved":false,"context_lines":[{"line_number":66,"context_line":"            if not fields[\u0027vif_details\u0027]:"},{"line_number":67,"context_line":"                fields[\u0027vif_details\u0027] \u003d {}"},{"line_number":68,"context_line":"            else:"},{"line_number":69,"context_line":"                fields[\u0027vif_details\u0027] \u003d jsonutils.loads(fields[\u0027vif_details\u0027])"},{"line_number":70,"context_line":"        return fields"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":""}],"source_content_type":"text/x-python","patch_set":12,"id":"da6895a0_23976891","line":69,"updated":"2016-10-24 15:47:31.000000000","message":"the pythonic way to write this `if` statement is:\n\n    fields[\u0027vif_details\u0027] \u003d jsonutils.loads(fields.get(\u0027vif_details\u0027) or \"{}\")\n\nTo see this, you can write it less compactly as:\n\n    # *.get() will return default \"None\" if no vif_details in fields\n    #   \"{}\" will be used regardless of vif_details existing,\n    #   or merely being empty\n    s \u003d fields.get(\u0027vif_details\u0027) or \"{}\"\n    fields[\u0027vif_details\u0027] \u003d jsonutils.loads(s)","commit_id":"e347ef3ed62a1c3c5bc520851e91f00f9371c7ee"},{"author":{"_account_id":19594,"name":"Yarko Tymciurak","email":"yarko.tymciurak@intel.com","username":"yarkot"},"change_message_id":"ee363b5476ee3ddcb38aa670d403d02733371cc9","unresolved":false,"context_lines":[{"line_number":66,"context_line":"            if not fields[\u0027vif_details\u0027]:"},{"line_number":67,"context_line":"                fields[\u0027vif_details\u0027] \u003d {}"},{"line_number":68,"context_line":"            else:"},{"line_number":69,"context_line":"                fields[\u0027vif_details\u0027] \u003d jsonutils.loads(fields[\u0027vif_details\u0027])"},{"line_number":70,"context_line":"        return fields"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":""}],"source_content_type":"text/x-python","patch_set":12,"id":"da6895a0_0316e454","line":69,"in_reply_to":"da6895a0_23976891","updated":"2016-10-24 16:34:29.000000000","message":"Also, two additional notes:\n- elsewhere in neutron, notice that jsonutils.loads() defaults to \"[]\" rather than \"{}\", that is an empty python list, rather than empty python dict.  The reason is simplicity and size, as both are valid json results:\n\n    import sys\n    d \u003d {}\n    l \u003d []\n    sys.getsizeof(d)  # or sys.getsizeof(dict())\n    sys.getsizeof(l)   # of sys.getsizeof(list())\n\nAn empty dict is roughly 4 times the size of an empty list (you can imagine initialization is likewise more expensive).\n\nAlso, to my last comment / code suggestion, you can avoid the unnecessary call to jsonutils.loads() in this way (for example):\n\n    # if no \u0027vif_details\u0027, use empty list:\n    _s \u003d fields.get(\u0027vic_details\u0027, [])\n    fields[\u0027vif_details\u0027] \u003d jsonutils.loads(_s) if isinstance(_s, str) else _s\n\nHope that gives some insight.","commit_id":"e347ef3ed62a1c3c5bc520851e91f00f9371c7ee"},{"author":{"_account_id":19594,"name":"Yarko Tymciurak","email":"yarko.tymciurak@intel.com","username":"yarkot"},"change_message_id":"3bf8773abcaf3701f1ac4e5f0ab8c163456d5ba0","unresolved":false,"context_lines":[{"line_number":65,"context_line":"        if \u0027vif_details\u0027 in fields:"},{"line_number":66,"context_line":"            if fields[\u0027vif_details\u0027]:"},{"line_number":67,"context_line":"                fields[\u0027vif_details\u0027] \u003d jsonutils.loads(fields[\u0027vif_details\u0027])"},{"line_number":68,"context_line":"            if not fields[\u0027vif_details\u0027]:"},{"line_number":69,"context_line":"                fields[\u0027vif_details\u0027] \u003d {}"},{"line_number":70,"context_line":"        return fields"},{"line_number":71,"context_line":""}],"source_content_type":"text/x-python","patch_set":15,"id":"ba5da102_85af932a","line":68,"updated":"2016-11-04 18:45:05.000000000","message":"you don\u0027t need to look-up fields, nor run a second test (`if`) here -\n\njust use \"else\"\n\nBut, as I\u0027ve commented previously,  a single line conditional assignment.\n\nAs it is, you\u0027re doing either 3 or 4 dictionary lookups in this code path, which you could take down to 2 dictionary lookups:\n\n    if \u0027vif_fields\u0027 in fields:\n        val \u003d fields[\u0027vif_fields\u0027]\n        fields[\u0027vif_fields\u0027] \u003d jsonutils.loads(val) if val else {}","commit_id":"29a1bcf49c65ba434be7eda218375194f115f35d"},{"author":{"_account_id":22776,"name":"Nakul Dahiwade","email":"nakul.dahiwade@intel.com","username":"nakul.dahiwade"},"change_message_id":"2c01e62f67b45cdaf085091e0b7401562269fe9d","unresolved":false,"context_lines":[{"line_number":65,"context_line":"        if \u0027vif_details\u0027 in fields:"},{"line_number":66,"context_line":"            if fields[\u0027vif_details\u0027]:"},{"line_number":67,"context_line":"                fields[\u0027vif_details\u0027] \u003d jsonutils.loads(fields[\u0027vif_details\u0027])"},{"line_number":68,"context_line":"            if not fields[\u0027vif_details\u0027]:"},{"line_number":69,"context_line":"                fields[\u0027vif_details\u0027] \u003d {}"},{"line_number":70,"context_line":"        return fields"},{"line_number":71,"context_line":""}],"source_content_type":"text/x-python","patch_set":15,"id":"ba5da102_20beb5d4","line":68,"in_reply_to":"ba5da102_85af932a","updated":"2016-11-04 18:59:27.000000000","message":"Done","commit_id":"29a1bcf49c65ba434be7eda218375194f115f35d"},{"author":{"_account_id":15518,"name":"Artur Korzeniewski","email":"artur.korzen@wp.pl","username":"akorzeni"},"change_message_id":"56679b7265fabd875ccbca963efb941f7424e438","unresolved":false,"context_lines":[{"line_number":63,"context_line":"    def modify_fields_from_db(cls, db_obj):"},{"line_number":64,"context_line":"        fields \u003d super(PortBindingBase, cls).modify_fields_from_db(db_obj)"},{"line_number":65,"context_line":"        if \u0027vif_details\u0027 in fields:"},{"line_number":66,"context_line":"            if fields[\u0027vif_details\u0027]:"},{"line_number":67,"context_line":"                val \u003d fields[\u0027vif_details\u0027]"},{"line_number":68,"context_line":"                fields[\u0027vif_details\u0027] \u003d jsonutils.loads(val) if val else {}"},{"line_number":69,"context_line":"        return fields"},{"line_number":70,"context_line":""},{"line_number":71,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"9a629dbe_e08218c8","line":68,"range":{"start_line":66,"start_character":12,"end_line":68,"end_character":75},"updated":"2016-11-07 11:25:57.000000000","message":"Why are you changing this lines? This is failing UT. The desired behavior is when you have vif_details\u003d\u0027\u0027 then the field should be set to None. Patch covering it:\nhttps://review.openstack.org/#/c/392960","commit_id":"fd7e77abd54e409577ae8725ab6045616ca22cc2"},{"author":{"_account_id":22776,"name":"Nakul Dahiwade","email":"nakul.dahiwade@intel.com","username":"nakul.dahiwade"},"change_message_id":"4f288774afde24e090a328bdd00a79c3e1349927","unresolved":false,"context_lines":[{"line_number":63,"context_line":"    def modify_fields_from_db(cls, db_obj):"},{"line_number":64,"context_line":"        fields \u003d super(PortBindingBase, cls).modify_fields_from_db(db_obj)"},{"line_number":65,"context_line":"        if \u0027vif_details\u0027 in fields:"},{"line_number":66,"context_line":"            if fields[\u0027vif_details\u0027]:"},{"line_number":67,"context_line":"                val \u003d fields[\u0027vif_details\u0027]"},{"line_number":68,"context_line":"                fields[\u0027vif_details\u0027] \u003d jsonutils.loads(val) if val else {}"},{"line_number":69,"context_line":"        return fields"},{"line_number":70,"context_line":""},{"line_number":71,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"9a629dbe_7c7cd172","line":68,"range":{"start_line":66,"start_character":12,"end_line":68,"end_character":75},"in_reply_to":"9a629dbe_e08218c8","updated":"2016-11-07 21:11:21.000000000","message":"I had changed this to empty dict because I was getting this error : http://paste.openstack.org/show/588316/\n\nIt is changed now,but still getting the error.","commit_id":"fd7e77abd54e409577ae8725ab6045616ca22cc2"},{"author":{"_account_id":15518,"name":"Artur Korzeniewski","email":"artur.korzen@wp.pl","username":"akorzeni"},"change_message_id":"56679b7265fabd875ccbca963efb941f7424e438","unresolved":false,"context_lines":[{"line_number":76,"context_line":""},{"line_number":77,"context_line":"    db_model \u003d ml2_models.PortBinding"},{"line_number":78,"context_line":""},{"line_number":79,"context_line":"    primary_keys \u003d [\u0027port_id\u0027]"},{"line_number":80,"context_line":""},{"line_number":81,"context_line":"    fields \u003d {"},{"line_number":82,"context_line":"        \u0027port_id\u0027: obj_fields.UUIDField(),"}],"source_content_type":"text/x-python","patch_set":16,"id":"9a629dbe_f1fd886f","line":79,"range":{"start_line":79,"start_character":4,"end_line":79,"end_character":30},"updated":"2016-11-07 11:25:57.000000000","message":"This change is not relevant to this PS.","commit_id":"fd7e77abd54e409577ae8725ab6045616ca22cc2"},{"author":{"_account_id":22776,"name":"Nakul Dahiwade","email":"nakul.dahiwade@intel.com","username":"nakul.dahiwade"},"change_message_id":"4f288774afde24e090a328bdd00a79c3e1349927","unresolved":false,"context_lines":[{"line_number":76,"context_line":""},{"line_number":77,"context_line":"    db_model \u003d ml2_models.PortBinding"},{"line_number":78,"context_line":""},{"line_number":79,"context_line":"    primary_keys \u003d [\u0027port_id\u0027]"},{"line_number":80,"context_line":""},{"line_number":81,"context_line":"    fields \u003d {"},{"line_number":82,"context_line":"        \u0027port_id\u0027: obj_fields.UUIDField(),"}],"source_content_type":"text/x-python","patch_set":16,"id":"9a629dbe_9c81a54d","line":79,"range":{"start_line":79,"start_character":4,"end_line":79,"end_character":30},"in_reply_to":"9a629dbe_f1fd886f","updated":"2016-11-07 21:11:21.000000000","message":"Done","commit_id":"fd7e77abd54e409577ae8725ab6045616ca22cc2"},{"author":{"_account_id":15518,"name":"Artur Korzeniewski","email":"artur.korzen@wp.pl","username":"akorzeni"},"change_message_id":"56679b7265fabd875ccbca963efb941f7424e438","unresolved":false,"context_lines":[{"line_number":83,"context_line":"        \u0027host\u0027: obj_fields.StringField(),"},{"line_number":84,"context_line":"        \u0027profile\u0027: obj_fields.StringField(),"},{"line_number":85,"context_line":"        \u0027vif_type\u0027: obj_fields.StringField(),"},{"line_number":86,"context_line":"        \u0027vif_details\u0027: obj_fields.DictOfStringsField(),"},{"line_number":87,"context_line":"        \u0027vnic_type\u0027: obj_fields.StringField(),"},{"line_number":88,"context_line":"    }"},{"line_number":89,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"9a629dbe_cc9f0bb3","line":86,"updated":"2016-11-07 11:25:57.000000000","message":"I\u0027m wondering if this should required. If you do not pass vif_details, then SQL model will insert \u0027\u0027 (empty string). The requirement is that when empty string is in DB, then vif_details should be set to None.\nSo \u0027vif_details\u0027 should remain nullable\u003dTrue.","commit_id":"fd7e77abd54e409577ae8725ab6045616ca22cc2"},{"author":{"_account_id":22776,"name":"Nakul Dahiwade","email":"nakul.dahiwade@intel.com","username":"nakul.dahiwade"},"change_message_id":"4f288774afde24e090a328bdd00a79c3e1349927","unresolved":false,"context_lines":[{"line_number":83,"context_line":"        \u0027host\u0027: obj_fields.StringField(),"},{"line_number":84,"context_line":"        \u0027profile\u0027: obj_fields.StringField(),"},{"line_number":85,"context_line":"        \u0027vif_type\u0027: obj_fields.StringField(),"},{"line_number":86,"context_line":"        \u0027vif_details\u0027: obj_fields.DictOfStringsField(),"},{"line_number":87,"context_line":"        \u0027vnic_type\u0027: obj_fields.StringField(),"},{"line_number":88,"context_line":"    }"},{"line_number":89,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"9a629dbe_7c41310b","line":86,"in_reply_to":"9a629dbe_cc9f0bb3","updated":"2016-11-07 21:11:21.000000000","message":"The model has nullable\u003dFalse,thats why I had changed that: https://github.com/openstack/neutron/blob/master/neutron/plugins/ml2/models.py#L48-Lundefined\n\nIt is changed now.","commit_id":"fd7e77abd54e409577ae8725ab6045616ca22cc2"},{"author":{"_account_id":15518,"name":"Artur Korzeniewski","email":"artur.korzen@wp.pl","username":"akorzeni"},"change_message_id":"56679b7265fabd875ccbca963efb941f7424e438","unresolved":false,"context_lines":[{"line_number":100,"context_line":"        \u0027host\u0027: obj_fields.StringField(),"},{"line_number":101,"context_line":"        \u0027profile\u0027: obj_fields.StringField(),"},{"line_number":102,"context_line":"        \u0027vif_type\u0027: obj_fields.StringField(),"},{"line_number":103,"context_line":"        \u0027vif_details\u0027: obj_fields.DictOfStringsField(),"},{"line_number":104,"context_line":"        \u0027vnic_type\u0027: obj_fields.StringField(),"},{"line_number":105,"context_line":"        # NOTE(ihrachys): Fields below are specific to this type of binding. In"},{"line_number":106,"context_line":"        # the future, we could think of converging different types of bindings"}],"source_content_type":"text/x-python","patch_set":16,"id":"9a629dbe_0caae3d4","line":103,"updated":"2016-11-07 11:25:57.000000000","message":"The same line 86.","commit_id":"fd7e77abd54e409577ae8725ab6045616ca22cc2"},{"author":{"_account_id":22776,"name":"Nakul Dahiwade","email":"nakul.dahiwade@intel.com","username":"nakul.dahiwade"},"change_message_id":"4f288774afde24e090a328bdd00a79c3e1349927","unresolved":false,"context_lines":[{"line_number":100,"context_line":"        \u0027host\u0027: obj_fields.StringField(),"},{"line_number":101,"context_line":"        \u0027profile\u0027: obj_fields.StringField(),"},{"line_number":102,"context_line":"        \u0027vif_type\u0027: obj_fields.StringField(),"},{"line_number":103,"context_line":"        \u0027vif_details\u0027: obj_fields.DictOfStringsField(),"},{"line_number":104,"context_line":"        \u0027vnic_type\u0027: obj_fields.StringField(),"},{"line_number":105,"context_line":"        # NOTE(ihrachys): Fields below are specific to this type of binding. In"},{"line_number":106,"context_line":"        # the future, we could think of converging different types of bindings"}],"source_content_type":"text/x-python","patch_set":16,"id":"9a629dbe_1c0115af","line":103,"in_reply_to":"9a629dbe_0caae3d4","updated":"2016-11-07 21:11:21.000000000","message":"The model has nullable\u003dFalse,thats why I had changed that:\nhttps://github.com/openstack/neutron/blob/master/neutron/plugins/ml2/models.py#L104\n\nIt is changed now.","commit_id":"fd7e77abd54e409577ae8725ab6045616ca22cc2"},{"author":{"_account_id":8726,"name":"Victor Morales","email":"chipahuac@hotmail.com","username":"electrocucaracha"},"change_message_id":"3dcdd6bb64e7f1084eb02681dbcc400eb72cac50","unresolved":false,"context_lines":[{"line_number":40,"context_line":"        vif_details \u003d fields[\u0027vif_details\u0027]"},{"line_number":41,"context_line":"        if vif_details:"},{"line_number":42,"context_line":"            vif_details \u003d jsonutils.loads(vif_details)"},{"line_number":43,"context_line":"        if not vif_details:"},{"line_number":44,"context_line":"            vif_details \u003d None"},{"line_number":45,"context_line":"        return vif_details"},{"line_number":46,"context_line":""},{"line_number":47,"context_line":"    @classmethod"}],"source_content_type":"text/x-python","patch_set":21,"id":"3a71b18c_c38e592d","line":44,"range":{"start_line":43,"start_character":0,"end_line":44,"end_character":30},"updated":"2016-12-05 21:01:45.000000000","message":"this only makes sense inside the previous if block statement.","commit_id":"24a727abf8c4cfa4d526cf8ff494803a3c7708d1"},{"author":{"_account_id":15518,"name":"Artur Korzeniewski","email":"artur.korzen@wp.pl","username":"akorzeni"},"change_message_id":"2ee1b0486a84dfc9185d611bc1bedba6deb09c60","unresolved":false,"context_lines":[{"line_number":40,"context_line":"        vif_details \u003d fields[\u0027vif_details\u0027]"},{"line_number":41,"context_line":"        if vif_details:"},{"line_number":42,"context_line":"            vif_details \u003d jsonutils.loads(vif_details)"},{"line_number":43,"context_line":"        if not vif_details:"},{"line_number":44,"context_line":"            vif_details \u003d None"},{"line_number":45,"context_line":"        return vif_details"},{"line_number":46,"context_line":""},{"line_number":47,"context_line":"    @classmethod"}],"source_content_type":"text/x-python","patch_set":21,"id":"3a71b18c_f3f71cf3","line":44,"range":{"start_line":43,"start_character":0,"end_line":44,"end_character":30},"in_reply_to":"3a71b18c_c38e592d","updated":"2016-12-08 10:21:00.000000000","message":"Not exactly, it is checking if vif_details is not empty string, or empty dict \u0027{}\u0027.","commit_id":"24a727abf8c4cfa4d526cf8ff494803a3c7708d1"},{"author":{"_account_id":19594,"name":"Yarko Tymciurak","email":"yarko.tymciurak@intel.com","username":"yarkot"},"change_message_id":"76578c1d91c68dffd45b060e245948172299824d","unresolved":false,"context_lines":[{"line_number":40,"context_line":"        vif_details \u003d fields[\u0027vif_details\u0027]"},{"line_number":41,"context_line":"        if vif_details:"},{"line_number":42,"context_line":"            vif_details \u003d jsonutils.loads(vif_details)"},{"line_number":43,"context_line":"        if not vif_details:"},{"line_number":44,"context_line":"            vif_details \u003d None"},{"line_number":45,"context_line":"        return vif_details"},{"line_number":46,"context_line":""},{"line_number":47,"context_line":"    @classmethod"}],"source_content_type":"text/x-python","patch_set":21,"id":"3a71b18c_e2173a52","line":44,"range":{"start_line":43,"start_character":0,"end_line":44,"end_character":30},"in_reply_to":"3a71b18c_f3f71cf3","updated":"2016-12-08 15:51:46.000000000","message":"Perhaps something like this would be both more concise, and more readable in terms of intent:\n\n    vif_details \u003d fields[\u0027vif_details\u0027] or None\n    if vif_details:\n            vif_details \u003d jsonutils.loads(vif_details)\n\nalternatively:\n\n    vif_details \u003d fields[\u0027vif_details\u0027]\n    return jsonutils.loads(vif_details) if vif_details or None\n\nI prefer the former - it leaves it simpler for later modifications / error handling, etc.\n\nBut both are much clearer, in reading, on their intent.\nScattering intent over too many lines seems to obfuscate, separate intent.","commit_id":"24a727abf8c4cfa4d526cf8ff494803a3c7708d1"},{"author":{"_account_id":8726,"name":"Victor Morales","email":"chipahuac@hotmail.com","username":"electrocucaracha"},"change_message_id":"3dcdd6bb64e7f1084eb02681dbcc400eb72cac50","unresolved":false,"context_lines":[{"line_number":106,"context_line":"    # where port_id is a substring of other port_ids. For eg. in methods like"},{"line_number":107,"context_line":"    # get_distributed_port_bindings and get_distributed_port_bindings_by_host"},{"line_number":108,"context_line":"    @classmethod"},{"line_number":109,"context_line":"    def get_objects_portid_startswith(cls, context, port_id, host\u003dNone):"},{"line_number":110,"context_line":"        bindings \u003d (context.session.query(ml2_models.DistributedPortBinding)."},{"line_number":111,"context_line":"            filter(ml2_models.DistributedPortBinding.port_id.startswith("},{"line_number":112,"context_line":"                port_id)))"}],"source_content_type":"text/x-python","patch_set":21,"id":"3a71b18c_c3a739bb","line":109,"range":{"start_line":109,"start_character":8,"end_line":109,"end_character":37},"updated":"2016-12-05 21:01:45.000000000","message":"nit: s/get_objects_portid_startswith/get_ids_startswith","commit_id":"24a727abf8c4cfa4d526cf8ff494803a3c7708d1"},{"author":{"_account_id":8726,"name":"Victor Morales","email":"chipahuac@hotmail.com","username":"electrocucaracha"},"change_message_id":"3dcdd6bb64e7f1084eb02681dbcc400eb72cac50","unresolved":false,"context_lines":[{"line_number":106,"context_line":"    # where port_id is a substring of other port_ids. For eg. in methods like"},{"line_number":107,"context_line":"    # get_distributed_port_bindings and get_distributed_port_bindings_by_host"},{"line_number":108,"context_line":"    @classmethod"},{"line_number":109,"context_line":"    def get_objects_portid_startswith(cls, context, port_id, host\u003dNone):"},{"line_number":110,"context_line":"        bindings \u003d (context.session.query(ml2_models.DistributedPortBinding)."},{"line_number":111,"context_line":"            filter(ml2_models.DistributedPortBinding.port_id.startswith("},{"line_number":112,"context_line":"                port_id)))"}],"source_content_type":"text/x-python","patch_set":21,"id":"3a71b18c_e3b19502","line":109,"range":{"start_line":109,"start_character":52,"end_line":109,"end_character":59},"updated":"2016-12-05 21:01:45.000000000","message":"nit: s/port_id/prefix_port_id maybe...","commit_id":"24a727abf8c4cfa4d526cf8ff494803a3c7708d1"}],"neutron/plugins/ml2/db.py":[{"author":{"_account_id":15518,"name":"Artur Korzeniewski","email":"artur.korzen@wp.pl","username":"akorzeni"},"change_message_id":"56679b7265fabd875ccbca963efb941f7424e438","unresolved":false,"context_lines":[{"line_number":137,"context_line":""},{"line_number":138,"context_line":""},{"line_number":139,"context_line":"def ensure_distributed_port_binding(context, port_id, host, router_id\u003dNone):"},{"line_number":140,"context_line":"    record_obj \u003d next((i for i in ports.DistributedPortBinding.get_objects("},{"line_number":141,"context_line":"        context, port_id\u003dport_id, host\u003dhost)), None)"},{"line_number":142,"context_line":"    if record_obj:"},{"line_number":143,"context_line":"        return record_obj"},{"line_number":144,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"9a629dbe_6bdb491c","line":141,"range":{"start_line":140,"start_character":17,"end_line":141,"end_character":52},"updated":"2016-11-07 11:25:57.000000000","message":"I do not get it.\nyou can simply do:\n\nrecord_obj \u003d ports.DistrubutedPortBinding.get_object(context, port_id\u003dport_id, host\u003dhost)\n\nWhy there is this \u0027next\u0027?","commit_id":"fd7e77abd54e409577ae8725ab6045616ca22cc2"},{"author":{"_account_id":22776,"name":"Nakul Dahiwade","email":"nakul.dahiwade@intel.com","username":"nakul.dahiwade"},"change_message_id":"4f288774afde24e090a328bdd00a79c3e1349927","unresolved":false,"context_lines":[{"line_number":137,"context_line":""},{"line_number":138,"context_line":""},{"line_number":139,"context_line":"def ensure_distributed_port_binding(context, port_id, host, router_id\u003dNone):"},{"line_number":140,"context_line":"    record_obj \u003d next((i for i in ports.DistributedPortBinding.get_objects("},{"line_number":141,"context_line":"        context, port_id\u003dport_id, host\u003dhost)), None)"},{"line_number":142,"context_line":"    if record_obj:"},{"line_number":143,"context_line":"        return record_obj"},{"line_number":144,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"9a629dbe_1c18351d","line":141,"range":{"start_line":140,"start_character":17,"end_line":141,"end_character":52},"in_reply_to":"9a629dbe_6bdb491c","updated":"2016-11-07 21:11:21.000000000","message":"Done","commit_id":"fd7e77abd54e409577ae8725ab6045616ca22cc2"},{"author":{"_account_id":15518,"name":"Artur Korzeniewski","email":"artur.korzen@wp.pl","username":"akorzeni"},"change_message_id":"56679b7265fabd875ccbca963efb941f7424e438","unresolved":false,"context_lines":[{"line_number":291,"context_line":"    output \u003d []"},{"line_number":292,"context_line":"    obj \u003d None"},{"line_number":293,"context_line":"    for obj in temp_binding_objs:"},{"line_number":294,"context_line":"        if obj.port_id.startswith(port_id):"},{"line_number":295,"context_line":"            break"},{"line_number":296,"context_line":"    output.append(obj)"},{"line_number":297,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"9a629dbe_919c4c6b","line":294,"range":{"start_line":294,"start_character":23,"end_line":294,"end_character":33},"updated":"2016-11-07 11:25:57.000000000","message":"I wonder why this is startswith but not equal. Can port_id be a substring of database port_id?\n\nFor me, lines 289-298 should be rewritten to:\nbinding \u003d ports.DistributedPortBinding.get_object(context, port_id\u003dport_id, host\u003dhost)","commit_id":"fd7e77abd54e409577ae8725ab6045616ca22cc2"},{"author":{"_account_id":22776,"name":"Nakul Dahiwade","email":"nakul.dahiwade@intel.com","username":"nakul.dahiwade"},"change_message_id":"4f288774afde24e090a328bdd00a79c3e1349927","unresolved":false,"context_lines":[{"line_number":291,"context_line":"    output \u003d []"},{"line_number":292,"context_line":"    obj \u003d None"},{"line_number":293,"context_line":"    for obj in temp_binding_objs:"},{"line_number":294,"context_line":"        if obj.port_id.startswith(port_id):"},{"line_number":295,"context_line":"            break"},{"line_number":296,"context_line":"    output.append(obj)"},{"line_number":297,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"9a629dbe_7cddb141","line":294,"range":{"start_line":294,"start_character":23,"end_line":294,"end_character":33},"in_reply_to":"9a629dbe_919c4c6b","updated":"2016-11-07 21:11:21.000000000","message":"Done","commit_id":"fd7e77abd54e409577ae8725ab6045616ca22cc2"},{"author":{"_account_id":15518,"name":"Artur Korzeniewski","email":"artur.korzen@wp.pl","username":"akorzeni"},"change_message_id":"56679b7265fabd875ccbca963efb941f7424e438","unresolved":false,"context_lines":[{"line_number":307,"context_line":"    binding_objs \u003d ports.DistributedPortBinding.get_objects(context)"},{"line_number":308,"context_line":"    bindings \u003d []"},{"line_number":309,"context_line":"    for obj in binding_objs:"},{"line_number":310,"context_line":"        if obj.port_id.startswith(port_id):"},{"line_number":311,"context_line":"            bindings.append(obj)"},{"line_number":312,"context_line":""},{"line_number":313,"context_line":"    if not bindings:"}],"source_content_type":"text/x-python","patch_set":16,"id":"9a629dbe_91aa8c6f","line":310,"range":{"start_line":310,"start_character":22,"end_line":310,"end_character":33},"updated":"2016-11-07 11:25:57.000000000","message":"Again, if startswith is not a requirement, we can do lines 307-311 using simple get_objects.","commit_id":"fd7e77abd54e409577ae8725ab6045616ca22cc2"},{"author":{"_account_id":15518,"name":"Artur Korzeniewski","email":"artur.korzen@wp.pl","username":"akorzeni"},"change_message_id":"34d9a147b09603014f68a51ba26f798968a45e9e","unresolved":false,"context_lines":[{"line_number":307,"context_line":"    binding_objs \u003d ports.DistributedPortBinding.get_objects(context)"},{"line_number":308,"context_line":"    bindings \u003d []"},{"line_number":309,"context_line":"    for obj in binding_objs:"},{"line_number":310,"context_line":"        if obj.port_id.startswith(port_id):"},{"line_number":311,"context_line":"            bindings.append(obj)"},{"line_number":312,"context_line":""},{"line_number":313,"context_line":"    if not bindings:"}],"source_content_type":"text/x-python","patch_set":16,"id":"5a74a57a_a1670c24","line":310,"range":{"start_line":310,"start_character":22,"end_line":310,"end_character":33},"in_reply_to":"5a74a57a_0c30199e","updated":"2016-11-30 14:54:13.000000000","message":"Hmm if port_id is UUID, then the UT is wrongly implemented. Is it possible to pass only part of the UUID and expect to correlate something by the UUID part?\n\nOk, so if the startswith is a hard requirement, then we can create class method in DistributedPortBinding something like:\n\n    @classmethod\n    get_objects_portid_startswith(context, port_id, host\u003dNone)\n        bindings \u003d (session.query(models.DistributedPortBinding).\n                    filter(models.DistributedPortBinding.port_id.startswith(\n                           port_id)))\n        if host:\n            binding.filter(models.DistributedPortBinding.host \u003d\u003d host)\n        return [self._load_object(context, binding) for binding in bindings.all()]\n\nThe above can handle get_distributed_port_bindings and get_distributed_port_bindings_by_host use cases.","commit_id":"fd7e77abd54e409577ae8725ab6045616ca22cc2"},{"author":{"_account_id":22776,"name":"Nakul Dahiwade","email":"nakul.dahiwade@intel.com","username":"nakul.dahiwade"},"change_message_id":"6f7279259821acecbd1f768c2c559f5004cba4f9","unresolved":false,"context_lines":[{"line_number":307,"context_line":"    binding_objs \u003d ports.DistributedPortBinding.get_objects(context)"},{"line_number":308,"context_line":"    bindings \u003d []"},{"line_number":309,"context_line":"    for obj in binding_objs:"},{"line_number":310,"context_line":"        if obj.port_id.startswith(port_id):"},{"line_number":311,"context_line":"            bindings.append(obj)"},{"line_number":312,"context_line":""},{"line_number":313,"context_line":"    if not bindings:"}],"source_content_type":"text/x-python","patch_set":16,"id":"5a74a57a_3f0f82e2","line":310,"range":{"start_line":310,"start_character":22,"end_line":310,"end_character":33},"in_reply_to":"5a74a57a_a1670c24","updated":"2016-11-30 21:24:30.000000000","message":"Done","commit_id":"fd7e77abd54e409577ae8725ab6045616ca22cc2"},{"author":{"_account_id":22776,"name":"Nakul Dahiwade","email":"nakul.dahiwade@intel.com","username":"nakul.dahiwade"},"change_message_id":"4f288774afde24e090a328bdd00a79c3e1349927","unresolved":false,"context_lines":[{"line_number":307,"context_line":"    binding_objs \u003d ports.DistributedPortBinding.get_objects(context)"},{"line_number":308,"context_line":"    bindings \u003d []"},{"line_number":309,"context_line":"    for obj in binding_objs:"},{"line_number":310,"context_line":"        if obj.port_id.startswith(port_id):"},{"line_number":311,"context_line":"            bindings.append(obj)"},{"line_number":312,"context_line":""},{"line_number":313,"context_line":"    if not bindings:"}],"source_content_type":"text/x-python","patch_set":16,"id":"9a629dbe_9ce28502","line":310,"range":{"start_line":310,"start_character":22,"end_line":310,"end_character":33},"in_reply_to":"9a629dbe_91aa8c6f","updated":"2016-11-07 21:11:21.000000000","message":"Done","commit_id":"fd7e77abd54e409577ae8725ab6045616ca22cc2"},{"author":{"_account_id":22776,"name":"Nakul Dahiwade","email":"nakul.dahiwade@intel.com","username":"nakul.dahiwade"},"change_message_id":"e4690cca53bbb53376379d97bd1fc98bc703d34e","unresolved":false,"context_lines":[{"line_number":307,"context_line":"    binding_objs \u003d ports.DistributedPortBinding.get_objects(context)"},{"line_number":308,"context_line":"    bindings \u003d []"},{"line_number":309,"context_line":"    for obj in binding_objs:"},{"line_number":310,"context_line":"        if obj.port_id.startswith(port_id):"},{"line_number":311,"context_line":"            bindings.append(obj)"},{"line_number":312,"context_line":""},{"line_number":313,"context_line":"    if not bindings:"}],"source_content_type":"text/x-python","patch_set":16,"id":"5a74a57a_0c30199e","line":310,"range":{"start_line":310,"start_character":22,"end_line":310,"end_character":33},"in_reply_to":"9a629dbe_91aa8c6f","updated":"2016-11-29 23:19:25.000000000","message":"Reverted to using starstwith as the port_id here is a substring of two port ids.\nSee:https://github.com/openstack/neutron/blob/master/neutron/tests/unit/plugins/ml2/test_db.py#L379-L388","commit_id":"fd7e77abd54e409577ae8725ab6045616ca22cc2"},{"author":{"_account_id":20246,"name":"Aradhana Singh","email":"aradhanamailbox@gmail.com","username":"asingh"},"change_message_id":"763536c68778ae4722e31c8257df85bcb7fbbfae","unresolved":false,"context_lines":[{"line_number":137,"context_line":""},{"line_number":138,"context_line":""},{"line_number":139,"context_line":"def ensure_distributed_port_binding(context, port_id, host, router_id\u003dNone):"},{"line_number":140,"context_line":"    record_obj \u003d ports.DistributedPortBinding.get_object(context,"},{"line_number":141,"context_line":"                                                         port_id\u003dport_id,"},{"line_number":142,"context_line":"                                                         host\u003dhost)"},{"line_number":143,"context_line":"    if record_obj:"},{"line_number":144,"context_line":"        return record_obj"},{"line_number":145,"context_line":""}],"source_content_type":"text/x-python","patch_set":17,"id":"7a77a97e_04a522b4","line":142,"range":{"start_line":140,"start_character":1,"end_line":142,"end_character":67},"updated":"2016-11-16 00:02:14.000000000","message":"record_obj \u003d ports.DistributedPortBinding.get_object(context,\n        port_id\u003dport_id, host\u003dhost)","commit_id":"22553a3bfce336165287b6b825f65828124decd7"},{"author":{"_account_id":22776,"name":"Nakul Dahiwade","email":"nakul.dahiwade@intel.com","username":"nakul.dahiwade"},"change_message_id":"9cbe12fd29be13bdf9ed316932b45f442805b5f8","unresolved":false,"context_lines":[{"line_number":137,"context_line":""},{"line_number":138,"context_line":""},{"line_number":139,"context_line":"def ensure_distributed_port_binding(context, port_id, host, router_id\u003dNone):"},{"line_number":140,"context_line":"    record_obj \u003d ports.DistributedPortBinding.get_object(context,"},{"line_number":141,"context_line":"                                                         port_id\u003dport_id,"},{"line_number":142,"context_line":"                                                         host\u003dhost)"},{"line_number":143,"context_line":"    if record_obj:"},{"line_number":144,"context_line":"        return record_obj"},{"line_number":145,"context_line":""}],"source_content_type":"text/x-python","patch_set":17,"id":"5a74a57a_8cc0a97e","line":142,"range":{"start_line":140,"start_character":1,"end_line":142,"end_character":67},"in_reply_to":"7a77a97e_04a522b4","updated":"2016-11-29 23:19:02.000000000","message":"This was reverted to using next as get_object wasn\u0027t able to fetch the object,may be router_id needed(not sure), which was resulting in empty list in test_ensure_distributed_port_binding_deals_with_db_duplicate leading to an error.","commit_id":"22553a3bfce336165287b6b825f65828124decd7"},{"author":{"_account_id":20246,"name":"Aradhana Singh","email":"aradhanamailbox@gmail.com","username":"asingh"},"change_message_id":"763536c68778ae4722e31c8257df85bcb7fbbfae","unresolved":false,"context_lines":[{"line_number":155,"context_line":"        return record_obj"},{"line_number":156,"context_line":"    except base.NeutronDbObjectDuplicateEntry:"},{"line_number":157,"context_line":"        LOG.debug(\"Distributed Port %s already bound\", port_id)"},{"line_number":158,"context_line":"        query_obj \u003d ports.DistributedPortBinding.get_object("},{"line_number":159,"context_line":"            context, port_id\u003dport_id, host\u003dhost)"},{"line_number":160,"context_line":"        return query_obj"},{"line_number":161,"context_line":""},{"line_number":162,"context_line":""},{"line_number":163,"context_line":"def delete_distributed_port_binding_if_stale(session, binding):"}],"source_content_type":"text/x-python","patch_set":17,"id":"7a77a97e_997c4274","line":160,"range":{"start_line":158,"start_character":0,"end_line":160,"end_character":24},"updated":"2016-11-16 00:02:14.000000000","message":"query_obj can be removed        \nreturn ports.DistributedPortBinding.get_object(\n            context, port_id\u003dport_id, host\u003dhost)","commit_id":"22553a3bfce336165287b6b825f65828124decd7"},{"author":{"_account_id":22776,"name":"Nakul Dahiwade","email":"nakul.dahiwade@intel.com","username":"nakul.dahiwade"},"change_message_id":"9cbe12fd29be13bdf9ed316932b45f442805b5f8","unresolved":false,"context_lines":[{"line_number":155,"context_line":"        return record_obj"},{"line_number":156,"context_line":"    except base.NeutronDbObjectDuplicateEntry:"},{"line_number":157,"context_line":"        LOG.debug(\"Distributed Port %s already bound\", port_id)"},{"line_number":158,"context_line":"        query_obj \u003d ports.DistributedPortBinding.get_object("},{"line_number":159,"context_line":"            context, port_id\u003dport_id, host\u003dhost)"},{"line_number":160,"context_line":"        return query_obj"},{"line_number":161,"context_line":""},{"line_number":162,"context_line":""},{"line_number":163,"context_line":"def delete_distributed_port_binding_if_stale(session, binding):"}],"source_content_type":"text/x-python","patch_set":17,"id":"5a74a57a_ace64542","line":160,"range":{"start_line":158,"start_character":0,"end_line":160,"end_character":24},"in_reply_to":"7a77a97e_997c4274","updated":"2016-11-29 23:19:02.000000000","message":"Done","commit_id":"22553a3bfce336165287b6b825f65828124decd7"},{"author":{"_account_id":20246,"name":"Aradhana Singh","email":"aradhanamailbox@gmail.com","username":"asingh"},"change_message_id":"763536c68778ae4722e31c8257df85bcb7fbbfae","unresolved":false,"context_lines":[{"line_number":162,"context_line":""},{"line_number":163,"context_line":"def delete_distributed_port_binding_if_stale(session, binding):"},{"line_number":164,"context_line":"    if not binding.router_id and binding.status \u003d\u003d n_const.PORT_STATUS_DOWN:"},{"line_number":165,"context_line":"        with session.begin(subtransactions\u003dTrue):"},{"line_number":166,"context_line":"            LOG.debug(\"Distributed port: Deleting binding %s\", binding)"},{"line_number":167,"context_line":"            binding.delete()"},{"line_number":168,"context_line":""}],"source_content_type":"text/x-python","patch_set":17,"id":"7a77a97e_d9af9ae1","line":165,"range":{"start_line":165,"start_character":1,"end_line":165,"end_character":49},"updated":"2016-11-16 00:02:14.000000000","message":"this is not required , session management is taken care of by ovo","commit_id":"22553a3bfce336165287b6b825f65828124decd7"},{"author":{"_account_id":22776,"name":"Nakul Dahiwade","email":"nakul.dahiwade@intel.com","username":"nakul.dahiwade"},"change_message_id":"9cbe12fd29be13bdf9ed316932b45f442805b5f8","unresolved":false,"context_lines":[{"line_number":162,"context_line":""},{"line_number":163,"context_line":"def delete_distributed_port_binding_if_stale(session, binding):"},{"line_number":164,"context_line":"    if not binding.router_id and binding.status \u003d\u003d n_const.PORT_STATUS_DOWN:"},{"line_number":165,"context_line":"        with session.begin(subtransactions\u003dTrue):"},{"line_number":166,"context_line":"            LOG.debug(\"Distributed port: Deleting binding %s\", binding)"},{"line_number":167,"context_line":"            binding.delete()"},{"line_number":168,"context_line":""}],"source_content_type":"text/x-python","patch_set":17,"id":"5a74a57a_cc51c1da","line":165,"range":{"start_line":165,"start_character":1,"end_line":165,"end_character":49},"in_reply_to":"7a77a97e_d9af9ae1","updated":"2016-11-29 23:19:02.000000000","message":"Done","commit_id":"22553a3bfce336165287b6b825f65828124decd7"},{"author":{"_account_id":20246,"name":"Aradhana Singh","email":"aradhanamailbox@gmail.com","username":"asingh"},"change_message_id":"763536c68778ae4722e31c8257df85bcb7fbbfae","unresolved":false,"context_lines":[{"line_number":286,"context_line":""},{"line_number":287,"context_line":""},{"line_number":288,"context_line":"def get_distributed_port_binding_by_host(context, port_id, host):"},{"line_number":289,"context_line":"    binding \u003d ports.DistributedPortBinding.get_object(context,"},{"line_number":290,"context_line":"                                                      port_id\u003dport_id,"},{"line_number":291,"context_line":"                                                      host\u003dhost)"},{"line_number":292,"context_line":""},{"line_number":293,"context_line":"    if not binding:"},{"line_number":294,"context_line":"        LOG.debug(\"No binding for distributed port %(port_id)s with host \""}],"source_content_type":"text/x-python","patch_set":17,"id":"7a77a97e_44863a14","line":291,"range":{"start_line":289,"start_character":0,"end_line":291,"end_character":64},"updated":"2016-11-16 00:02:14.000000000","message":"binding \u003d ports.DistributedPortBinding.get_object(context,\n        port_id\u003dport_id, host\u003dhost)","commit_id":"22553a3bfce336165287b6b825f65828124decd7"},{"author":{"_account_id":22776,"name":"Nakul Dahiwade","email":"nakul.dahiwade@intel.com","username":"nakul.dahiwade"},"change_message_id":"9cbe12fd29be13bdf9ed316932b45f442805b5f8","unresolved":false,"context_lines":[{"line_number":286,"context_line":""},{"line_number":287,"context_line":""},{"line_number":288,"context_line":"def get_distributed_port_binding_by_host(context, port_id, host):"},{"line_number":289,"context_line":"    binding \u003d ports.DistributedPortBinding.get_object(context,"},{"line_number":290,"context_line":"                                                      port_id\u003dport_id,"},{"line_number":291,"context_line":"                                                      host\u003dhost)"},{"line_number":292,"context_line":""},{"line_number":293,"context_line":"    if not binding:"},{"line_number":294,"context_line":"        LOG.debug(\"No binding for distributed port %(port_id)s with host \""}],"source_content_type":"text/x-python","patch_set":17,"id":"5a74a57a_2c5795cb","line":291,"range":{"start_line":289,"start_character":0,"end_line":291,"end_character":64},"in_reply_to":"7a77a97e_44863a14","updated":"2016-11-29 23:19:02.000000000","message":"Done","commit_id":"22553a3bfce336165287b6b825f65828124decd7"},{"author":{"_account_id":8726,"name":"Victor Morales","email":"chipahuac@hotmail.com","username":"electrocucaracha"},"change_message_id":"539cf7501013682cd83064750c968b5cb79c3739","unresolved":false,"context_lines":[{"line_number":110,"context_line":""},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"def ensure_distributed_port_binding(context, port_id, host, router_id\u003dNone):"},{"line_number":113,"context_line":"    record_obj \u003d next((i for i in ports.DistributedPortBinding.get_objects("},{"line_number":114,"context_line":"        context, port_id\u003dport_id, host\u003dhost)), None)"},{"line_number":115,"context_line":"    if record_obj:"},{"line_number":116,"context_line":"        return record_obj"},{"line_number":117,"context_line":""}],"source_content_type":"text/x-python","patch_set":18,"id":"5a74a57a_4c8771d7","line":114,"range":{"start_line":113,"start_character":4,"end_line":114,"end_character":52},"updated":"2016-11-29 23:42:53.000000000","message":"Given that you are filtering by its primary keys you can use get_object method.","commit_id":"118697fa60a332a53787dc0fad6989e3a58db245"},{"author":{"_account_id":15518,"name":"Artur Korzeniewski","email":"artur.korzen@wp.pl","username":"akorzeni"},"change_message_id":"fe56b8616bcad41115af5c9c779c19a3f49ce57b","unresolved":false,"context_lines":[{"line_number":110,"context_line":""},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"def ensure_distributed_port_binding(context, port_id, host, router_id\u003dNone):"},{"line_number":113,"context_line":"    record_obj \u003d next((i for i in ports.DistributedPortBinding.get_objects("},{"line_number":114,"context_line":"        context, port_id\u003dport_id, host\u003dhost)), None)"},{"line_number":115,"context_line":"    if record_obj:"},{"line_number":116,"context_line":"        return record_obj"},{"line_number":117,"context_line":""}],"source_content_type":"text/x-python","patch_set":18,"id":"5a74a57a_9ba521b7","line":114,"range":{"start_line":113,"start_character":4,"end_line":114,"end_character":52},"in_reply_to":"5a74a57a_4c8771d7","updated":"2016-11-30 14:38:05.000000000","message":"If UT was failing when using get_object, we need to debug it further.","commit_id":"118697fa60a332a53787dc0fad6989e3a58db245"},{"author":{"_account_id":8726,"name":"Victor Morales","email":"chipahuac@hotmail.com","username":"electrocucaracha"},"change_message_id":"539cf7501013682cd83064750c968b5cb79c3739","unresolved":false,"context_lines":[{"line_number":266,"context_line":""},{"line_number":267,"context_line":""},{"line_number":268,"context_line":"def get_distributed_port_bindings(context, port_id):"},{"line_number":269,"context_line":"    binding_objs \u003d ports.DistributedPortBinding.get_objects(context)"},{"line_number":270,"context_line":"    bindings \u003d []"},{"line_number":271,"context_line":"    for obj in binding_objs:"},{"line_number":272,"context_line":"        if obj.port_id.startswith(port_id):"},{"line_number":273,"context_line":"            bindings.append(obj)"},{"line_number":274,"context_line":"    if not bindings:"},{"line_number":275,"context_line":"        LOG.debug(\"No bindings for distributed port %s\", port_id)"},{"line_number":276,"context_line":"    return bindings"}],"source_content_type":"text/x-python","patch_set":18,"id":"5a74a57a_ec167d57","line":273,"range":{"start_line":269,"start_character":4,"end_line":273,"end_character":32},"updated":"2016-11-29 23:42:53.000000000","message":"nit: It\u0027d be nice if the base class could support range and wildcards for filtering information.","commit_id":"118697fa60a332a53787dc0fad6989e3a58db245"},{"author":{"_account_id":22776,"name":"Nakul Dahiwade","email":"nakul.dahiwade@intel.com","username":"nakul.dahiwade"},"change_message_id":"9ff4e52de99f026ce19434a59086c7ee113ac533","unresolved":false,"context_lines":[{"line_number":266,"context_line":""},{"line_number":267,"context_line":""},{"line_number":268,"context_line":"def get_distributed_port_bindings(context, port_id):"},{"line_number":269,"context_line":"    binding_objs \u003d ports.DistributedPortBinding.get_objects(context)"},{"line_number":270,"context_line":"    bindings \u003d []"},{"line_number":271,"context_line":"    for obj in binding_objs:"},{"line_number":272,"context_line":"        if obj.port_id.startswith(port_id):"},{"line_number":273,"context_line":"            bindings.append(obj)"},{"line_number":274,"context_line":"    if not bindings:"},{"line_number":275,"context_line":"        LOG.debug(\"No bindings for distributed port %s\", port_id)"},{"line_number":276,"context_line":"    return bindings"}],"source_content_type":"text/x-python","patch_set":18,"id":"5a74a57a_9fd89681","line":273,"range":{"start_line":269,"start_character":4,"end_line":273,"end_character":32},"in_reply_to":"5a74a57a_ec167d57","updated":"2016-11-30 21:23:51.000000000","message":"Has been replaced with a class method as per Artur\u0027s suggestion.","commit_id":"118697fa60a332a53787dc0fad6989e3a58db245"},{"author":{"_account_id":15518,"name":"Artur Korzeniewski","email":"artur.korzen@wp.pl","username":"akorzeni"},"change_message_id":"fe56b8616bcad41115af5c9c779c19a3f49ce57b","unresolved":false,"context_lines":[{"line_number":266,"context_line":""},{"line_number":267,"context_line":""},{"line_number":268,"context_line":"def get_distributed_port_bindings(context, port_id):"},{"line_number":269,"context_line":"    binding_objs \u003d ports.DistributedPortBinding.get_objects(context)"},{"line_number":270,"context_line":"    bindings \u003d []"},{"line_number":271,"context_line":"    for obj in binding_objs:"},{"line_number":272,"context_line":"        if obj.port_id.startswith(port_id):"},{"line_number":273,"context_line":"            bindings.append(obj)"},{"line_number":274,"context_line":"    if not bindings:"},{"line_number":275,"context_line":"        LOG.debug(\"No bindings for distributed port %s\", port_id)"},{"line_number":276,"context_line":"    return bindings"}],"source_content_type":"text/x-python","patch_set":18,"id":"5a74a57a_96cb381e","line":273,"range":{"start_line":269,"start_character":4,"end_line":273,"end_character":32},"in_reply_to":"5a74a57a_ec167d57","updated":"2016-11-30 14:38:05.000000000","message":"So, the \u0027startswith\u0027 is important for filtering here? \nI guess it depends on what is passed as \u0027port_id\u0027...","commit_id":"118697fa60a332a53787dc0fad6989e3a58db245"},{"author":{"_account_id":15518,"name":"Artur Korzeniewski","email":"artur.korzen@wp.pl","username":"akorzeni"},"change_message_id":"8dda8b69951db5026fb305b5d89cf42408bab273","unresolved":false,"context_lines":[{"line_number":110,"context_line":""},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"def ensure_distributed_port_binding(context, port_id, host, router_id\u003dNone):"},{"line_number":113,"context_line":"    record_obj \u003d next((i for i in ports.DistributedPortBinding.get_objects("},{"line_number":114,"context_line":"        context, port_id\u003dport_id, host\u003dhost)), None)"},{"line_number":115,"context_line":"    if record_obj:"},{"line_number":116,"context_line":"        return record_obj"},{"line_number":117,"context_line":""}],"source_content_type":"text/x-python","patch_set":19,"id":"3a71b18c_89c5095d","line":114,"range":{"start_line":113,"start_character":3,"end_line":114,"end_character":52},"updated":"2016-12-01 09:58:45.000000000","message":"I\u0027m still not convinced about that one, it should be get_object, can you provide any traceback why it is not working?","commit_id":"b0b4f516847ac22a1282cc17090be4f9f264482a"},{"author":{"_account_id":15518,"name":"Artur Korzeniewski","email":"artur.korzen@wp.pl","username":"akorzeni"},"change_message_id":"d83f7a46de75861d93a7f9b0d85592870c91a46e","unresolved":false,"context_lines":[{"line_number":110,"context_line":""},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"def ensure_distributed_port_binding(context, port_id, host, router_id\u003dNone):"},{"line_number":113,"context_line":"    record_obj \u003d next((i for i in ports.DistributedPortBinding.get_objects("},{"line_number":114,"context_line":"        context, port_id\u003dport_id, host\u003dhost)), None)"},{"line_number":115,"context_line":"    if record_obj:"},{"line_number":116,"context_line":"        return record_obj"},{"line_number":117,"context_line":""}],"source_content_type":"text/x-python","patch_set":19,"id":"3a71b18c_abe1889c","line":114,"range":{"start_line":113,"start_character":3,"end_line":114,"end_character":52},"in_reply_to":"3a71b18c_18e3e9a4","updated":"2016-12-02 15:45:11.000000000","message":"Ok, so the issue was in UT\u0027s mock, I have fixed it in PS21.","commit_id":"b0b4f516847ac22a1282cc17090be4f9f264482a"},{"author":{"_account_id":22776,"name":"Nakul Dahiwade","email":"nakul.dahiwade@intel.com","username":"nakul.dahiwade"},"change_message_id":"6f09ac4373c37cac32fa52630e940a0c855ca59a","unresolved":false,"context_lines":[{"line_number":110,"context_line":""},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"def ensure_distributed_port_binding(context, port_id, host, router_id\u003dNone):"},{"line_number":113,"context_line":"    record_obj \u003d next((i for i in ports.DistributedPortBinding.get_objects("},{"line_number":114,"context_line":"        context, port_id\u003dport_id, host\u003dhost)), None)"},{"line_number":115,"context_line":"    if record_obj:"},{"line_number":116,"context_line":"        return record_obj"},{"line_number":117,"context_line":""}],"source_content_type":"text/x-python","patch_set":19,"id":"3a71b18c_18e3e9a4","line":114,"range":{"start_line":113,"start_character":3,"end_line":114,"end_character":52},"in_reply_to":"3a71b18c_89c5095d","updated":"2016-12-01 16:58:34.000000000","message":"Here is the traceback if I use get_object : http://paste.openstack.org/show/591160/\n\nIt\u0027s returning an empty list in binding here:https://github.com/openstack/neutron/blob/master/neutron/tests/unit/plugins/ml2/test_db.py#L324-Lundefined\nwhich means record_obj wasn\u0027t created/fetched with get_object.\n\nNot sure why as PK\u0027s are provided. Hence using next() with get_objects.","commit_id":"b0b4f516847ac22a1282cc17090be4f9f264482a"},{"author":{"_account_id":15518,"name":"Artur Korzeniewski","email":"artur.korzen@wp.pl","username":"akorzeni"},"change_message_id":"8dda8b69951db5026fb305b5d89cf42408bab273","unresolved":false,"context_lines":[{"line_number":258,"context_line":"def get_distributed_port_binding_by_host(context, port_id, host):"},{"line_number":259,"context_line":"    bindings \u003d ports.DistributedPortBinding.get_objects_portid_startswith("},{"line_number":260,"context_line":"        context, port_id, host)"},{"line_number":261,"context_line":"    if len(bindings) \u003e 0:"},{"line_number":262,"context_line":"        binding \u003d bindings[0]"},{"line_number":263,"context_line":"        return binding"},{"line_number":264,"context_line":"    else:"},{"line_number":265,"context_line":"        LOG.debug(\"No binding for distributed port %(port_id)s with host \""},{"line_number":266,"context_line":"                  \"%(host)s\", {\u0027port_id\u0027: port_id, \u0027host\u0027: host})"},{"line_number":267,"context_line":""},{"line_number":268,"context_line":""},{"line_number":269,"context_line":"def get_distributed_port_bindings(context, port_id):"}],"source_content_type":"text/x-python","patch_set":19,"id":"3a71b18c_e9c91dae","line":266,"range":{"start_line":261,"start_character":5,"end_line":266,"end_character":65},"updated":"2016-12-01 09:58:45.000000000","message":"binding \u003d bindings.pop() if bindings else None\nif not binding:\n    LOG.debug(\"No binding for distributed port %(port_id)s with host \"\n                  \"%(host)s\", {\u0027port_id\u0027: port_id, \u0027host\u0027: host})\nreturn binding","commit_id":"b0b4f516847ac22a1282cc17090be4f9f264482a"},{"author":{"_account_id":22776,"name":"Nakul Dahiwade","email":"nakul.dahiwade@intel.com","username":"nakul.dahiwade"},"change_message_id":"6f09ac4373c37cac32fa52630e940a0c855ca59a","unresolved":false,"context_lines":[{"line_number":258,"context_line":"def get_distributed_port_binding_by_host(context, port_id, host):"},{"line_number":259,"context_line":"    bindings \u003d ports.DistributedPortBinding.get_objects_portid_startswith("},{"line_number":260,"context_line":"        context, port_id, host)"},{"line_number":261,"context_line":"    if len(bindings) \u003e 0:"},{"line_number":262,"context_line":"        binding \u003d bindings[0]"},{"line_number":263,"context_line":"        return binding"},{"line_number":264,"context_line":"    else:"},{"line_number":265,"context_line":"        LOG.debug(\"No binding for distributed port %(port_id)s with host \""},{"line_number":266,"context_line":"                  \"%(host)s\", {\u0027port_id\u0027: port_id, \u0027host\u0027: host})"},{"line_number":267,"context_line":""},{"line_number":268,"context_line":""},{"line_number":269,"context_line":"def get_distributed_port_bindings(context, port_id):"}],"source_content_type":"text/x-python","patch_set":19,"id":"3a71b18c_b8ce7581","line":266,"range":{"start_line":261,"start_character":5,"end_line":266,"end_character":65},"in_reply_to":"3a71b18c_e9c91dae","updated":"2016-12-01 16:58:34.000000000","message":"Done","commit_id":"b0b4f516847ac22a1282cc17090be4f9f264482a"},{"author":{"_account_id":19594,"name":"Yarko Tymciurak","email":"yarko.tymciurak@intel.com","username":"yarkot"},"change_message_id":"549304aef5e373610347a1ba59c030009b664025","unresolved":false,"context_lines":[{"line_number":262,"context_line":"    if not binding:"},{"line_number":263,"context_line":"        LOG.debug(\"No binding for distributed port %(port_id)s with host \""},{"line_number":264,"context_line":"                  \"%(host)s\", {\u0027port_id\u0027: port_id, \u0027host\u0027: host})"},{"line_number":265,"context_line":"    return binding"},{"line_number":266,"context_line":""},{"line_number":267,"context_line":""},{"line_number":268,"context_line":"def get_distributed_port_bindings(context, port_id):"}],"source_content_type":"text/x-python","patch_set":20,"id":"3a71b18c_a10e4032","line":265,"updated":"2016-12-01 17:41:42.000000000","message":"hmm...  current uses will do what when you return None? (I realize this isn\u0027t new):\n\nsee plugin.py, line 487-496\n\nplugin.py, lines 1542-1545, 1682-1687 and 1745-1748 seem ok;","commit_id":"7b52610f012c168406496a3df3ff119b090ca116"}],"neutron/plugins/ml2/plugin.py":[{"author":{"_account_id":15518,"name":"Artur Korzeniewski","email":"artur.korzen@wp.pl","username":"akorzeni"},"change_message_id":"56679b7265fabd875ccbca963efb941f7424e438","unresolved":false,"context_lines":[{"line_number":1551,"context_line":"                        binding \u003d db.ensure_distributed_port_binding("},{"line_number":1552,"context_line":"                            context, id, host, router_id\u003ddevice_id)"},{"line_number":1553,"context_line":"                    network \u003d self.get_network(context,"},{"line_number":1554,"context_line":"                            orig_port[\u0027network_id\u0027])"},{"line_number":1555,"context_line":"                    levels \u003d db.get_binding_levels(session, id, host)"},{"line_number":1556,"context_line":"                    mech_context \u003d driver_context.PortContext(self,"},{"line_number":1557,"context_line":"                        context, orig_port, network,"}],"source_content_type":"text/x-python","patch_set":16,"id":"9a629dbe_5151d461","line":1554,"updated":"2016-11-07 11:25:57.000000000","message":"This change is not needed.","commit_id":"fd7e77abd54e409577ae8725ab6045616ca22cc2"},{"author":{"_account_id":22776,"name":"Nakul Dahiwade","email":"nakul.dahiwade@intel.com","username":"nakul.dahiwade"},"change_message_id":"4f288774afde24e090a328bdd00a79c3e1349927","unresolved":false,"context_lines":[{"line_number":1551,"context_line":"                        binding \u003d db.ensure_distributed_port_binding("},{"line_number":1552,"context_line":"                            context, id, host, router_id\u003ddevice_id)"},{"line_number":1553,"context_line":"                    network \u003d self.get_network(context,"},{"line_number":1554,"context_line":"                            orig_port[\u0027network_id\u0027])"},{"line_number":1555,"context_line":"                    levels \u003d db.get_binding_levels(session, id, host)"},{"line_number":1556,"context_line":"                    mech_context \u003d driver_context.PortContext(self,"},{"line_number":1557,"context_line":"                        context, orig_port, network,"}],"source_content_type":"text/x-python","patch_set":16,"id":"9a629dbe_bce74911","line":1554,"in_reply_to":"9a629dbe_5151d461","updated":"2016-11-07 21:11:21.000000000","message":"Done","commit_id":"fd7e77abd54e409577ae8725ab6045616ca22cc2"},{"author":{"_account_id":20246,"name":"Aradhana Singh","email":"aradhanamailbox@gmail.com","username":"asingh"},"change_message_id":"763536c68778ae4722e31c8257df85bcb7fbbfae","unresolved":false,"context_lines":[{"line_number":490,"context_line":"            cur_context \u003d driver_context.PortContext("},{"line_number":491,"context_line":"                self, plugin_context, port, network, cur_binding, None,"},{"line_number":492,"context_line":"                original_port\u003doport)"},{"line_number":493,"context_line":""},{"line_number":494,"context_line":"            # Commit our binding results only if port has not been"},{"line_number":495,"context_line":"            # successfully bound concurrently by another thread or"},{"line_number":496,"context_line":"            # process and no binding inputs have been changed."}],"source_content_type":"text/x-python","patch_set":17,"id":"7a77a97e_39e5ee36","side":"PARENT","line":493,"updated":"2016-11-16 00:02:14.000000000","message":"change not related to the patchset","commit_id":"e1290f93ddab9d877ce3bdf78e66773362adb144"},{"author":{"_account_id":22776,"name":"Nakul Dahiwade","email":"nakul.dahiwade@intel.com","username":"nakul.dahiwade"},"change_message_id":"9cbe12fd29be13bdf9ed316932b45f442805b5f8","unresolved":false,"context_lines":[{"line_number":490,"context_line":"            cur_context \u003d driver_context.PortContext("},{"line_number":491,"context_line":"                self, plugin_context, port, network, cur_binding, None,"},{"line_number":492,"context_line":"                original_port\u003doport)"},{"line_number":493,"context_line":""},{"line_number":494,"context_line":"            # Commit our binding results only if port has not been"},{"line_number":495,"context_line":"            # successfully bound concurrently by another thread or"},{"line_number":496,"context_line":"            # process and no binding inputs have been changed."}],"source_content_type":"text/x-python","patch_set":17,"id":"5a74a57a_4cb851e6","side":"PARENT","line":493,"in_reply_to":"7a77a97e_39e5ee36","updated":"2016-11-29 23:19:02.000000000","message":"Done","commit_id":"e1290f93ddab9d877ce3bdf78e66773362adb144"},{"author":{"_account_id":20246,"name":"Aradhana Singh","email":"aradhanamailbox@gmail.com","username":"asingh"},"change_message_id":"763536c68778ae4722e31c8257df85bcb7fbbfae","unresolved":false,"context_lines":[{"line_number":1603,"context_line":"            bound_mech_contexts \u003d []"},{"line_number":1604,"context_line":"            device_owner \u003d port[\u0027device_owner\u0027]"},{"line_number":1605,"context_line":"            if device_owner \u003d\u003d const.DEVICE_OWNER_DVR_INTERFACE:"},{"line_number":1606,"context_line":"                bindings \u003d db.get_distributed_port_bindings(context,"},{"line_number":1607,"context_line":"                                                            id)"},{"line_number":1608,"context_line":"                for bind in bindings:"},{"line_number":1609,"context_line":"                    levels \u003d db.get_binding_levels(context.session, id,"},{"line_number":1610,"context_line":"                                                   bind.host)"}],"source_content_type":"text/x-python","patch_set":17,"id":"7a77a97e_445e3a77","line":1607,"range":{"start_line":1606,"start_character":0,"end_line":1607,"end_character":63},"updated":"2016-11-16 00:02:14.000000000","message":"bindings \u003d db.get_distributed_port_bindings(context, id)\nfits in one line","commit_id":"22553a3bfce336165287b6b825f65828124decd7"},{"author":{"_account_id":22776,"name":"Nakul Dahiwade","email":"nakul.dahiwade@intel.com","username":"nakul.dahiwade"},"change_message_id":"9cbe12fd29be13bdf9ed316932b45f442805b5f8","unresolved":false,"context_lines":[{"line_number":1603,"context_line":"            bound_mech_contexts \u003d []"},{"line_number":1604,"context_line":"            device_owner \u003d port[\u0027device_owner\u0027]"},{"line_number":1605,"context_line":"            if device_owner \u003d\u003d const.DEVICE_OWNER_DVR_INTERFACE:"},{"line_number":1606,"context_line":"                bindings \u003d db.get_distributed_port_bindings(context,"},{"line_number":1607,"context_line":"                                                            id)"},{"line_number":1608,"context_line":"                for bind in bindings:"},{"line_number":1609,"context_line":"                    levels \u003d db.get_binding_levels(context.session, id,"},{"line_number":1610,"context_line":"                                                   bind.host)"}],"source_content_type":"text/x-python","patch_set":17,"id":"5a74a57a_8ce34905","line":1607,"range":{"start_line":1606,"start_character":0,"end_line":1607,"end_character":63},"in_reply_to":"7a77a97e_445e3a77","updated":"2016-11-29 23:19:02.000000000","message":"Done","commit_id":"22553a3bfce336165287b6b825f65828124decd7"},{"author":{"_account_id":20246,"name":"Aradhana Singh","email":"aradhanamailbox@gmail.com","username":"asingh"},"change_message_id":"763536c68778ae4722e31c8257df85bcb7fbbfae","unresolved":false,"context_lines":[{"line_number":1797,"context_line":"            LOG.debug(\"No Port match for: %s\", port_id)"},{"line_number":1798,"context_line":"            return"},{"line_number":1799,"context_line":"        if port[\u0027device_owner\u0027] \u003d\u003d const.DEVICE_OWNER_DVR_INTERFACE:"},{"line_number":1800,"context_line":"            bindings \u003d db.get_distributed_port_bindings(context,"},{"line_number":1801,"context_line":"                                                        port_id)"},{"line_number":1802,"context_line":"            for b in bindings:"},{"line_number":1803,"context_line":"                if b.host \u003d\u003d host:"},{"line_number":1804,"context_line":"                    return port"}],"source_content_type":"text/x-python","patch_set":17,"id":"7a77a97e_a4c54e3d","line":1801,"range":{"start_line":1800,"start_character":11,"end_line":1801,"end_character":64},"updated":"2016-11-16 00:02:14.000000000","message":"ditto","commit_id":"22553a3bfce336165287b6b825f65828124decd7"},{"author":{"_account_id":22776,"name":"Nakul Dahiwade","email":"nakul.dahiwade@intel.com","username":"nakul.dahiwade"},"change_message_id":"9cbe12fd29be13bdf9ed316932b45f442805b5f8","unresolved":false,"context_lines":[{"line_number":1797,"context_line":"            LOG.debug(\"No Port match for: %s\", port_id)"},{"line_number":1798,"context_line":"            return"},{"line_number":1799,"context_line":"        if port[\u0027device_owner\u0027] \u003d\u003d const.DEVICE_OWNER_DVR_INTERFACE:"},{"line_number":1800,"context_line":"            bindings \u003d db.get_distributed_port_bindings(context,"},{"line_number":1801,"context_line":"                                                        port_id)"},{"line_number":1802,"context_line":"            for b in bindings:"},{"line_number":1803,"context_line":"                if b.host \u003d\u003d host:"},{"line_number":1804,"context_line":"                    return port"}],"source_content_type":"text/x-python","patch_set":17,"id":"5a74a57a_acf005cb","line":1801,"range":{"start_line":1800,"start_character":11,"end_line":1801,"end_character":64},"in_reply_to":"7a77a97e_a4c54e3d","updated":"2016-11-29 23:19:02.000000000","message":"Done","commit_id":"22553a3bfce336165287b6b825f65828124decd7"},{"author":{"_account_id":15518,"name":"Artur Korzeniewski","email":"artur.korzen@wp.pl","username":"akorzeni"},"change_message_id":"d01d88e8cd9f333817e7eb797eebf9ae2c53491c","unresolved":false,"context_lines":[{"line_number":555,"context_line":"    def _get_vif_details(self, binding):"},{"line_number":556,"context_line":"        if binding.vif_details:"},{"line_number":557,"context_line":"            try:"},{"line_number":558,"context_line":"                if isinstance(binding.vif_details, dict):"},{"line_number":559,"context_line":"                    return binding.vif_details"},{"line_number":560,"context_line":"                return jsonutils.loads(binding.vif_details)"},{"line_number":561,"context_line":"            except Exception:"},{"line_number":562,"context_line":"                LOG.error(_LE(\"Serialized vif_details DB value \u0027%(value)s\u0027 \""}],"source_content_type":"text/x-python","patch_set":21,"id":"3a71b18c_eb98e01d","line":559,"range":{"start_line":558,"start_character":16,"end_line":559,"end_character":46},"updated":"2016-12-02 15:48:48.000000000","message":"It is something that I have introduced ad hoc, it needs improvement.","commit_id":"24a727abf8c4cfa4d526cf8ff494803a3c7708d1"},{"author":{"_account_id":15518,"name":"Artur Korzeniewski","email":"artur.korzen@wp.pl","username":"akorzeni"},"change_message_id":"d01d88e8cd9f333817e7eb797eebf9ae2c53491c","unresolved":false,"context_lines":[{"line_number":568,"context_line":"    def _get_profile(self, binding):"},{"line_number":569,"context_line":"        if binding.profile:"},{"line_number":570,"context_line":"            try:"},{"line_number":571,"context_line":"                return jsonutils.loads(binding.profile)"},{"line_number":572,"context_line":"            except Exception:"},{"line_number":573,"context_line":"                LOG.error(_LE(\"Serialized profile DB value \u0027%(value)s\u0027 for \""},{"line_number":574,"context_line":"                              \"port %(port)s is invalid\"),"}],"source_content_type":"text/x-python","patch_set":21,"id":"3a71b18c_4b78f4c4","line":571,"range":{"start_line":571,"start_character":16,"end_line":571,"end_character":55},"updated":"2016-12-02 15:48:48.000000000","message":"Does it mean that profile should be DictOfStringField? Like vif_details?","commit_id":"24a727abf8c4cfa4d526cf8ff494803a3c7708d1"}],"neutron/tests/unit/objects/test_ports.py":[{"author":{"_account_id":15518,"name":"Artur Korzeniewski","email":"artur.korzen@wp.pl","username":"akorzeni"},"change_message_id":"56679b7265fabd875ccbca963efb941f7424e438","unresolved":false,"context_lines":[{"line_number":130,"context_line":"            self.context, **obj._get_composite_keys())"},{"line_number":131,"context_line":"        self.assertEqual(vif_details, obj.vif_details)"},{"line_number":132,"context_line":""},{"line_number":133,"context_line":"        obj.vif_details \u003d {}"},{"line_number":134,"context_line":"        obj.update()"},{"line_number":135,"context_line":""},{"line_number":136,"context_line":"        obj \u003d self._test_class.get_object("}],"source_content_type":"text/x-python","patch_set":16,"id":"9a629dbe_ec7bef79","line":133,"updated":"2016-11-07 11:25:57.000000000","message":"When we revert the vif_details to be required field, this UT change can be reverted also.","commit_id":"fd7e77abd54e409577ae8725ab6045616ca22cc2"},{"author":{"_account_id":22776,"name":"Nakul Dahiwade","email":"nakul.dahiwade@intel.com","username":"nakul.dahiwade"},"change_message_id":"4f288774afde24e090a328bdd00a79c3e1349927","unresolved":false,"context_lines":[{"line_number":130,"context_line":"            self.context, **obj._get_composite_keys())"},{"line_number":131,"context_line":"        self.assertEqual(vif_details, obj.vif_details)"},{"line_number":132,"context_line":""},{"line_number":133,"context_line":"        obj.vif_details \u003d {}"},{"line_number":134,"context_line":"        obj.update()"},{"line_number":135,"context_line":""},{"line_number":136,"context_line":"        obj \u003d self._test_class.get_object("}],"source_content_type":"text/x-python","patch_set":16,"id":"9a629dbe_bcce6981","line":133,"in_reply_to":"9a629dbe_ec7bef79","updated":"2016-11-07 21:11:21.000000000","message":"Done","commit_id":"fd7e77abd54e409577ae8725ab6045616ca22cc2"}],"neutron/tests/unit/plugins/ml2/test_db.py":[{"author":{"_account_id":8726,"name":"Victor Morales","email":"chipahuac@hotmail.com","username":"electrocucaracha"},"change_message_id":"539cf7501013682cd83064750c968b5cb79c3739","unresolved":false,"context_lines":[{"line_number":268,"context_line":""},{"line_number":269,"context_line":""},{"line_number":270,"context_line":"class Ml2DvrDBTestCase(testlib_api.SqlTestCase):"},{"line_number":271,"context_line":"    CORE_PLUGIN \u003d \u0027neutron.db.db_base_plugin_v2.NeutronDbPluginV2\u0027"},{"line_number":272,"context_line":""},{"line_number":273,"context_line":"    def setUp(self):"},{"line_number":274,"context_line":"        super(Ml2DvrDBTestCase, self).setUp()"}],"source_content_type":"text/x-python","patch_set":18,"id":"5a74a57a_372442ae","line":271,"range":{"start_line":271,"start_character":4,"end_line":271,"end_character":66},"updated":"2016-11-29 23:42:53.000000000","message":"Usually the constants are defined after the imports section","commit_id":"118697fa60a332a53787dc0fad6989e3a58db245"},{"author":{"_account_id":22776,"name":"Nakul Dahiwade","email":"nakul.dahiwade@intel.com","username":"nakul.dahiwade"},"change_message_id":"9ff4e52de99f026ce19434a59086c7ee113ac533","unresolved":false,"context_lines":[{"line_number":268,"context_line":""},{"line_number":269,"context_line":""},{"line_number":270,"context_line":"class Ml2DvrDBTestCase(testlib_api.SqlTestCase):"},{"line_number":271,"context_line":"    CORE_PLUGIN \u003d \u0027neutron.db.db_base_plugin_v2.NeutronDbPluginV2\u0027"},{"line_number":272,"context_line":""},{"line_number":273,"context_line":"    def setUp(self):"},{"line_number":274,"context_line":"        super(Ml2DvrDBTestCase, self).setUp()"}],"source_content_type":"text/x-python","patch_set":18,"id":"5a74a57a_7f681abb","line":271,"range":{"start_line":271,"start_character":4,"end_line":271,"end_character":66},"in_reply_to":"5a74a57a_372442ae","updated":"2016-11-30 21:23:51.000000000","message":"CORE_PLUGIN is just used in this class.","commit_id":"118697fa60a332a53787dc0fad6989e3a58db245"},{"author":{"_account_id":8726,"name":"Victor Morales","email":"chipahuac@hotmail.com","username":"electrocucaracha"},"change_message_id":"539cf7501013682cd83064750c968b5cb79c3739","unresolved":false,"context_lines":[{"line_number":351,"context_line":"            self.ctx, port_id, \u0027foo_host_1\u0027, router.id)"},{"line_number":352,"context_line":"        ml2_db.ensure_distributed_port_binding("},{"line_number":353,"context_line":"            self.ctx, port_id, \u0027foo_host_2\u0027, router.id)"},{"line_number":354,"context_line":"        bindings_objs \u003d ports.DistributedPortBinding.get_objects("},{"line_number":355,"context_line":"            self.ctx, port_id\u003dport_id)"},{"line_number":356,"context_line":"        self.assertEqual(2, len(bindings_objs))"},{"line_number":357,"context_line":""},{"line_number":358,"context_line":"    def test_delete_distributed_port_binding_if_stale(self):"}],"source_content_type":"text/x-python","patch_set":18,"id":"5a74a57a_177bc67c","line":355,"range":{"start_line":354,"start_character":8,"end_line":355,"end_character":38},"updated":"2016-11-29 23:42:53.000000000","message":"You can use the count method of NeutronDbObject base class","commit_id":"118697fa60a332a53787dc0fad6989e3a58db245"},{"author":{"_account_id":22776,"name":"Nakul Dahiwade","email":"nakul.dahiwade@intel.com","username":"nakul.dahiwade"},"change_message_id":"9ff4e52de99f026ce19434a59086c7ee113ac533","unresolved":false,"context_lines":[{"line_number":351,"context_line":"            self.ctx, port_id, \u0027foo_host_1\u0027, router.id)"},{"line_number":352,"context_line":"        ml2_db.ensure_distributed_port_binding("},{"line_number":353,"context_line":"            self.ctx, port_id, \u0027foo_host_2\u0027, router.id)"},{"line_number":354,"context_line":"        bindings_objs \u003d ports.DistributedPortBinding.get_objects("},{"line_number":355,"context_line":"            self.ctx, port_id\u003dport_id)"},{"line_number":356,"context_line":"        self.assertEqual(2, len(bindings_objs))"},{"line_number":357,"context_line":""},{"line_number":358,"context_line":"    def test_delete_distributed_port_binding_if_stale(self):"}],"source_content_type":"text/x-python","patch_set":18,"id":"5a74a57a_9f6336dd","line":355,"range":{"start_line":354,"start_character":8,"end_line":355,"end_character":38},"in_reply_to":"5a74a57a_177bc67c","updated":"2016-11-30 21:23:51.000000000","message":"Done","commit_id":"118697fa60a332a53787dc0fad6989e3a58db245"},{"author":{"_account_id":8726,"name":"Victor Morales","email":"chipahuac@hotmail.com","username":"electrocucaracha"},"change_message_id":"539cf7501013682cd83064750c968b5cb79c3739","unresolved":false,"context_lines":[{"line_number":364,"context_line":""},{"line_number":365,"context_line":"        ml2_db.delete_distributed_port_binding_if_stale(self.ctx.session,"},{"line_number":366,"context_line":"                                                        binding)"},{"line_number":367,"context_line":"        count_obj \u003d ports.DistributedPortBinding.count(self.ctx,"},{"line_number":368,"context_line":"                                                       port_id\u003dbinding.port_id)"},{"line_number":369,"context_line":"        self.assertFalse(count_obj)"},{"line_number":370,"context_line":""},{"line_number":371,"context_line":"    def test_get_distributed_port_binding_by_host_not_found(self):"}],"source_content_type":"text/x-python","patch_set":18,"id":"5a74a57a_d7e78e44","line":368,"range":{"start_line":367,"start_character":20,"end_line":368,"end_character":78},"updated":"2016-11-29 23:42:53.000000000","message":"You can use the objects_exist method of NeutronDbObject base class.","commit_id":"118697fa60a332a53787dc0fad6989e3a58db245"},{"author":{"_account_id":22776,"name":"Nakul Dahiwade","email":"nakul.dahiwade@intel.com","username":"nakul.dahiwade"},"change_message_id":"9ff4e52de99f026ce19434a59086c7ee113ac533","unresolved":false,"context_lines":[{"line_number":364,"context_line":""},{"line_number":365,"context_line":"        ml2_db.delete_distributed_port_binding_if_stale(self.ctx.session,"},{"line_number":366,"context_line":"                                                        binding)"},{"line_number":367,"context_line":"        count_obj \u003d ports.DistributedPortBinding.count(self.ctx,"},{"line_number":368,"context_line":"                                                       port_id\u003dbinding.port_id)"},{"line_number":369,"context_line":"        self.assertFalse(count_obj)"},{"line_number":370,"context_line":""},{"line_number":371,"context_line":"    def test_get_distributed_port_binding_by_host_not_found(self):"}],"source_content_type":"text/x-python","patch_set":18,"id":"5a74a57a_df5dae16","line":368,"range":{"start_line":367,"start_character":20,"end_line":368,"end_character":78},"in_reply_to":"5a74a57a_d7e78e44","updated":"2016-11-30 21:23:51.000000000","message":"Done","commit_id":"118697fa60a332a53787dc0fad6989e3a58db245"},{"author":{"_account_id":8726,"name":"Victor Morales","email":"chipahuac@hotmail.com","username":"electrocucaracha"},"change_message_id":"539cf7501013682cd83064750c968b5cb79c3739","unresolved":false,"context_lines":[{"line_number":413,"context_line":"                \u0027router_id\u0027: \u0027router_id\u0027,"},{"line_number":414,"context_line":"                \u0027status\u0027: constants.PORT_STATUS_DOWN"},{"line_number":415,"context_line":"            }"},{"line_number":416,"context_line":"            binding_kwarg_obj \u003d ports.DistributedPortBinding("},{"line_number":417,"context_line":"                self.ctx, **binding_kwarg)"},{"line_number":418,"context_line":"            binding_kwarg_obj.create()"},{"line_number":419,"context_line":"            binding_kwarg[\u0027host\u0027] \u003d \u0027another-host\u0027"}],"source_content_type":"text/x-python","patch_set":18,"id":"5a74a57a_f7d3aa5d","line":416,"range":{"start_line":416,"start_character":12,"end_line":416,"end_character":29},"updated":"2016-11-29 23:42:53.000000000","message":"You don\u0027t need to keep a reference of this variable.","commit_id":"118697fa60a332a53787dc0fad6989e3a58db245"},{"author":{"_account_id":22776,"name":"Nakul Dahiwade","email":"nakul.dahiwade@intel.com","username":"nakul.dahiwade"},"change_message_id":"9ff4e52de99f026ce19434a59086c7ee113ac533","unresolved":false,"context_lines":[{"line_number":413,"context_line":"                \u0027router_id\u0027: \u0027router_id\u0027,"},{"line_number":414,"context_line":"                \u0027status\u0027: constants.PORT_STATUS_DOWN"},{"line_number":415,"context_line":"            }"},{"line_number":416,"context_line":"            binding_kwarg_obj \u003d ports.DistributedPortBinding("},{"line_number":417,"context_line":"                self.ctx, **binding_kwarg)"},{"line_number":418,"context_line":"            binding_kwarg_obj.create()"},{"line_number":419,"context_line":"            binding_kwarg[\u0027host\u0027] \u003d \u0027another-host\u0027"}],"source_content_type":"text/x-python","patch_set":18,"id":"5a74a57a_3fa5c203","line":416,"range":{"start_line":416,"start_character":12,"end_line":416,"end_character":29},"in_reply_to":"5a74a57a_f7d3aa5d","updated":"2016-11-30 21:23:51.000000000","message":"Done","commit_id":"118697fa60a332a53787dc0fad6989e3a58db245"},{"author":{"_account_id":8726,"name":"Victor Morales","email":"chipahuac@hotmail.com","username":"electrocucaracha"},"change_message_id":"539cf7501013682cd83064750c968b5cb79c3739","unresolved":false,"context_lines":[{"line_number":417,"context_line":"                self.ctx, **binding_kwarg)"},{"line_number":418,"context_line":"            binding_kwarg_obj.create()"},{"line_number":419,"context_line":"            binding_kwarg[\u0027host\u0027] \u003d \u0027another-host\u0027"},{"line_number":420,"context_line":"            binding_kwarg_obj_2 \u003d ports.DistributedPortBinding("},{"line_number":421,"context_line":"                self.ctx, **binding_kwarg)"},{"line_number":422,"context_line":"            binding_kwarg_obj_2.create()"},{"line_number":423,"context_line":"        with warnings.catch_warnings(record\u003dTrue) as warning_list:"}],"source_content_type":"text/x-python","patch_set":18,"id":"5a74a57a_17c906ad","line":420,"range":{"start_line":420,"start_character":12,"end_line":420,"end_character":31},"updated":"2016-11-29 23:42:53.000000000","message":"ditto: line 416","commit_id":"118697fa60a332a53787dc0fad6989e3a58db245"},{"author":{"_account_id":22776,"name":"Nakul Dahiwade","email":"nakul.dahiwade@intel.com","username":"nakul.dahiwade"},"change_message_id":"9ff4e52de99f026ce19434a59086c7ee113ac533","unresolved":false,"context_lines":[{"line_number":417,"context_line":"                self.ctx, **binding_kwarg)"},{"line_number":418,"context_line":"            binding_kwarg_obj.create()"},{"line_number":419,"context_line":"            binding_kwarg[\u0027host\u0027] \u003d \u0027another-host\u0027"},{"line_number":420,"context_line":"            binding_kwarg_obj_2 \u003d ports.DistributedPortBinding("},{"line_number":421,"context_line":"                self.ctx, **binding_kwarg)"},{"line_number":422,"context_line":"            binding_kwarg_obj_2.create()"},{"line_number":423,"context_line":"        with warnings.catch_warnings(record\u003dTrue) as warning_list:"}],"source_content_type":"text/x-python","patch_set":18,"id":"5a74a57a_5fa8bedb","line":420,"range":{"start_line":420,"start_character":12,"end_line":420,"end_character":31},"in_reply_to":"5a74a57a_17c906ad","updated":"2016-11-30 21:23:51.000000000","message":"Done","commit_id":"118697fa60a332a53787dc0fad6989e3a58db245"},{"author":{"_account_id":8726,"name":"Victor Morales","email":"chipahuac@hotmail.com","username":"electrocucaracha"},"change_message_id":"539cf7501013682cd83064750c968b5cb79c3739","unresolved":false,"context_lines":[{"line_number":424,"context_line":"            with self.ctx.session.begin(subtransactions\u003dTrue):"},{"line_number":425,"context_line":"                self.ctx.session.delete(port)"},{"line_number":426,"context_line":"            self.assertEqual([], warning_list)"},{"line_number":427,"context_line":"        ports_binds \u003d ml2_db.get_distributed_port_bindings(self.ctx,"},{"line_number":428,"context_line":"                                                     \u0027port_id\u0027)"},{"line_number":429,"context_line":"        self.assertEqual(0, len(ports_binds))"}],"source_content_type":"text/x-python","patch_set":18,"id":"5a74a57a_b7ba1209","line":429,"range":{"start_line":427,"start_character":8,"end_line":429,"end_character":45},"updated":"2016-11-29 23:42:53.000000000","message":"You can use count method","commit_id":"118697fa60a332a53787dc0fad6989e3a58db245"},{"author":{"_account_id":22776,"name":"Nakul Dahiwade","email":"nakul.dahiwade@intel.com","username":"nakul.dahiwade"},"change_message_id":"9ff4e52de99f026ce19434a59086c7ee113ac533","unresolved":false,"context_lines":[{"line_number":424,"context_line":"            with self.ctx.session.begin(subtransactions\u003dTrue):"},{"line_number":425,"context_line":"                self.ctx.session.delete(port)"},{"line_number":426,"context_line":"            self.assertEqual([], warning_list)"},{"line_number":427,"context_line":"        ports_binds \u003d ml2_db.get_distributed_port_bindings(self.ctx,"},{"line_number":428,"context_line":"                                                     \u0027port_id\u0027)"},{"line_number":429,"context_line":"        self.assertEqual(0, len(ports_binds))"}],"source_content_type":"text/x-python","patch_set":18,"id":"5a74a57a_1f856658","line":429,"range":{"start_line":427,"start_character":8,"end_line":429,"end_character":45},"in_reply_to":"5a74a57a_b7ba1209","updated":"2016-11-30 21:23:51.000000000","message":"I don\u0027t think I can use count here as it\u0027s not a get_objects method.","commit_id":"118697fa60a332a53787dc0fad6989e3a58db245"},{"author":{"_account_id":8726,"name":"Victor Morales","email":"chipahuac@hotmail.com","username":"electrocucaracha"},"change_message_id":"3dcdd6bb64e7f1084eb02681dbcc400eb72cac50","unresolved":false,"context_lines":[{"line_number":268,"context_line":""},{"line_number":269,"context_line":""},{"line_number":270,"context_line":"class Ml2DvrDBTestCase(testlib_api.SqlTestCase):"},{"line_number":271,"context_line":"    CORE_PLUGIN \u003d \u0027neutron.db.db_base_plugin_v2.NeutronDbPluginV2\u0027"},{"line_number":272,"context_line":""},{"line_number":273,"context_line":"    def setUp(self):"},{"line_number":274,"context_line":"        super(Ml2DvrDBTestCase, self).setUp()"}],"source_content_type":"text/x-python","patch_set":21,"id":"3a71b18c_beefb21c","line":271,"range":{"start_line":271,"start_character":4,"end_line":271,"end_character":65},"updated":"2016-12-05 21:01:45.000000000","message":"nit: I\u0027d prefer the definition of this constant after the imports section","commit_id":"24a727abf8c4cfa4d526cf8ff494803a3c7708d1"},{"author":{"_account_id":8726,"name":"Victor Morales","email":"chipahuac@hotmail.com","username":"electrocucaracha"},"change_message_id":"3dcdd6bb64e7f1084eb02681dbcc400eb72cac50","unresolved":false,"context_lines":[{"line_number":326,"context_line":"            with mock.patch.object(ml2_db.LOG, \u0027debug\u0027) as log_trace:"},{"line_number":327,"context_line":"                binding \u003d ml2_db.ensure_distributed_port_binding("},{"line_number":328,"context_line":"                    self.ctx, port_id, host_id, router_id)"},{"line_number":329,"context_line":"        self.assertEqual(2, get_object.call_count)"},{"line_number":330,"context_line":"        self.assertTrue(log_trace.called)"},{"line_number":331,"context_line":"        self.assertEqual(port_id, binding.port_id)"},{"line_number":332,"context_line":""}],"source_content_type":"text/x-python","patch_set":21,"id":"3a71b18c_5ebcde05","line":329,"range":{"start_line":329,"start_character":39,"end_line":329,"end_character":49},"updated":"2016-12-05 21:01:45.000000000","message":"why this was changed to call_count?","commit_id":"24a727abf8c4cfa4d526cf8ff494803a3c7708d1"}]}
