)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"fa127d80b32cd1e86d36d6ac1148884a6c19dd49","unresolved":false,"context_lines":[{"line_number":10,"context_line":"binding failed, if need_notify is True."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"I823ff5ca66833cdca459f13ab28f5075ae03ded3 broke this behaviour, ignoring"},{"line_number":13,"context_line":"need_notify\u003dTrue passed to _bind_port_if_needed if binding failed."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"This broke TripleO CI, among other things, because TripleO undercloud"},{"line_number":16,"context_line":"uses Ironic where ports are not expected to bind successfully using"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"9a80dd14_f42e06fa","line":13,"updated":"2015-03-09 12:29:53.000000000","message":"the change in question has been reverted since then.","commit_id":"5b77132fdbfb54809198d02ba51e44a985cc54a4"},{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"b550a1d19915bbc07a81f914d245f649078a8250","unresolved":false,"context_lines":[{"line_number":11,"context_line":""},{"line_number":12,"context_line":"This is the second attempt to introduce the patch (the first one was"},{"line_number":13,"context_line":"reverted due to regression that broke Ironic), now with proper"},{"line_number":14,"context_line":"notification sent even when binding attempt failed."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"Co-Authored-By: Yalei Wang \u003cyalei.wang@intel.com\u003e"},{"line_number":17,"context_line":"Change-Id: I437290affd8eb87177d0626bf7935a165859cbdd"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"9a80dd14_91a585b7","line":14,"updated":"2015-03-11 00:46:49.000000000","message":"just for other reviewer\u0027s convenience: the first one is https://review.openstack.org/#/c/141044/","commit_id":"70c40491114c42c27315206a3f959a338018f1f0"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"042ec7d67fad3b30cc46374bd120d25014663711","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Make function _bind_port_if_needed to bind at least one time when the port\u0027s"},{"line_number":10,"context_line":"binding status passed in is already in binding_failed."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"This is the second attempt to introduce the patch (the first one was"},{"line_number":13,"context_line":"reverted due to regression that broke Ironic), now with proper"},{"line_number":14,"context_line":"notification sent even when binding attempt failed."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":12,"id":"3afb71cf_d92258b9","line":11,"updated":"2015-06-05 20:24:02.000000000","message":"It would be beneficial to reviewers to link to the Ironic bug report so that we could understand what was wrong with the original patch and why this one fixes the issue.","commit_id":"37b872468220057c85971f8b1aae7c804f60a715"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"fe30703441e5fc58930017b9f682980afd04d94d","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Make function _bind_port_if_needed to bind at least one time when the port\u0027s"},{"line_number":10,"context_line":"binding status passed in is already in binding_failed."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"This is the second attempt to introduce the patch (the first one was"},{"line_number":13,"context_line":"reverted due to regression that broke Ironic), now with proper"},{"line_number":14,"context_line":"notification sent even when binding attempt failed."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":12,"id":"ba15a1d1_103e06da","line":11,"in_reply_to":"3afb71cf_d92258b9","updated":"2015-09-17 11:18:13.000000000","message":"Could you please specify the bug number? it is no where to be found in the description or comments of #1399249 nor in the previous patch.","commit_id":"37b872468220057c85971f8b1aae7c804f60a715"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"ff92e1f660dc6349d2d7102db1dfcde129db089e","unresolved":false,"context_lines":[{"line_number":18,"context_line":""},{"line_number":19,"context_line":"It also refactors the method significantly, to make it easier to read."},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"Co-Authored-By: Yalei Wang \u003cyalei.wang@intel.com\u003e"},{"line_number":22,"context_line":"Change-Id: I437290affd8eb87177d0626bf7935a165859cbdd"},{"line_number":23,"context_line":"Closes-Bug: #1399249"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":15,"id":"ba15a1d1_7f6ab582","line":21,"updated":"2015-09-17 09:47:29.000000000","message":"Nir, add yourself as a co-author.","commit_id":"6496d0869633b1a43428dcb1736608a57ab29236"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"0c674da1093be62a4d278013b58639ab81d911ee","unresolved":false,"context_lines":[{"line_number":18,"context_line":""},{"line_number":19,"context_line":"It also refactors the method significantly, to make it easier to read."},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"Co-Authored-By: Yalei Wang \u003cyalei.wang@intel.com\u003e"},{"line_number":22,"context_line":"Change-Id: I437290affd8eb87177d0626bf7935a165859cbdd"},{"line_number":23,"context_line":"Closes-Bug: #1399249"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":15,"id":"ba15a1d1_108606db","line":21,"in_reply_to":"ba15a1d1_7f6ab582","updated":"2015-09-17 11:18:34.000000000","message":"Done","commit_id":"6496d0869633b1a43428dcb1736608a57ab29236"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"f39015c3e675d317227ebffd4775e43660f17e33","unresolved":false,"context_lines":[{"line_number":16,"context_line":"The patch also fixes several cases when we attempted to notify with a"},{"line_number":17,"context_line":"binding context that was not committed into database."},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"It also refactors the method significantly, to make it easier to read."},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"Co-Authored-By: Yalei Wang \u003cyalei.wang@intel.com\u003e"},{"line_number":22,"context_line":"Co-Authored-By: Nir Magnezi  \u003cnmagnezi@redhat.com\u003e"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":16,"id":"ba15a1d1_5d3256f3","line":19,"updated":"2015-09-17 12:00:20.000000000","message":"Does it? :)","commit_id":"7e0d8caeb0d4b77c3a610ac6d8b7521592aae885"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"55714559d4e79da8836ec632bac98b54263074b6","unresolved":false,"context_lines":[{"line_number":16,"context_line":"The patch also fixes several cases when we attempted to notify with a"},{"line_number":17,"context_line":"binding context that was not committed into database."},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"It also refactors the method significantly, to make it easier to read."},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"Co-Authored-By: Yalei Wang \u003cyalei.wang@intel.com\u003e"},{"line_number":22,"context_line":"Co-Authored-By: Nir Magnezi  \u003cnmagnezi@redhat.com\u003e"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":16,"id":"1a26ad4f_93784a2d","line":19,"in_reply_to":"ba15a1d1_5d3256f3","updated":"2015-10-29 14:00:56.000000000","message":"Line removed.","commit_id":"7e0d8caeb0d4b77c3a610ac6d8b7521592aae885"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"64ad6849f3b004715de227751f8394cdc13848ac","unresolved":false,"context_lines":[{"line_number":15,"context_line":""},{"line_number":16,"context_line":"The patch also fixes several cases when we attempted to notify with a"},{"line_number":17,"context_line":"binding context that was not committed into database."},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"Co-Authored-By: Yalei Wang \u003cyalei.wang@intel.com\u003e"},{"line_number":20,"context_line":"Co-Authored-By: Nir Magnezi \u003cnmagnezi@redhat.com\u003e"},{"line_number":21,"context_line":"Co-Authored-By: John Schwarz \u003cjschwarz@redhat.com\u003e"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":20,"id":"fa80f949_1adacc17","line":18,"updated":"2015-11-06 12:44:41.000000000","message":"Please describe that you changed the method to commit context only when we are sure we are ready to do it; and provide explanation why such refactoring was needed.","commit_id":"faa4b17c12b18a9f67cf384b6d42ad2271ef992c"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"b3601e879b40b96378f9cfdbd8efc6a6a8ad33b5","unresolved":false,"context_lines":[{"line_number":15,"context_line":""},{"line_number":16,"context_line":"The patch also fixes several cases when we attempted to notify with a"},{"line_number":17,"context_line":"binding context that was not committed into database."},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"Co-Authored-By: Yalei Wang \u003cyalei.wang@intel.com\u003e"},{"line_number":20,"context_line":"Co-Authored-By: Nir Magnezi \u003cnmagnezi@redhat.com\u003e"},{"line_number":21,"context_line":"Co-Authored-By: John Schwarz \u003cjschwarz@redhat.com\u003e"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":20,"id":"da85f559_9049208e","line":18,"in_reply_to":"fa80f949_1adacc17","updated":"2015-11-09 15:08:09.000000000","message":"Done","commit_id":"faa4b17c12b18a9f67cf384b6d42ad2271ef992c"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"cb987c9c82dc07f522f3c7f5e810694492efd49e","unresolved":false,"context_lines":[{"line_number":24,"context_line":"This is in order to refrain from reverts, with will really complicate"},{"line_number":25,"context_line":"things even  more."},{"line_number":26,"context_line":""},{"line_number":27,"context_line":"Co-Authored-By: Yalei Wang \u003cyalei.wang@intel.com\u003e"},{"line_number":28,"context_line":"Co-Authored-By: Nir Magnezi \u003cnmagnezi@redhat.com\u003e"},{"line_number":29,"context_line":"Co-Authored-By: John Schwarz \u003cjschwarz@redhat.com\u003e"},{"line_number":30,"context_line":"Change-Id: I437290affd8eb87177d0626bf7935a165859cbdd"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":44,"id":"3a57f1b5_5d894625","line":27,"updated":"2016-02-11 15:37:56.000000000","message":"As discussed over the phone, this could use a release note.","commit_id":"9d0c2dd6f9468c0450f2e48c73f60b6cf10b8dd9"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"b9917075eed646ad4406423b8256bc5ea8c8ca1b","unresolved":false,"context_lines":[{"line_number":24,"context_line":"This is in order to refrain from reverts, with will really complicate"},{"line_number":25,"context_line":"things even  more."},{"line_number":26,"context_line":""},{"line_number":27,"context_line":"Co-Authored-By: Yalei Wang \u003cyalei.wang@intel.com\u003e"},{"line_number":28,"context_line":"Co-Authored-By: Nir Magnezi \u003cnmagnezi@redhat.com\u003e"},{"line_number":29,"context_line":"Co-Authored-By: John Schwarz \u003cjschwarz@redhat.com\u003e"},{"line_number":30,"context_line":"Change-Id: I437290affd8eb87177d0626bf7935a165859cbdd"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":44,"id":"dae33548_20b05fdd","line":27,"in_reply_to":"3a57f1b5_5d894625","updated":"2016-02-14 14:30:33.000000000","message":"Done","commit_id":"9d0c2dd6f9468c0450f2e48c73f60b6cf10b8dd9"}],"neutron/extensions/portbindings.py":[{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"83454fe30d2b56bd42d754c69264ff879a46d2ba","unresolved":false,"context_lines":[{"line_number":45,"context_line":"#                     strategy for OVS should be used"},{"line_number":46,"context_line":"CAP_PORT_FILTER \u003d \u0027port_filter\u0027"},{"line_number":47,"context_line":"OVS_HYBRID_PLUG \u003d \u0027ovs_hybrid_plug\u0027"},{"line_number":48,"context_line":"MAX_BIND_TRIES \u003d 10"},{"line_number":49,"context_line":"VIF_DETAILS_VLAN \u003d \u0027vlan\u0027"},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"# The keys below are used in the VIF_DETAILS attribute to convey"}],"source_content_type":"text/x-python","patch_set":43,"id":"5a5ae5dd_0368a6b9","line":48,"updated":"2016-02-09 13:28:24.000000000","message":"Rebinding is ml2 specific behaviour. Why do we maintain the constant in common extension file?","commit_id":"bbe03658f0ce0da0e033a384b757f8bdb8a99463"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"2016987757521b5ac8012882fcca759604534208","unresolved":false,"context_lines":[{"line_number":45,"context_line":"#                     strategy for OVS should be used"},{"line_number":46,"context_line":"CAP_PORT_FILTER \u003d \u0027port_filter\u0027"},{"line_number":47,"context_line":"OVS_HYBRID_PLUG \u003d \u0027ovs_hybrid_plug\u0027"},{"line_number":48,"context_line":"MAX_BIND_TRIES \u003d 10"},{"line_number":49,"context_line":"VIF_DETAILS_VLAN \u003d \u0027vlan\u0027"},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"# The keys below are used in the VIF_DETAILS attribute to convey"}],"source_content_type":"text/x-python","patch_set":43,"id":"3a57f1b5_c3828252","line":48,"in_reply_to":"5a5ae5dd_0368a6b9","updated":"2016-02-10 15:05:58.000000000","message":"Done","commit_id":"bbe03658f0ce0da0e033a384b757f8bdb8a99463"}],"neutron/plugins/ml2/plugin.py":[{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"fa127d80b32cd1e86d36d6ac1148884a6c19dd49","unresolved":false,"context_lines":[{"line_number":249,"context_line":"        plugin_context \u003d context._plugin_context"},{"line_number":250,"context_line":"        port_id \u003d context._port[\u0027id\u0027]"},{"line_number":251,"context_line":""},{"line_number":252,"context_line":"        def _notify_port_updated(context):"},{"line_number":253,"context_line":"            if allow_notify and need_notify:"},{"line_number":254,"context_line":"                self._notify_port_updated(context)"},{"line_number":255,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"9a80dd14_74985678","line":252,"updated":"2015-03-09 12:29:53.000000000","message":"why don\u0027t you just use the context var from the outer method?","commit_id":"5b77132fdbfb54809198d02ba51e44a985cc54a4"},{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"2c60d5ce7b98c41e24d397f92d953795b96e081f","unresolved":false,"context_lines":[{"line_number":249,"context_line":"        plugin_context \u003d context._plugin_context"},{"line_number":250,"context_line":"        port_id \u003d context._port[\u0027id\u0027]"},{"line_number":251,"context_line":""},{"line_number":252,"context_line":"        def _notify_port_updated(context):"},{"line_number":253,"context_line":"            if allow_notify and need_notify:"},{"line_number":254,"context_line":"                self._notify_port_updated(context)"},{"line_number":255,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"9a80dd14_51c06d2a","line":252,"in_reply_to":"9a80dd14_5c0b4bd5","updated":"2015-03-11 00:47:35.000000000","message":"ok, it makes sense.","commit_id":"5b77132fdbfb54809198d02ba51e44a985cc54a4"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"b993ef65a25ca962c4779dda86576ca5536f3ec6","unresolved":false,"context_lines":[{"line_number":249,"context_line":"        plugin_context \u003d context._plugin_context"},{"line_number":250,"context_line":"        port_id \u003d context._port[\u0027id\u0027]"},{"line_number":251,"context_line":""},{"line_number":252,"context_line":"        def _notify_port_updated(context):"},{"line_number":253,"context_line":"            if allow_notify and need_notify:"},{"line_number":254,"context_line":"                self._notify_port_updated(context)"},{"line_number":255,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"9a80dd14_d7c2dae7","line":252,"in_reply_to":"9a80dd14_74985678","updated":"2015-03-09 17:10:20.000000000","message":"Because any later rename of the variable will break the code.","commit_id":"5b77132fdbfb54809198d02ba51e44a985cc54a4"},{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"bef98e677a20094843bddf22df8722ab045661d0","unresolved":false,"context_lines":[{"line_number":249,"context_line":"        plugin_context \u003d context._plugin_context"},{"line_number":250,"context_line":"        port_id \u003d context._port[\u0027id\u0027]"},{"line_number":251,"context_line":""},{"line_number":252,"context_line":"        def _notify_port_updated(context):"},{"line_number":253,"context_line":"            if allow_notify and need_notify:"},{"line_number":254,"context_line":"                self._notify_port_updated(context)"},{"line_number":255,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"9a80dd14_e4956133","line":252,"in_reply_to":"9a80dd14_d7c2dae7","updated":"2015-03-09 22:13:09.000000000","message":"isn\u0027t it same for other vars?  (allow_notify and need_notify)","commit_id":"5b77132fdbfb54809198d02ba51e44a985cc54a4"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"cf5167cb90a22a0a2969887a5b80beb01cf2d4da","unresolved":false,"context_lines":[{"line_number":249,"context_line":"        plugin_context \u003d context._plugin_context"},{"line_number":250,"context_line":"        port_id \u003d context._port[\u0027id\u0027]"},{"line_number":251,"context_line":""},{"line_number":252,"context_line":"        def _notify_port_updated(context):"},{"line_number":253,"context_line":"            if allow_notify and need_notify:"},{"line_number":254,"context_line":"                self._notify_port_updated(context)"},{"line_number":255,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"9a80dd14_5c0b4bd5","line":252,"in_reply_to":"9a80dd14_e4956133","updated":"2015-03-10 10:31:59.000000000","message":"It\u0027s not exactly the same. I don\u0027t see a big reason for someone to rename allow_notify or need_notify, but for context, we actually maintain two context objects in the method (context and new_context), and so it\u0027s better to be explicit here.","commit_id":"5b77132fdbfb54809198d02ba51e44a985cc54a4"},{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"b550a1d19915bbc07a81f914d245f649078a8250","unresolved":false,"context_lines":[{"line_number":251,"context_line":""},{"line_number":252,"context_line":"        def _notify_port_updated(context):"},{"line_number":253,"context_line":"            if allow_notify and need_notify:"},{"line_number":254,"context_line":"                self._notify_port_updated(context)"},{"line_number":255,"context_line":""},{"line_number":256,"context_line":"        # Since the mechanism driver bind_port() calls must be made"},{"line_number":257,"context_line":"        # outside a DB transaction locking the port state, it is"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a80dd14_710491c6","line":254,"updated":"2015-03-11 00:46:49.000000000","message":"can you avoid shadowing the outer context var?","commit_id":"70c40491114c42c27315206a3f959a338018f1f0"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"951545b4a103a30e05df4629adb7387433e9735c","unresolved":false,"context_lines":[{"line_number":251,"context_line":""},{"line_number":252,"context_line":"        def _notify_port_updated(context):"},{"line_number":253,"context_line":"            if allow_notify and need_notify:"},{"line_number":254,"context_line":"                self._notify_port_updated(context)"},{"line_number":255,"context_line":""},{"line_number":256,"context_line":"        # Since the mechanism driver bind_port() calls must be made"},{"line_number":257,"context_line":"        # outside a DB transaction locking the port state, it is"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a80dd14_fe51120f","line":254,"in_reply_to":"9a80dd14_710491c6","updated":"2015-03-11 13:53:21.000000000","message":"OK, will do once I get results from tripleO checks on the whole approach.","commit_id":"70c40491114c42c27315206a3f959a338018f1f0"},{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"b550a1d19915bbc07a81f914d245f649078a8250","unresolved":false,"context_lines":[{"line_number":309,"context_line":""},{"line_number":310,"context_line":"            if (new_context._binding.vif_type \u003d\u003d"},{"line_number":311,"context_line":"                    portbindings.VIF_TYPE_BINDING_FAILED):"},{"line_number":312,"context_line":"                _notify_port_updated(context)"},{"line_number":313,"context_line":"                return context"},{"line_number":314,"context_line":"            # Need to notify if we succeed and our results were"},{"line_number":315,"context_line":"            # committed."}],"source_content_type":"text/x-python","patch_set":4,"id":"9a80dd14_b198c96b","line":312,"updated":"2015-03-11 00:46:49.000000000","message":"shouldn\u0027t this be new_context if you want to keep the exisiting behaviour?","commit_id":"70c40491114c42c27315206a3f959a338018f1f0"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"9e7859a39c06e1fddb542edd4b93e04612b1d8a9","unresolved":false,"context_lines":[{"line_number":309,"context_line":""},{"line_number":310,"context_line":"            if (new_context._binding.vif_type \u003d\u003d"},{"line_number":311,"context_line":"                    portbindings.VIF_TYPE_BINDING_FAILED):"},{"line_number":312,"context_line":"                _notify_port_updated(context)"},{"line_number":313,"context_line":"                return context"},{"line_number":314,"context_line":"            # Need to notify if we succeed and our results were"},{"line_number":315,"context_line":"            # committed."}],"source_content_type":"text/x-python","patch_set":4,"id":"9a80dd14_94763705","line":312,"in_reply_to":"9a80dd14_5e393ed7","updated":"2015-03-11 14:40:37.000000000","message":"OK, I see another issue with the current version of the patch. Specifically, context object can be modified by _commit_port_binding(), changing the vif_type, among other things. So we need to use new_context if we were not in BINDING_FAILED mode already when the method was called.","commit_id":"70c40491114c42c27315206a3f959a338018f1f0"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"951545b4a103a30e05df4629adb7387433e9735c","unresolved":false,"context_lines":[{"line_number":309,"context_line":""},{"line_number":310,"context_line":"            if (new_context._binding.vif_type \u003d\u003d"},{"line_number":311,"context_line":"                    portbindings.VIF_TYPE_BINDING_FAILED):"},{"line_number":312,"context_line":"                _notify_port_updated(context)"},{"line_number":313,"context_line":"                return context"},{"line_number":314,"context_line":"            # Need to notify if we succeed and our results were"},{"line_number":315,"context_line":"            # committed."}],"source_content_type":"text/x-python","patch_set":4,"id":"9a80dd14_5e393ed7","line":312,"in_reply_to":"9a80dd14_b198c96b","updated":"2015-03-11 13:53:21.000000000","message":"No, we should send the initial context if binding attempt failed. Before, we immediately sent the notification, but now we try once.\n\nIf we attempt to use new_context, then notification is not actually sent, because new_context misses some data, specifically context.bottom_bound_segment that is not present in new_context if binding attempt failed. If it\u0027s not present, _notify_port_updated() won\u0027t do anything (L521).","commit_id":"70c40491114c42c27315206a3f959a338018f1f0"},{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"b550a1d19915bbc07a81f914d245f649078a8250","unresolved":false,"context_lines":[{"line_number":310,"context_line":"            if (new_context._binding.vif_type \u003d\u003d"},{"line_number":311,"context_line":"                    portbindings.VIF_TYPE_BINDING_FAILED):"},{"line_number":312,"context_line":"                _notify_port_updated(context)"},{"line_number":313,"context_line":"                return context"},{"line_number":314,"context_line":"            # Need to notify if we succeed and our results were"},{"line_number":315,"context_line":"            # committed."},{"line_number":316,"context_line":"            need_notify |\u003d did_commit"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a80dd14_91bae5be","line":313,"updated":"2015-03-11 00:46:49.000000000","message":"ditto","commit_id":"70c40491114c42c27315206a3f959a338018f1f0"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"07789f45006c0243c61b57dbd7b35d8447724812","unresolved":false,"context_lines":[{"line_number":275,"context_line":"            binding_failed_before \u003d _is_context_binding_failed(context)"},{"line_number":276,"context_line":""},{"line_number":277,"context_line":"            if ((binding.vif_type !\u003d portbindings.VIF_TYPE_UNBOUND and"},{"line_number":278,"context_line":"                (not binding_failed_before))"},{"line_number":279,"context_line":"                or not binding.host):"},{"line_number":280,"context_line":"                # We either don\u0027t need to bind the port, or can\u0027t, so"},{"line_number":281,"context_line":"                # notify if needed and return."}],"source_content_type":"text/x-python","patch_set":7,"id":"9a80dd14_53f4705a","line":278,"updated":"2015-03-13 10:17:43.000000000","message":"are you wrapping \"not binding_failed_before\" in parentheses for readability? I don\u0027t think operator precedent requires it.","commit_id":"c4c6df54fb36b70f715705ad2813e28ef921680f"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"07789f45006c0243c61b57dbd7b35d8447724812","unresolved":false,"context_lines":[{"line_number":279,"context_line":"                or not binding.host):"},{"line_number":280,"context_line":"                # We either don\u0027t need to bind the port, or can\u0027t, so"},{"line_number":281,"context_line":"                # notify if needed and return."},{"line_number":282,"context_line":"                _notify_port_updated(context)"},{"line_number":283,"context_line":"                return context"},{"line_number":284,"context_line":""},{"line_number":285,"context_line":"            # Limit binding attempts to avoid any possibility of"}],"source_content_type":"text/x-python","patch_set":7,"id":"9a80dd14_d6376ee1","line":282,"updated":"2015-03-13 10:17:43.000000000","message":"this notifies only if the binding if not failed \"before\" - which means if the current context of the port does not have a failed binding status.\n\nOk - let\u0027s move to line 315","commit_id":"c4c6df54fb36b70f715705ad2813e28ef921680f"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"07789f45006c0243c61b57dbd7b35d8447724812","unresolved":false,"context_lines":[{"line_number":313,"context_line":"                          port_id)"},{"line_number":314,"context_line":"                return context"},{"line_number":315,"context_line":""},{"line_number":316,"context_line":"            if _is_context_binding_failed(new_context):"},{"line_number":317,"context_line":"                if not binding_failed_before:"},{"line_number":318,"context_line":"                    context \u003d new_context"},{"line_number":319,"context_line":"                _notify_port_updated(context)"}],"source_content_type":"text/x-python","patch_set":7,"id":"9a80dd14_16458642","line":316,"updated":"2015-03-13 10:17:43.000000000","message":"We enter this block if when re-binding the port we had a failure.\nIf the binding was not failed when we entered this iteration then we notify with the new_context, otherwise we notify with the old context.\n\nWhy this difference? I cannot grasp it from the commit message\n\nAlso the only case where you enter another iteration of the loop and is_binding_failed_before\u003dTrue would be in case the binding succeeds this time. And therefore you\u0027ll notify and return because is_context_binding_before will return False this time. But still it seems you have no reason for reassigning context to new_context at line 318.","commit_id":"c4c6df54fb36b70f715705ad2813e28ef921680f"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"a17d6f3c07940f252251ddab009f39c7679736e7","unresolved":false,"context_lines":[{"line_number":313,"context_line":"                          port_id)"},{"line_number":314,"context_line":"                return context"},{"line_number":315,"context_line":""},{"line_number":316,"context_line":"            if _is_context_binding_failed(new_context):"},{"line_number":317,"context_line":"                if not binding_failed_before:"},{"line_number":318,"context_line":"                    context \u003d new_context"},{"line_number":319,"context_line":"                _notify_port_updated(context)"}],"source_content_type":"text/x-python","patch_set":7,"id":"9a80dd14_5d902d96","line":316,"in_reply_to":"9a80dd14_16458642","updated":"2015-03-18 16:03:00.000000000","message":"The difference is because new context lacks segmentation binding data, so notify will just do nothing. So if we want notification to happen (and we do), we are left with reusing the old context.","commit_id":"c4c6df54fb36b70f715705ad2813e28ef921680f"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"117a238cf25237c38d19c81609be75682ee855ac","unresolved":false,"context_lines":[{"line_number":290,"context_line":"                    return context"},{"line_number":291,"context_line":""},{"line_number":292,"context_line":"                # do not yield for the very first binding attempt"},{"line_number":293,"context_line":"                if count:"},{"line_number":294,"context_line":"                    greenthread.sleep(0)  # yield"},{"line_number":295,"context_line":"                    LOG.info(_LI(\"Attempt %(count)s to bind port %(port)s\"),"},{"line_number":296,"context_line":"                             {\u0027count\u0027: count, \u0027port\u0027: port_id})"}],"source_content_type":"text/x-python","patch_set":11,"id":"1a6ced46_82f8efe6","line":293,"updated":"2015-03-22 23:21:09.000000000","message":"it seems that you\u0027re building this method in a way that even at the very first binding attempt count \u003d\u003d 1  (you\u0027re incrementing it at line 284)","commit_id":"d173e2b9de245c376a05c35406faee42acc011c7"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"88f3527d75a1e57037912b6b9ed4987e357551cb","unresolved":false,"context_lines":[{"line_number":290,"context_line":"                    return context"},{"line_number":291,"context_line":""},{"line_number":292,"context_line":"                # do not yield for the very first binding attempt"},{"line_number":293,"context_line":"                if count:"},{"line_number":294,"context_line":"                    greenthread.sleep(0)  # yield"},{"line_number":295,"context_line":"                    LOG.info(_LI(\"Attempt %(count)s to bind port %(port)s\"),"},{"line_number":296,"context_line":"                             {\u0027count\u0027: count, \u0027port\u0027: port_id})"}],"source_content_type":"text/x-python","patch_set":11,"id":"1a6ced46_969c966b","line":293,"in_reply_to":"1a6ced46_6063ebb1","updated":"2015-03-23 15:16:58.000000000","message":"Oh right. Refactoring didn\u0027t play nice in this regard.","commit_id":"d173e2b9de245c376a05c35406faee42acc011c7"},{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"bd81dff8904ed5b32f9184d8ab4ad4491252c3f0","unresolved":false,"context_lines":[{"line_number":290,"context_line":"                    return context"},{"line_number":291,"context_line":""},{"line_number":292,"context_line":"                # do not yield for the very first binding attempt"},{"line_number":293,"context_line":"                if count:"},{"line_number":294,"context_line":"                    greenthread.sleep(0)  # yield"},{"line_number":295,"context_line":"                    LOG.info(_LI(\"Attempt %(count)s to bind port %(port)s\"),"},{"line_number":296,"context_line":"                             {\u0027count\u0027: count, \u0027port\u0027: port_id})"}],"source_content_type":"text/x-python","patch_set":11,"id":"1a6ced46_6063ebb1","line":293,"in_reply_to":"1a6ced46_82f8efe6","updated":"2015-03-23 03:05:06.000000000","message":"+1","commit_id":"d173e2b9de245c376a05c35406faee42acc011c7"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"117a238cf25237c38d19c81609be75682ee855ac","unresolved":false,"context_lines":[{"line_number":300,"context_line":"                bind_context \u003d self._bind_port(context)"},{"line_number":301,"context_line":""},{"line_number":302,"context_line":"                # Now try to commit result of attempting to bind the port."},{"line_number":303,"context_line":"                new_context, did_commit \u003d self._commit_port_binding("},{"line_number":304,"context_line":"                    plugin_context, port_id, binding, bind_context)"},{"line_number":305,"context_line":"                if not new_context:"},{"line_number":306,"context_line":"                    # The port has been deleted concurrently, so just"}],"source_content_type":"text/x-python","patch_set":11,"id":"1a6ced46_a2dc0b76","line":303,"updated":"2015-03-22 23:21:09.000000000","message":"I am a bit unsure about the semantics of this \u0027did_commit\u0027 variable - I do not think this actually means that the transaction committed to the DB because of we\u0027re likely to be in a nested transaction here.\n\n\nThis should be totally irrelevant to your bug, unless there\u0027s a chance that the failure might be caused by did_commit\u003dTrue and then seeing a subsequent failure for DBduplicatedentry or similar","commit_id":"d173e2b9de245c376a05c35406faee42acc011c7"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"88f3527d75a1e57037912b6b9ed4987e357551cb","unresolved":false,"context_lines":[{"line_number":300,"context_line":"                bind_context \u003d self._bind_port(context)"},{"line_number":301,"context_line":""},{"line_number":302,"context_line":"                # Now try to commit result of attempting to bind the port."},{"line_number":303,"context_line":"                new_context, did_commit \u003d self._commit_port_binding("},{"line_number":304,"context_line":"                    plugin_context, port_id, binding, bind_context)"},{"line_number":305,"context_line":"                if not new_context:"},{"line_number":306,"context_line":"                    # The port has been deleted concurrently, so just"}],"source_content_type":"text/x-python","patch_set":11,"id":"1a6ced46_f6830aca","line":303,"in_reply_to":"1a6ced46_9263cbb0","updated":"2015-03-23 15:16:58.000000000","message":"did_commit \u003d\u003d True only if port was bound by THIS thread (there are also cases when another thread does it in parallel, or changes some settings of the port like vnic_type or host). So if WE bound the port, then we send notification with the context, otherwise, we retry to make sure we do actual attempt.","commit_id":"d173e2b9de245c376a05c35406faee42acc011c7"},{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"bd81dff8904ed5b32f9184d8ab4ad4491252c3f0","unresolved":false,"context_lines":[{"line_number":300,"context_line":"                bind_context \u003d self._bind_port(context)"},{"line_number":301,"context_line":""},{"line_number":302,"context_line":"                # Now try to commit result of attempting to bind the port."},{"line_number":303,"context_line":"                new_context, did_commit \u003d self._commit_port_binding("},{"line_number":304,"context_line":"                    plugin_context, port_id, binding, bind_context)"},{"line_number":305,"context_line":"                if not new_context:"},{"line_number":306,"context_line":"                    # The port has been deleted concurrently, so just"}],"source_content_type":"text/x-python","patch_set":11,"id":"1a6ced46_c04adf26","line":303,"in_reply_to":"1a6ced46_a2dc0b76","updated":"2015-03-23 03:05:06.000000000","message":"Salvatore,\nthis method is expected to be called out of transaction.\nactually it\u0027s the whole point of these methods.\nie. bind_port out of transaction.","commit_id":"d173e2b9de245c376a05c35406faee42acc011c7"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"b3e0ba0959a5db1f7b7d241c0b8c36f817c7ea62","unresolved":false,"context_lines":[{"line_number":300,"context_line":"                bind_context \u003d self._bind_port(context)"},{"line_number":301,"context_line":""},{"line_number":302,"context_line":"                # Now try to commit result of attempting to bind the port."},{"line_number":303,"context_line":"                new_context, did_commit \u003d self._commit_port_binding("},{"line_number":304,"context_line":"                    plugin_context, port_id, binding, bind_context)"},{"line_number":305,"context_line":"                if not new_context:"},{"line_number":306,"context_line":"                    # The port has been deleted concurrently, so just"}],"source_content_type":"text/x-python","patch_set":11,"id":"1a6ced46_9263cbb0","line":303,"in_reply_to":"1a6ced46_c04adf26","updated":"2015-03-23 12:13:52.000000000","message":"if you say so that\u0027s fine. I am usually wary of taking that for granted especially since _commit_port_binding uses subtransactions\u003dTrue meanign that probably it expects to be called from within a transaction.\n\nAs I said, this is however irrelevant for this patch.","commit_id":"d173e2b9de245c376a05c35406faee42acc011c7"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"117a238cf25237c38d19c81609be75682ee855ac","unresolved":false,"context_lines":[{"line_number":305,"context_line":"                if not new_context:"},{"line_number":306,"context_line":"                    # The port has been deleted concurrently, so just"},{"line_number":307,"context_line":"                    # return the unbound result from the initial"},{"line_number":308,"context_line":"                    # transaction that completed before the deletion."},{"line_number":309,"context_line":"                    LOG.debug(\"Port %s has been deleted concurrently\","},{"line_number":310,"context_line":"                              port_id)"},{"line_number":311,"context_line":"                    return context"}],"source_content_type":"text/x-python","patch_set":11,"id":"1a6ced46_c2d90785","line":308,"updated":"2015-03-22 23:21:09.000000000","message":"still possibly completely irrelevant to your work, but are we making assumptions here on the transaction isolation level to be READ COMMITED?\n\nI\u0027m just asking your opinion as you\u0027ve surely studied this code more thoroughly than me","commit_id":"d173e2b9de245c376a05c35406faee42acc011c7"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"88f3527d75a1e57037912b6b9ed4987e357551cb","unresolved":false,"context_lines":[{"line_number":305,"context_line":"                if not new_context:"},{"line_number":306,"context_line":"                    # The port has been deleted concurrently, so just"},{"line_number":307,"context_line":"                    # return the unbound result from the initial"},{"line_number":308,"context_line":"                    # transaction that completed before the deletion."},{"line_number":309,"context_line":"                    LOG.debug(\"Port %s has been deleted concurrently\","},{"line_number":310,"context_line":"                              port_id)"},{"line_number":311,"context_line":"                    return context"}],"source_content_type":"text/x-python","patch_set":11,"id":"1a6ced46_76aaba1a","line":308,"in_reply_to":"1a6ced46_c2d90785","updated":"2015-03-23 15:16:58.000000000","message":"No, we run the method in a new transaction and handle the case when another thread removed the port while we freed and re-aquired db access in ml2 driver.","commit_id":"d173e2b9de245c376a05c35406faee42acc011c7"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"117a238cf25237c38d19c81609be75682ee855ac","unresolved":false,"context_lines":[{"line_number":313,"context_line":"                if did_commit:"},{"line_number":314,"context_line":"                    if not _is_context_binding_failed(new_context):"},{"line_number":315,"context_line":"                        # always notify for successful binding"},{"line_number":316,"context_line":"                        need_notify \u003d True"},{"line_number":317,"context_line":"                    elif vif_type \u003d\u003d portbindings.VIF_TYPE_BINDING_FAILED:"},{"line_number":318,"context_line":"                        # reuse the old context since it contained all the"},{"line_number":319,"context_line":"                        # needed segmentation data needed for notifications"}],"source_content_type":"text/x-python","patch_set":11,"id":"1a6ced46_22d01b53","line":316,"updated":"2015-03-22 23:21:09.000000000","message":"as need_notify is only updated here, in the case the binding is failed, need_notify should be False.\n\nIt seems like the notification then won\u0027t be sent, while the commit message says otherwise. I might just be confused here - if so please forgive me for my ignorance.","commit_id":"d173e2b9de245c376a05c35406faee42acc011c7"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"88f3527d75a1e57037912b6b9ed4987e357551cb","unresolved":false,"context_lines":[{"line_number":313,"context_line":"                if did_commit:"},{"line_number":314,"context_line":"                    if not _is_context_binding_failed(new_context):"},{"line_number":315,"context_line":"                        # always notify for successful binding"},{"line_number":316,"context_line":"                        need_notify \u003d True"},{"line_number":317,"context_line":"                    elif vif_type \u003d\u003d portbindings.VIF_TYPE_BINDING_FAILED:"},{"line_number":318,"context_line":"                        # reuse the old context since it contained all the"},{"line_number":319,"context_line":"                        # needed segmentation data needed for notifications"}],"source_content_type":"text/x-python","patch_set":11,"id":"1a6ced46_565bfe53","line":316,"in_reply_to":"1a6ced46_22d01b53","updated":"2015-03-23 15:16:58.000000000","message":"need_notify is passed to us by caller. Sometimes (like in case of Ironic), when you update dhcp options for the port, need_notify is enforced to be True, so we should propagate the notification no matter whether we failed to bind the port (that is actually exactly what fixes the regression that was introduced by the 1st iteration of the patch).","commit_id":"d173e2b9de245c376a05c35406faee42acc011c7"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"8908cbc4e9d3f3a4d4e6c037315b008960d39f71","unresolved":false,"context_lines":[{"line_number":244,"context_line":"        self._update_port_dict_binding(port, binding)"},{"line_number":245,"context_line":"        return changes"},{"line_number":246,"context_line":""},{"line_number":247,"context_line":"    def _bind_port_if_needed(self, context, allow_notify\u003dFalse,"},{"line_number":248,"context_line":"                             need_notify\u003dFalse):"},{"line_number":249,"context_line":"        plugin_context \u003d context._plugin_context"},{"line_number":250,"context_line":"        port_id \u003d context._port[\u0027id\u0027]"}],"source_content_type":"text/x-python","patch_set":12,"id":"fa32b979_5eecf4f2","line":247,"updated":"2015-06-22 19:38:47.000000000","message":"I\u0027m with Armando on this. This function now contains 90% of what Neutron does. :)\nCan you do a separate patch that breaks this down into much easier to understand functions? Then this patch can just be the necessary changes for rebinding failed ports.","commit_id":"37b872468220057c85971f8b1aae7c804f60a715"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"4f5e60cdccb71ed4a79c7bed47516ea6db8e21f1","unresolved":false,"context_lines":[{"line_number":244,"context_line":"        self._update_port_dict_binding(port, binding)"},{"line_number":245,"context_line":"        return changes"},{"line_number":246,"context_line":""},{"line_number":247,"context_line":"    def _bind_port_if_needed(self, context, allow_notify\u003dFalse,"},{"line_number":248,"context_line":"                             need_notify\u003dFalse):"},{"line_number":249,"context_line":"        plugin_context \u003d context._plugin_context"},{"line_number":250,"context_line":"        port_id \u003d context._port[\u0027id\u0027]"}],"source_content_type":"text/x-python","patch_set":12,"id":"1a6ced46_9348162f","line":247,"updated":"2015-03-23 21:07:53.000000000","message":"this method has grown beyond proportion of any sensible practice...now we even had two nested methods...this is utterly impossible to test and even understand what it does...the amount of debt we\u0027re carrying is making really nervous...","commit_id":"37b872468220057c85971f8b1aae7c804f60a715"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"fe30703441e5fc58930017b9f682980afd04d94d","unresolved":false,"context_lines":[{"line_number":244,"context_line":"        self._update_port_dict_binding(port, binding)"},{"line_number":245,"context_line":"        return changes"},{"line_number":246,"context_line":""},{"line_number":247,"context_line":"    def _bind_port_if_needed(self, context, allow_notify\u003dFalse,"},{"line_number":248,"context_line":"                             need_notify\u003dFalse):"},{"line_number":249,"context_line":"        plugin_context \u003d context._plugin_context"},{"line_number":250,"context_line":"        port_id \u003d context._port[\u0027id\u0027]"}],"source_content_type":"text/x-python","patch_set":12,"id":"ba15a1d1_d0c3ae87","line":247,"in_reply_to":"1a6ced46_9348162f","updated":"2015-09-17 11:18:13.000000000","message":"Done","commit_id":"37b872468220057c85971f8b1aae7c804f60a715"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"fe30703441e5fc58930017b9f682980afd04d94d","unresolved":false,"context_lines":[{"line_number":244,"context_line":"        self._update_port_dict_binding(port, binding)"},{"line_number":245,"context_line":"        return changes"},{"line_number":246,"context_line":""},{"line_number":247,"context_line":"    def _bind_port_if_needed(self, context, allow_notify\u003dFalse,"},{"line_number":248,"context_line":"                             need_notify\u003dFalse):"},{"line_number":249,"context_line":"        plugin_context \u003d context._plugin_context"},{"line_number":250,"context_line":"        port_id \u003d context._port[\u0027id\u0027]"}],"source_content_type":"text/x-python","patch_set":12,"id":"ba15a1d1_f03ef289","line":247,"in_reply_to":"fa32b979_5eecf4f2","updated":"2015-09-17 11:18:13.000000000","message":"Done, Thanks for refactoring! rebased on your work.","commit_id":"37b872468220057c85971f8b1aae7c804f60a715"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"36dd1e183b4488f2e516a85c9524baa8c5528895","unresolved":false,"context_lines":[{"line_number":331,"context_line":"                        portbindings.VIF_TYPE_BINDING_FAILED):"},{"line_number":332,"context_line":"                    # always notify for successful binding"},{"line_number":333,"context_line":"                    need_notify \u003d True"},{"line_number":334,"context_line":"                elif binding.vif_type \u003d\u003d portbindings.VIF_TYPE_BINDING_FAILED:"},{"line_number":335,"context_line":"                    # reuse the old context since it contained all the"},{"line_number":336,"context_line":"                    # needed segmentation data needed for notifications"},{"line_number":337,"context_line":"                    new_context \u003d context"}],"source_content_type":"text/x-python","patch_set":15,"id":"ba15a1d1_7caba375","line":334,"updated":"2015-09-17 09:45:26.000000000","message":"The elif is not needed since it will always result in True. Just else should work.","commit_id":"6496d0869633b1a43428dcb1736608a57ab29236"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"0c674da1093be62a4d278013b58639ab81d911ee","unresolved":false,"context_lines":[{"line_number":331,"context_line":"                        portbindings.VIF_TYPE_BINDING_FAILED):"},{"line_number":332,"context_line":"                    # always notify for successful binding"},{"line_number":333,"context_line":"                    need_notify \u003d True"},{"line_number":334,"context_line":"                elif binding.vif_type \u003d\u003d portbindings.VIF_TYPE_BINDING_FAILED:"},{"line_number":335,"context_line":"                    # reuse the old context since it contained all the"},{"line_number":336,"context_line":"                    # needed segmentation data needed for notifications"},{"line_number":337,"context_line":"                    new_context \u003d context"}],"source_content_type":"text/x-python","patch_set":15,"id":"ba15a1d1_b015da40","line":334,"in_reply_to":"ba15a1d1_7caba375","updated":"2015-09-17 11:18:34.000000000","message":"Done","commit_id":"6496d0869633b1a43428dcb1736608a57ab29236"},{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"f1db1bc45e302ffd1f104721ca9b256e65391848","unresolved":false,"context_lines":[{"line_number":328,"context_line":""},{"line_number":329,"context_line":"            if did_commit:"},{"line_number":330,"context_line":"                if not (new_context._binding.vif_type \u003d\u003d"},{"line_number":331,"context_line":"                        portbindings.VIF_TYPE_BINDING_FAILED):"},{"line_number":332,"context_line":"                    # always notify for successful binding"},{"line_number":333,"context_line":"                    need_notify \u003d True"},{"line_number":334,"context_line":"                else:"}],"source_content_type":"text/x-python","patch_set":16,"id":"ba15a1d1_cb2463c6","line":331,"updated":"2015-09-17 11:58:11.000000000","message":"you can avoid \"not\" by swapping statements or use \"!\u003d\".","commit_id":"7e0d8caeb0d4b77c3a610ac6d8b7521592aae885"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"55714559d4e79da8836ec632bac98b54263074b6","unresolved":false,"context_lines":[{"line_number":328,"context_line":""},{"line_number":329,"context_line":"            if did_commit:"},{"line_number":330,"context_line":"                if not (new_context._binding.vif_type \u003d\u003d"},{"line_number":331,"context_line":"                        portbindings.VIF_TYPE_BINDING_FAILED):"},{"line_number":332,"context_line":"                    # always notify for successful binding"},{"line_number":333,"context_line":"                    need_notify \u003d True"},{"line_number":334,"context_line":"                else:"}],"source_content_type":"text/x-python","patch_set":16,"id":"ba15a1d1_d3540ecb","line":331,"in_reply_to":"ba15a1d1_cb2463c6","updated":"2015-10-29 14:00:56.000000000","message":"Done","commit_id":"7e0d8caeb0d4b77c3a610ac6d8b7521592aae885"},{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"f1db1bc45e302ffd1f104721ca9b256e65391848","unresolved":false,"context_lines":[{"line_number":339,"context_line":"                # binding was committed, just notify and return"},{"line_number":340,"context_line":"                return new_context, need_notify, try_again"},{"line_number":341,"context_line":""},{"line_number":342,"context_line":"            # this attempt failed; retry with the new context"},{"line_number":343,"context_line":"            context \u003d new_context"},{"line_number":344,"context_line":""},{"line_number":345,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":16,"id":"ba15a1d1_1d84de5b","line":342,"updated":"2015-09-17 11:58:11.000000000","message":"missing try_again \u003d True ?","commit_id":"7e0d8caeb0d4b77c3a610ac6d8b7521592aae885"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"55714559d4e79da8836ec632bac98b54263074b6","unresolved":false,"context_lines":[{"line_number":339,"context_line":"                # binding was committed, just notify and return"},{"line_number":340,"context_line":"                return new_context, need_notify, try_again"},{"line_number":341,"context_line":""},{"line_number":342,"context_line":"            # this attempt failed; retry with the new context"},{"line_number":343,"context_line":"            context \u003d new_context"},{"line_number":344,"context_line":""},{"line_number":345,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":16,"id":"ba15a1d1_33a098a5","line":342,"in_reply_to":"ba15a1d1_1d84de5b","updated":"2015-10-29 14:00:56.000000000","message":"Done","commit_id":"7e0d8caeb0d4b77c3a610ac6d8b7521592aae885"},{"author":{"_account_id":15130,"name":"Sonu","email":"sonu.sudhakaran@gmail.com","username":"sonu"},"change_message_id":"02d69374a2a5914a9abfa8fb0e5047d12b0e5901","unresolved":false,"context_lines":[{"line_number":345,"context_line":"        else:"},{"line_number":346,"context_line":"            # for other binding states, or when we don\u0027t know which host"},{"line_number":347,"context_line":"            # should be used for binding, just notify and bail out"},{"line_number":348,"context_line":"            need_notify \u003d True"},{"line_number":349,"context_line":""},{"line_number":350,"context_line":"        return context, need_notify, try_again"},{"line_number":351,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"ba15a1d1_e0855dad","line":348,"updated":"2015-09-21 08:41:16.000000000","message":"Is it not, the need_notify be set only on did_commit\u003dTrue? Why port update should be send otherwise.","commit_id":"7e0d8caeb0d4b77c3a610ac6d8b7521592aae885"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"bf414d804525bd6caf6066f79bb0b484a2733ea8","unresolved":false,"context_lines":[{"line_number":285,"context_line":"                context, need_notify)"},{"line_number":286,"context_line":"            if (not try_again or"},{"line_number":287,"context_line":"                # don\u0027t proceed with attempts if the port was FAILED before"},{"line_number":288,"context_line":"                binding_type \u003d\u003d portbindings.VIF_TYPE_BINDING_FAILED):"},{"line_number":289,"context_line":"                if allow_notify and need_notify:"},{"line_number":290,"context_line":"                    self._notify_port_updated(context)"},{"line_number":291,"context_line":"                return context"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa80f949_53163df2","line":288,"updated":"2015-11-05 08:55:47.000000000","message":"Should this check move into _attempt_binding, where it will influence the value of try_again returned into the function?","commit_id":"07bf596df8a3336ab7af58f8b4b258a843a2913f"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"64c4cf83ae787ff02eff4959a8db3de73ee5843f","unresolved":false,"context_lines":[{"line_number":285,"context_line":"                context, need_notify)"},{"line_number":286,"context_line":"            if (not try_again or"},{"line_number":287,"context_line":"                # don\u0027t proceed with attempts if the port was FAILED before"},{"line_number":288,"context_line":"                binding_type \u003d\u003d portbindings.VIF_TYPE_BINDING_FAILED):"},{"line_number":289,"context_line":"                if allow_notify and need_notify:"},{"line_number":290,"context_line":"                    self._notify_port_updated(context)"},{"line_number":291,"context_line":"                return context"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa80f949_26fb32c3","line":288,"in_reply_to":"fa80f949_53163df2","updated":"2015-11-05 10:12:11.000000000","message":"Indeed, See patchset 20 line 343.","commit_id":"07bf596df8a3336ab7af58f8b4b258a843a2913f"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"64ad6849f3b004715de227751f8394cdc13848ac","unresolved":false,"context_lines":[{"line_number":341,"context_line":"                    try_again \u003d True"},{"line_number":342,"context_line":"                    context \u003d bind_context"},{"line_number":343,"context_line":"                else:"},{"line_number":344,"context_line":"                    # We have failed before, commit the context"},{"line_number":345,"context_line":"                    # notify and bail out."},{"line_number":346,"context_line":"                    new_context, _ \u003d self._commit_port_binding("},{"line_number":347,"context_line":"                        plugin_context, port_id, binding, bind_context)"}],"source_content_type":"text/x-python","patch_set":20,"id":"fa80f949_ba9ce05d","line":344,"updated":"2015-11-06 12:44:41.000000000","message":"I believe there should be a comma at the end","commit_id":"faa4b17c12b18a9f67cf384b6d42ad2271ef992c"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"b3601e879b40b96378f9cfdbd8efc6a6a8ad33b5","unresolved":false,"context_lines":[{"line_number":341,"context_line":"                    try_again \u003d True"},{"line_number":342,"context_line":"                    context \u003d bind_context"},{"line_number":343,"context_line":"                else:"},{"line_number":344,"context_line":"                    # We have failed before, commit the context"},{"line_number":345,"context_line":"                    # notify and bail out."},{"line_number":346,"context_line":"                    new_context, _ \u003d self._commit_port_binding("},{"line_number":347,"context_line":"                        plugin_context, port_id, binding, bind_context)"}],"source_content_type":"text/x-python","patch_set":20,"id":"da85f559_f3af6ce1","line":344,"in_reply_to":"fa80f949_ba9ce05d","updated":"2015-11-09 15:08:09.000000000","message":"Done","commit_id":"faa4b17c12b18a9f67cf384b6d42ad2271ef992c"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"64ad6849f3b004715de227751f8394cdc13848ac","unresolved":false,"context_lines":[{"line_number":343,"context_line":"                else:"},{"line_number":344,"context_line":"                    # We have failed before, commit the context"},{"line_number":345,"context_line":"                    # notify and bail out."},{"line_number":346,"context_line":"                    new_context, _ \u003d self._commit_port_binding("},{"line_number":347,"context_line":"                        plugin_context, port_id, binding, bind_context)"},{"line_number":348,"context_line":"                    need_notify \u003d True"},{"line_number":349,"context_line":"                    context \u003d new_context"}],"source_content_type":"text/x-python","patch_set":20,"id":"fa80f949_bab380e8","line":346,"updated":"2015-11-06 12:44:41.000000000","message":"Doesn\u0027t did_commit \u003d\u003d False case require separate handling?","commit_id":"faa4b17c12b18a9f67cf384b6d42ad2271ef992c"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"b3601e879b40b96378f9cfdbd8efc6a6a8ad33b5","unresolved":false,"context_lines":[{"line_number":343,"context_line":"                else:"},{"line_number":344,"context_line":"                    # We have failed before, commit the context"},{"line_number":345,"context_line":"                    # notify and bail out."},{"line_number":346,"context_line":"                    new_context, _ \u003d self._commit_port_binding("},{"line_number":347,"context_line":"                        plugin_context, port_id, binding, bind_context)"},{"line_number":348,"context_line":"                    need_notify \u003d True"},{"line_number":349,"context_line":"                    context \u003d new_context"}],"source_content_type":"text/x-python","patch_set":20,"id":"da85f559_7b826502","line":346,"in_reply_to":"fa80f949_bab380e8","updated":"2015-11-09 15:08:09.000000000","message":"Actually, yes.\nIn this patch, if we fail in to commit (thus, we skip the if in line 332) we simply return return context (which was modified by _bind_port) in line 357 and we don\u0027t try again.\nI wanted to be consistent with the behavior of that first if statement, So in the next patch-set I\u0027ve added a similar if statement with that behavior (also, this will return the context and not new_context in case of failure).","commit_id":"faa4b17c12b18a9f67cf384b6d42ad2271ef992c"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"64ad6849f3b004715de227751f8394cdc13848ac","unresolved":false,"context_lines":[{"line_number":359,"context_line":"    def _bind_port(self, orig_context):"},{"line_number":360,"context_line":"        # Construct a new PortContext from the one from the previous"},{"line_number":361,"context_line":"        # transaction."},{"line_number":362,"context_line":"        port \u003d copy.copy(orig_context.current)"},{"line_number":363,"context_line":"        orig_binding \u003d orig_context._binding"},{"line_number":364,"context_line":"        new_binding \u003d models.PortBinding("},{"line_number":365,"context_line":"            host\u003dorig_binding.host,"}],"source_content_type":"text/x-python","patch_set":20,"id":"fa80f949_9a979c39","line":362,"updated":"2015-11-06 12:44:41.000000000","message":"do we still need it?","commit_id":"faa4b17c12b18a9f67cf384b6d42ad2271ef992c"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"b3601e879b40b96378f9cfdbd8efc6a6a8ad33b5","unresolved":false,"context_lines":[{"line_number":359,"context_line":"    def _bind_port(self, orig_context):"},{"line_number":360,"context_line":"        # Construct a new PortContext from the one from the previous"},{"line_number":361,"context_line":"        # transaction."},{"line_number":362,"context_line":"        port \u003d copy.copy(orig_context.current)"},{"line_number":363,"context_line":"        orig_binding \u003d orig_context._binding"},{"line_number":364,"context_line":"        new_binding \u003d models.PortBinding("},{"line_number":365,"context_line":"            host\u003dorig_binding.host,"}],"source_content_type":"text/x-python","patch_set":20,"id":"da85f559_0052c767","line":362,"in_reply_to":"fa80f949_9a979c39","updated":"2015-11-09 15:08:09.000000000","message":"Nop, removed.","commit_id":"faa4b17c12b18a9f67cf384b6d42ad2271ef992c"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"988579cdad6fd5cdafc17ed28ef75183b2d73598","unresolved":false,"context_lines":[{"line_number":269,"context_line":"        # Binding limit does not need to be tunable because no"},{"line_number":270,"context_line":"        # more than a couple of attempts should ever be required in"},{"line_number":271,"context_line":"        # normal operation."},{"line_number":272,"context_line":"        for count in range(1, MAX_BIND_TRIES + 1):"},{"line_number":273,"context_line":"            if count \u003e 1:"},{"line_number":274,"context_line":"                # multiple attempts shouldn\u0027t happen very often so we log each"},{"line_number":275,"context_line":"                # attempt after the 1st."}],"source_content_type":"text/x-python","patch_set":23,"id":"da85f559_e273c27e","line":272,"updated":"2015-11-10 16:04:12.000000000","message":"Since the maximum retries amount is capped at 2, this \u0027for\u0027 is no longer correct. I wonder if it\u0027s needed at all (we might be better off hard-coding the 2 calls).","commit_id":"006e873a7fd6af8df28180e9910b2f4edf56ad21"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"68997dc2d17c93fce2f5bce592af63dcb6d1de78","unresolved":false,"context_lines":[{"line_number":269,"context_line":"        # Binding limit does not need to be tunable because no"},{"line_number":270,"context_line":"        # more than a couple of attempts should ever be required in"},{"line_number":271,"context_line":"        # normal operation."},{"line_number":272,"context_line":"        for count in range(1, MAX_BIND_TRIES + 1):"},{"line_number":273,"context_line":"            if count \u003e 1:"},{"line_number":274,"context_line":"                # multiple attempts shouldn\u0027t happen very often so we log each"},{"line_number":275,"context_line":"                # attempt after the 1st."}],"source_content_type":"text/x-python","patch_set":23,"id":"ba8a016a_7825835a","line":272,"in_reply_to":"da85f559_42c70596","updated":"2015-11-22 13:13:20.000000000","message":"I will just set MAX_BIND_TRIES \u003d 2","commit_id":"006e873a7fd6af8df28180e9910b2f4edf56ad21"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"6e50b3db670599522c66eb6a8d72b1ace1d5d88d","unresolved":false,"context_lines":[{"line_number":269,"context_line":"        # Binding limit does not need to be tunable because no"},{"line_number":270,"context_line":"        # more than a couple of attempts should ever be required in"},{"line_number":271,"context_line":"        # normal operation."},{"line_number":272,"context_line":"        for count in range(1, MAX_BIND_TRIES + 1):"},{"line_number":273,"context_line":"            if count \u003e 1:"},{"line_number":274,"context_line":"                # multiple attempts shouldn\u0027t happen very often so we log each"},{"line_number":275,"context_line":"                # attempt after the 1st."}],"source_content_type":"text/x-python","patch_set":23,"id":"da85f559_42c70596","line":272,"in_reply_to":"da85f559_e273c27e","updated":"2015-11-11 10:43:33.000000000","message":"hardcoding iterations has never been a good style in ANY language, including assembly.\nThis code is perfectly fine.","commit_id":"006e873a7fd6af8df28180e9910b2f4edf56ad21"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"988579cdad6fd5cdafc17ed28ef75183b2d73598","unresolved":false,"context_lines":[{"line_number":270,"context_line":"        # more than a couple of attempts should ever be required in"},{"line_number":271,"context_line":"        # normal operation."},{"line_number":272,"context_line":"        for count in range(1, MAX_BIND_TRIES + 1):"},{"line_number":273,"context_line":"            if count \u003e 1:"},{"line_number":274,"context_line":"                # multiple attempts shouldn\u0027t happen very often so we log each"},{"line_number":275,"context_line":"                # attempt after the 1st."},{"line_number":276,"context_line":""}],"source_content_type":"text/x-python","patch_set":23,"id":"da85f559_e221824e","line":273,"updated":"2015-11-10 16:04:12.000000000","message":"this isn\u0027t related to this patch, but \u0027count \u003e 1\u0027 will always return True so it might as well be removed now.","commit_id":"006e873a7fd6af8df28180e9910b2f4edf56ad21"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"68997dc2d17c93fce2f5bce592af63dcb6d1de78","unresolved":false,"context_lines":[{"line_number":270,"context_line":"        # more than a couple of attempts should ever be required in"},{"line_number":271,"context_line":"        # normal operation."},{"line_number":272,"context_line":"        for count in range(1, MAX_BIND_TRIES + 1):"},{"line_number":273,"context_line":"            if count \u003e 1:"},{"line_number":274,"context_line":"                # multiple attempts shouldn\u0027t happen very often so we log each"},{"line_number":275,"context_line":"                # attempt after the 1st."},{"line_number":276,"context_line":""}],"source_content_type":"text/x-python","patch_set":23,"id":"ba8a016a_b82beb32","line":273,"in_reply_to":"da85f559_e221824e","updated":"2015-11-22 13:13:20.000000000","message":"Done","commit_id":"006e873a7fd6af8df28180e9910b2f4edf56ad21"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"84ecb934cbd8d77ef3ed2df26b669369ecc376b0","unresolved":false,"context_lines":[{"line_number":270,"context_line":"        # more than a couple of attempts should ever be required in"},{"line_number":271,"context_line":"        # normal operation."},{"line_number":272,"context_line":"        for count in range(1, MAX_BIND_TRIES + 1):"},{"line_number":273,"context_line":"            if count \u003e 1:"},{"line_number":274,"context_line":"                # multiple attempts shouldn\u0027t happen very often so we log each"},{"line_number":275,"context_line":"                # attempt after the 1st."},{"line_number":276,"context_line":""}],"source_content_type":"text/x-python","patch_set":23,"id":"ba8a016a_fc439911","line":273,"in_reply_to":"da85f559_e221824e","updated":"2015-11-23 08:54:06.000000000","message":"it won\u0027t return True on the first iteration","commit_id":"006e873a7fd6af8df28180e9910b2f4edf56ad21"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"988579cdad6fd5cdafc17ed28ef75183b2d73598","unresolved":false,"context_lines":[{"line_number":290,"context_line":"                      \"after %(max)s tries\"),"},{"line_number":291,"context_line":"                  {\u0027port\u0027: context.current[\u0027id\u0027], \u0027max\u0027: MAX_BIND_TRIES})"},{"line_number":292,"context_line":"        return context"},{"line_number":293,"context_line":""},{"line_number":294,"context_line":"    def _attempt_binding(self, context, need_notify):"},{"line_number":295,"context_line":"        # Since the mechanism driver bind_port() calls must be made"},{"line_number":296,"context_line":"        # outside a DB transaction locking the port state, it is"}],"source_content_type":"text/x-python","patch_set":23,"id":"da85f559_fc692626","line":293,"updated":"2015-11-10 16:04:12.000000000","message":"I can\u0027t believe I\u0027m saying this about Neutron code, but this function has too many comments. It\u0027s also too long (this I can believe I\u0027m saying).\n\nI\u0027m thinking about splitting the code into 2 sub-functions: one that does the logic of the first try and one that does the logic of the second try (if the first failed). This will be a much heavier change but I hope it will lead to a much clearer code with comments in a single place (docstrings).","commit_id":"006e873a7fd6af8df28180e9910b2f4edf56ad21"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"68997dc2d17c93fce2f5bce592af63dcb6d1de78","unresolved":false,"context_lines":[{"line_number":290,"context_line":"                      \"after %(max)s tries\"),"},{"line_number":291,"context_line":"                  {\u0027port\u0027: context.current[\u0027id\u0027], \u0027max\u0027: MAX_BIND_TRIES})"},{"line_number":292,"context_line":"        return context"},{"line_number":293,"context_line":""},{"line_number":294,"context_line":"    def _attempt_binding(self, context, need_notify):"},{"line_number":295,"context_line":"        # Since the mechanism driver bind_port() calls must be made"},{"line_number":296,"context_line":"        # outside a DB transaction locking the port state, it is"}],"source_content_type":"text/x-python","patch_set":23,"id":"ba8a016a_33207c49","line":293,"in_reply_to":"da85f559_fc692626","updated":"2015-11-22 13:13:20.000000000","message":"So I\u0027ve tried to look into this one, and yes this function is indeed long.\nnevertheless, splitting it into sub functions forces me to pass multiple context objects between functions plus some additional parameters like orig_vif_type, need_notify, try_again etc.\n\nThis makes things much harder to understand for future self (and this code is not that easy to begin with). In addition it will force me to use at lease 3 return statements. Instead, per you other comment I\u0027ve reduced the number of return statements to 1.\n\nI did try to keep the doc strings as short as possible just for the reader to understand the context of what he/she is reading (in what state we are at the moment, did we fail before, etc).\nthe first doc string was not written by me so I\u0027m not sure how to reduce the number if it\u0027s lines (I managed to shrink it by 1 line..)","commit_id":"006e873a7fd6af8df28180e9910b2f4edf56ad21"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"988579cdad6fd5cdafc17ed28ef75183b2d73598","unresolved":false,"context_lines":[{"line_number":306,"context_line":"        port_id \u003d context.current[\u0027id\u0027]"},{"line_number":307,"context_line":"        binding \u003d context._binding"},{"line_number":308,"context_line":"        orig_vif_type \u003d binding.vif_type"},{"line_number":309,"context_line":"        try_again \u003d False"},{"line_number":310,"context_line":"        if (binding.host and"},{"line_number":311,"context_line":"            binding.vif_type in (portbindings.VIF_TYPE_UNBOUND,"},{"line_number":312,"context_line":"                                 portbindings.VIF_TYPE_BINDING_FAILED)):"}],"source_content_type":"text/x-python","patch_set":23,"id":"da85f559_1ca0aa42","line":309,"updated":"2015-11-10 16:04:12.000000000","message":"Please enter a space line here, to indicate end-of-variable-declaration and beginning-of-logic.","commit_id":"006e873a7fd6af8df28180e9910b2f4edf56ad21"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"68997dc2d17c93fce2f5bce592af63dcb6d1de78","unresolved":false,"context_lines":[{"line_number":306,"context_line":"        port_id \u003d context.current[\u0027id\u0027]"},{"line_number":307,"context_line":"        binding \u003d context._binding"},{"line_number":308,"context_line":"        orig_vif_type \u003d binding.vif_type"},{"line_number":309,"context_line":"        try_again \u003d False"},{"line_number":310,"context_line":"        if (binding.host and"},{"line_number":311,"context_line":"            binding.vif_type in (portbindings.VIF_TYPE_UNBOUND,"},{"line_number":312,"context_line":"                                 portbindings.VIF_TYPE_BINDING_FAILED)):"}],"source_content_type":"text/x-python","patch_set":23,"id":"ba8a016a_f802d3b3","line":309,"in_reply_to":"da85f559_1ca0aa42","updated":"2015-11-22 13:13:20.000000000","message":"Done","commit_id":"006e873a7fd6af8df28180e9910b2f4edf56ad21"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"988579cdad6fd5cdafc17ed28ef75183b2d73598","unresolved":false,"context_lines":[{"line_number":325,"context_line":"                    # return the unbound result from the initial"},{"line_number":326,"context_line":"                    # transaction that completed before the deletion."},{"line_number":327,"context_line":"                    LOG.debug(\"Port %s has been deleted concurrently\", port_id)"},{"line_number":328,"context_line":"                    need_notify \u003d False"},{"line_number":329,"context_line":"                    return context, need_notify, try_again"},{"line_number":330,"context_line":""},{"line_number":331,"context_line":"                if did_commit:"}],"source_content_type":"text/x-python","patch_set":23,"id":"da85f559_ff6ef894","line":328,"updated":"2015-11-10 16:04:12.000000000","message":"Even if you don\u0027t split this function into several sub-functions, lets try to keep the number of return-statements to a minimum of one. Future self shouldn\u0027t be forced to edit the entire function to add a simple change to the return statements.\n\nFor example, if one wants to add a \u0027did_commit\u0027 to the return statements, we probably only want to add a simple \u0027did_commit \u003d False\u0027  to the beginning of the function, change it to True someplace, and change a single return statement - that\u0027s 3 changes. Currently, the code requires 4 changes.","commit_id":"006e873a7fd6af8df28180e9910b2f4edf56ad21"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"68997dc2d17c93fce2f5bce592af63dcb6d1de78","unresolved":false,"context_lines":[{"line_number":325,"context_line":"                    # return the unbound result from the initial"},{"line_number":326,"context_line":"                    # transaction that completed before the deletion."},{"line_number":327,"context_line":"                    LOG.debug(\"Port %s has been deleted concurrently\", port_id)"},{"line_number":328,"context_line":"                    need_notify \u003d False"},{"line_number":329,"context_line":"                    return context, need_notify, try_again"},{"line_number":330,"context_line":""},{"line_number":331,"context_line":"                if did_commit:"}],"source_content_type":"text/x-python","patch_set":23,"id":"ba8a016a_f3f0b4cb","line":328,"in_reply_to":"da85f559_ff6ef894","updated":"2015-11-22 13:13:20.000000000","message":"Valid point, the number of return statements was reduced to 1.","commit_id":"006e873a7fd6af8df28180e9910b2f4edf56ad21"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"e3f26f04d0339a50983c7a99143851e54ed8bee0","unresolved":false,"context_lines":[{"line_number":329,"context_line":"                    return context, need_notify, try_again"},{"line_number":330,"context_line":""},{"line_number":331,"context_line":"                if did_commit:"},{"line_number":332,"context_line":"                    # always notify for successful binding"},{"line_number":333,"context_line":"                    need_notify \u003d True"},{"line_number":334,"context_line":"                    return new_context, need_notify, try_again"},{"line_number":335,"context_line":""}],"source_content_type":"text/x-python","patch_set":23,"id":"da85f559_83fb6078","line":332,"updated":"2015-11-12 15:45:01.000000000","message":"Consistency: start the comment with a capital letter.","commit_id":"006e873a7fd6af8df28180e9910b2f4edf56ad21"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"68997dc2d17c93fce2f5bce592af63dcb6d1de78","unresolved":false,"context_lines":[{"line_number":329,"context_line":"                    return context, need_notify, try_again"},{"line_number":330,"context_line":""},{"line_number":331,"context_line":"                if did_commit:"},{"line_number":332,"context_line":"                    # always notify for successful binding"},{"line_number":333,"context_line":"                    need_notify \u003d True"},{"line_number":334,"context_line":"                    return new_context, need_notify, try_again"},{"line_number":335,"context_line":""}],"source_content_type":"text/x-python","patch_set":23,"id":"ba8a016a_18f9d74d","line":332,"in_reply_to":"da85f559_83fb6078","updated":"2015-11-22 13:13:20.000000000","message":"Done","commit_id":"006e873a7fd6af8df28180e9910b2f4edf56ad21"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"5b854272515491e25e262c5935a0d41b8684b1c3","unresolved":false,"context_lines":[{"line_number":330,"context_line":""},{"line_number":331,"context_line":"                if did_commit:"},{"line_number":332,"context_line":"                    # always notify for successful binding"},{"line_number":333,"context_line":"                    need_notify \u003d True"},{"line_number":334,"context_line":"                    return new_context, need_notify, try_again"},{"line_number":335,"context_line":""},{"line_number":336,"context_line":"            else:"}],"source_content_type":"text/x-python","patch_set":23,"id":"da85f559_7b267c16","line":333,"updated":"2015-11-11 07:48:18.000000000","message":"Since whenever did_commit \u003d\u003d True we also want to notify others about the changes (ie. setting need_notify \u003d True), how about we remove need_notify altogether and directly ask whether or not we committed something to the database or not?","commit_id":"006e873a7fd6af8df28180e9910b2f4edf56ad21"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"15d5c5b3f67a1b5a79af3c1f2ca0d48d613c6038","unresolved":false,"context_lines":[{"line_number":330,"context_line":""},{"line_number":331,"context_line":"                if did_commit:"},{"line_number":332,"context_line":"                    # always notify for successful binding"},{"line_number":333,"context_line":"                    need_notify \u003d True"},{"line_number":334,"context_line":"                    return new_context, need_notify, try_again"},{"line_number":335,"context_line":""},{"line_number":336,"context_line":"            else:"}],"source_content_type":"text/x-python","patch_set":23,"id":"7a740942_241d62bd","line":333,"in_reply_to":"9a8ffd7b_cc04f516","updated":"2015-12-06 14:14:22.000000000","message":"Sorry John, must have slipped my radar.\nI understand your point here, but we need to keep in mind that we get need_notify from _bind_port_if_needed. As you can see it is False by default but this can be changed in some cases, like in line #1269 where it\u0027s used with True.\n\nbtw, this actually means that I need to remove line #328 so it will act by the provided value.\nAlso, and despite the fact that this code is complicated, I think that the separation between them makes it easier to read, although that could be a matter of personal preference.","commit_id":"006e873a7fd6af8df28180e9910b2f4edf56ad21"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"1c85e5d6ce6c08e57aec94109a5c2537544f2595","unresolved":false,"context_lines":[{"line_number":330,"context_line":""},{"line_number":331,"context_line":"                if did_commit:"},{"line_number":332,"context_line":"                    # always notify for successful binding"},{"line_number":333,"context_line":"                    need_notify \u003d True"},{"line_number":334,"context_line":"                    return new_context, need_notify, try_again"},{"line_number":335,"context_line":""},{"line_number":336,"context_line":"            else:"}],"source_content_type":"text/x-python","patch_set":23,"id":"9a8ffd7b_cc04f516","line":333,"in_reply_to":"da85f559_7b267c16","updated":"2015-11-25 06:33:40.000000000","message":"This has been left untouched in the code and unanswered in the review process.\n\nThis comment is feeling lonely :(","commit_id":"006e873a7fd6af8df28180e9910b2f4edf56ad21"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"e3f26f04d0339a50983c7a99143851e54ed8bee0","unresolved":false,"context_lines":[{"line_number":351,"context_line":"                return context, need_notify, try_again"},{"line_number":352,"context_line":""},{"line_number":353,"context_line":"        else:"},{"line_number":354,"context_line":"            # for other binding states, or when we don\u0027t know which host"},{"line_number":355,"context_line":"            # should be used for binding, just notify and bail out"},{"line_number":356,"context_line":"            need_notify \u003d True"},{"line_number":357,"context_line":""}],"source_content_type":"text/x-python","patch_set":23,"id":"da85f559_230ab48a","line":354,"updated":"2015-11-12 15:45:01.000000000","message":"Consistency: start the comment with a capital letter.","commit_id":"006e873a7fd6af8df28180e9910b2f4edf56ad21"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"68997dc2d17c93fce2f5bce592af63dcb6d1de78","unresolved":false,"context_lines":[{"line_number":351,"context_line":"                return context, need_notify, try_again"},{"line_number":352,"context_line":""},{"line_number":353,"context_line":"        else:"},{"line_number":354,"context_line":"            # for other binding states, or when we don\u0027t know which host"},{"line_number":355,"context_line":"            # should be used for binding, just notify and bail out"},{"line_number":356,"context_line":"            need_notify \u003d True"},{"line_number":357,"context_line":""}],"source_content_type":"text/x-python","patch_set":23,"id":"ba8a016a_b8944be8","line":354,"in_reply_to":"da85f559_230ab48a","updated":"2015-11-22 13:13:20.000000000","message":"Done","commit_id":"006e873a7fd6af8df28180e9910b2f4edf56ad21"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"988579cdad6fd5cdafc17ed28ef75183b2d73598","unresolved":false,"context_lines":[{"line_number":352,"context_line":""},{"line_number":353,"context_line":"        else:"},{"line_number":354,"context_line":"            # for other binding states, or when we don\u0027t know which host"},{"line_number":355,"context_line":"            # should be used for binding, just notify and bail out"},{"line_number":356,"context_line":"            need_notify \u003d True"},{"line_number":357,"context_line":""},{"line_number":358,"context_line":"        return context, need_notify, try_again"}],"source_content_type":"text/x-python","patch_set":23,"id":"da85f559_2db53bed","line":355,"updated":"2015-11-10 16:04:12.000000000","message":"Before, need_notify was True only if did_commit was True (and some other condition). Now, however, need_notify is True whenever commit_port_binding is called and the starting vif_type is not in (unbound, failed) - which is a lot more, since bind_port_if_needed is called a lot in Neutron. This will result in a lot of overhead we probably want to avoid.\n\nWe probably only want to notify if did_commit is True and the binding was successful - so we probably just need to delete this \u0027else\u0027 block since it is already done in line 333.\n\nI also wonder how unit tests didn\u0027t catch this... you should probably add a test case for this variable.","commit_id":"006e873a7fd6af8df28180e9910b2f4edf56ad21"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"1c85e5d6ce6c08e57aec94109a5c2537544f2595","unresolved":false,"context_lines":[{"line_number":352,"context_line":""},{"line_number":353,"context_line":"        else:"},{"line_number":354,"context_line":"            # for other binding states, or when we don\u0027t know which host"},{"line_number":355,"context_line":"            # should be used for binding, just notify and bail out"},{"line_number":356,"context_line":"            need_notify \u003d True"},{"line_number":357,"context_line":""},{"line_number":358,"context_line":"        return context, need_notify, try_again"}],"source_content_type":"text/x-python","patch_set":23,"id":"9a8ffd7b_510ade27","line":355,"in_reply_to":"9a8ffd7b_049a0415","updated":"2015-11-25 06:33:40.000000000","message":"The comment doesn\u0027t explain this, seeing as how this happens in cases where no binding was even attempted(!)","commit_id":"006e873a7fd6af8df28180e9910b2f4edf56ad21"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"b05af38d61bb9ee9108c784ebca8cb181b37e74a","unresolved":false,"context_lines":[{"line_number":352,"context_line":""},{"line_number":353,"context_line":"        else:"},{"line_number":354,"context_line":"            # for other binding states, or when we don\u0027t know which host"},{"line_number":355,"context_line":"            # should be used for binding, just notify and bail out"},{"line_number":356,"context_line":"            need_notify \u003d True"},{"line_number":357,"context_line":""},{"line_number":358,"context_line":"        return context, need_notify, try_again"}],"source_content_type":"text/x-python","patch_set":23,"id":"9a8ffd7b_049a0415","line":355,"in_reply_to":"da85f559_2db53bed","updated":"2015-11-24 13:03:58.000000000","message":"That might explain it (snipped from commit msg):\n\nThis is the second attempt to introduce the patch (the first one was\nreverted due to regression that broke Ironic), now with proper\nnotification sent even when binding attempt failed.","commit_id":"006e873a7fd6af8df28180e9910b2f4edf56ad21"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"68997dc2d17c93fce2f5bce592af63dcb6d1de78","unresolved":false,"context_lines":[{"line_number":352,"context_line":""},{"line_number":353,"context_line":"        else:"},{"line_number":354,"context_line":"            # for other binding states, or when we don\u0027t know which host"},{"line_number":355,"context_line":"            # should be used for binding, just notify and bail out"},{"line_number":356,"context_line":"            need_notify \u003d True"},{"line_number":357,"context_line":""},{"line_number":358,"context_line":"        return context, need_notify, try_again"}],"source_content_type":"text/x-python","patch_set":23,"id":"ba8a016a_737b647c","line":355,"in_reply_to":"da85f559_2db53bed","updated":"2015-11-22 13:13:20.000000000","message":"You got a point there, but before I change this I would like Ihar, who originally committed this patch to confirm the change.\n\nIhar, was there a reason to add notification for the cases John mentioned?","commit_id":"006e873a7fd6af8df28180e9910b2f4edf56ad21"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"7fdb6701d8b5c29090420ac2954cfbccc819545e","unresolved":false,"context_lines":[{"line_number":270,"context_line":"        # more than a couple of attempts should ever be required in"},{"line_number":271,"context_line":"        # normal operation."},{"line_number":272,"context_line":"        for count in range(1, MAX_BIND_TRIES + 1):"},{"line_number":273,"context_line":"            if count \u003e 1:"},{"line_number":274,"context_line":"                # multiple attempts shouldn\u0027t happen very often so we log each"},{"line_number":275,"context_line":"                # attempt after the 1st."},{"line_number":276,"context_line":"                greenthread.sleep(0)  # yield"}],"source_content_type":"text/x-python","patch_set":24,"id":"ba8a016a_9cf92dcb","side":"PARENT","line":273,"updated":"2015-11-23 09:04:45.000000000","message":"please do not remove, it should not log and yeld on the first attempt","commit_id":"ca5fd3cd11f3b653bb91ff12964fb26b2b946b32"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"3e9fa93030e681fc339941b31515d1f0b7146133","unresolved":false,"context_lines":[{"line_number":270,"context_line":"        # more than a couple of attempts should ever be required in"},{"line_number":271,"context_line":"        # normal operation."},{"line_number":272,"context_line":"        for count in range(1, MAX_BIND_TRIES + 1):"},{"line_number":273,"context_line":"            if count \u003e 1:"},{"line_number":274,"context_line":"                # multiple attempts shouldn\u0027t happen very often so we log each"},{"line_number":275,"context_line":"                # attempt after the 1st."},{"line_number":276,"context_line":"                greenthread.sleep(0)  # yield"}],"source_content_type":"text/x-python","patch_set":24,"id":"ba8a016a_e2af727b","side":"PARENT","line":273,"in_reply_to":"ba8a016a_9cf92dcb","updated":"2015-11-23 09:46:16.000000000","message":"Done","commit_id":"ca5fd3cd11f3b653bb91ff12964fb26b2b946b32"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"c417d935892025ef5808a4952ea7b9dfe7299ed9","unresolved":false,"context_lines":[{"line_number":303,"context_line":"        # returned to indicate that the commit was unsuccessful."},{"line_number":304,"context_line":"        plugin_context \u003d context._plugin_context"},{"line_number":305,"context_line":"        port_id \u003d context.current[\u0027id\u0027]"},{"line_number":306,"context_line":"        binding \u003d context._binding"},{"line_number":307,"context_line":"        orig_vif_type \u003d binding.vif_type"},{"line_number":308,"context_line":"        try_again \u003d False"},{"line_number":309,"context_line":""}],"source_content_type":"text/x-python","patch_set":25,"id":"9a8ffd7b_ccccf537","line":306,"updated":"2015-11-25 06:57:00.000000000","message":"This code is so complicated I forgot again - is \u0027orig_vif_type\u0027 the vif_type we ran with the *first* time, or the *last* time? (Please add a short comment to clarify). This also links to ZongKai\u0027s comment in line 337.","commit_id":"c73f3cb201e517143b69f154134d5727902d4e79"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"9b510497cf2f1cf02cbab7577679e6414380d964","unresolved":false,"context_lines":[{"line_number":303,"context_line":"        # returned to indicate that the commit was unsuccessful."},{"line_number":304,"context_line":"        plugin_context \u003d context._plugin_context"},{"line_number":305,"context_line":"        port_id \u003d context.current[\u0027id\u0027]"},{"line_number":306,"context_line":"        binding \u003d context._binding"},{"line_number":307,"context_line":"        orig_vif_type \u003d binding.vif_type"},{"line_number":308,"context_line":"        try_again \u003d False"},{"line_number":309,"context_line":""}],"source_content_type":"text/x-python","patch_set":25,"id":"7a740942_84b77685","line":306,"in_reply_to":"9a8ffd7b_91824b51","updated":"2015-12-17 13:32:16.000000000","message":"Correct, Thanks!","commit_id":"c73f3cb201e517143b69f154134d5727902d4e79"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"9b510497cf2f1cf02cbab7577679e6414380d964","unresolved":false,"context_lines":[{"line_number":303,"context_line":"        # returned to indicate that the commit was unsuccessful."},{"line_number":304,"context_line":"        plugin_context \u003d context._plugin_context"},{"line_number":305,"context_line":"        port_id \u003d context.current[\u0027id\u0027]"},{"line_number":306,"context_line":"        binding \u003d context._binding"},{"line_number":307,"context_line":"        orig_vif_type \u003d binding.vif_type"},{"line_number":308,"context_line":"        try_again \u003d False"},{"line_number":309,"context_line":""}],"source_content_type":"text/x-python","patch_set":25,"id":"7a740942_e4c0bae2","line":306,"in_reply_to":"9a8ffd7b_ccccf537","updated":"2015-12-17 13:32:16.000000000","message":"Brad\u0027s answered it correctly.","commit_id":"c73f3cb201e517143b69f154134d5727902d4e79"},{"author":{"_account_id":14957,"name":"Brad Behle","email":"behle@us.ibm.com","username":"behle"},"change_message_id":"e2ecbf4b46f80ea039991a5b6d1072912cc0709d","unresolved":false,"context_lines":[{"line_number":303,"context_line":"        # returned to indicate that the commit was unsuccessful."},{"line_number":304,"context_line":"        plugin_context \u003d context._plugin_context"},{"line_number":305,"context_line":"        port_id \u003d context.current[\u0027id\u0027]"},{"line_number":306,"context_line":"        binding \u003d context._binding"},{"line_number":307,"context_line":"        orig_vif_type \u003d binding.vif_type"},{"line_number":308,"context_line":"        try_again \u003d False"},{"line_number":309,"context_line":""}],"source_content_type":"text/x-python","patch_set":25,"id":"9a8ffd7b_91824b51","line":306,"in_reply_to":"9a8ffd7b_ccccf537","updated":"2015-12-02 05:23:55.000000000","message":"orig_vif_type is whatever the result of the \"last\" time was.  So if this is the initial bind attempt, this will be \"VIF_TYPE_UNBOUND\".  If this method was just called and that binding attempt failed, it will be VIF_TYPE_BINDING_FAILED.","commit_id":"c73f3cb201e517143b69f154134d5727902d4e79"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"4fde09943a7a3449a4b66ba21499f2f9d79f9f8d","unresolved":false,"context_lines":[{"line_number":329,"context_line":"                elif did_commit:"},{"line_number":330,"context_line":"                    # Always notify for successful binding"},{"line_number":331,"context_line":"                    need_notify \u003d True"},{"line_number":332,"context_line":"                    context \u003d new_context"},{"line_number":333,"context_line":""},{"line_number":334,"context_line":"            else:"},{"line_number":335,"context_line":"                # Current binding failed"}],"source_content_type":"text/x-python","patch_set":25,"id":"ba8a016a_14a8a9da","line":332,"updated":"2015-11-23 12:23:46.000000000","message":"This is probably unrelated to your put, but if did_commit\u003dFalse should you try again or not?","commit_id":"c73f3cb201e517143b69f154134d5727902d4e79"},{"author":{"_account_id":14957,"name":"Brad Behle","email":"behle@us.ibm.com","username":"behle"},"change_message_id":"e2ecbf4b46f80ea039991a5b6d1072912cc0709d","unresolved":false,"context_lines":[{"line_number":329,"context_line":"                elif did_commit:"},{"line_number":330,"context_line":"                    # Always notify for successful binding"},{"line_number":331,"context_line":"                    need_notify \u003d True"},{"line_number":332,"context_line":"                    context \u003d new_context"},{"line_number":333,"context_line":""},{"line_number":334,"context_line":"            else:"},{"line_number":335,"context_line":"                # Current binding failed"}],"source_content_type":"text/x-python","patch_set":25,"id":"9a8ffd7b_f5b0628d","line":332,"in_reply_to":"9a8ffd7b_8cb90dec","updated":"2015-12-02 05:23:55.000000000","message":"Agree with John\u0027s proposed addition, but I think should also set context \u003d new_context, since the original code returned new_context in this case","commit_id":"c73f3cb201e517143b69f154134d5727902d4e79"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"c417d935892025ef5808a4952ea7b9dfe7299ed9","unresolved":false,"context_lines":[{"line_number":329,"context_line":"                elif did_commit:"},{"line_number":330,"context_line":"                    # Always notify for successful binding"},{"line_number":331,"context_line":"                    need_notify \u003d True"},{"line_number":332,"context_line":"                    context \u003d new_context"},{"line_number":333,"context_line":""},{"line_number":334,"context_line":"            else:"},{"line_number":335,"context_line":"                # Current binding failed"}],"source_content_type":"text/x-python","patch_set":25,"id":"9a8ffd7b_8cb90dec","line":332,"in_reply_to":"9a8ffd7b_c8006aad","updated":"2015-11-25 06:57:00.000000000","message":"Brad is correct - the old code does return try_again\u003dTrue if did_commit happens to be False - this is a regression in this patch.\n\nAdding a new block between lines 332 and 333, which reads:\n\n elif not did_commit:\n     need_notify \u003d False\n     try_again \u003d True\n\nwill solve the problem IMO. This is because \u0027context._binding.vif_type\u0027 will not equal to VIF_TYPE_BINDING_FAILED (but perhaps some kind of binding success code), which will in turn (should) provide us with more than 2 retries.\n\nI also wonder why this wasn\u0027t discovered by unit tests. New tests for this specific end-case should be written.","commit_id":"c73f3cb201e517143b69f154134d5727902d4e79"},{"author":{"_account_id":14957,"name":"Brad Behle","email":"behle@us.ibm.com","username":"behle"},"change_message_id":"48fe23b827c6b96920c450bd17c4ae9fc45fae1d","unresolved":false,"context_lines":[{"line_number":329,"context_line":"                elif did_commit:"},{"line_number":330,"context_line":"                    # Always notify for successful binding"},{"line_number":331,"context_line":"                    need_notify \u003d True"},{"line_number":332,"context_line":"                    context \u003d new_context"},{"line_number":333,"context_line":""},{"line_number":334,"context_line":"            else:"},{"line_number":335,"context_line":"                # Current binding failed"}],"source_content_type":"text/x-python","patch_set":25,"id":"9a8ffd7b_c8006aad","line":332,"in_reply_to":"9a8ffd7b_f1d21b34","updated":"2015-11-25 04:46:54.000000000","message":"The way I read it, the code that is currently in master returns try_again \u003d True if the binding succeeds but the did_commit \u003d False.  The change you are proposing returns try_again \u003d False in this case.  Unless you have a good reason for changing this existing behavior, I think it should return try_again \u003d True in that case.","commit_id":"c73f3cb201e517143b69f154134d5727902d4e79"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"9b510497cf2f1cf02cbab7577679e6414380d964","unresolved":false,"context_lines":[{"line_number":329,"context_line":"                elif did_commit:"},{"line_number":330,"context_line":"                    # Always notify for successful binding"},{"line_number":331,"context_line":"                    need_notify \u003d True"},{"line_number":332,"context_line":"                    context \u003d new_context"},{"line_number":333,"context_line":""},{"line_number":334,"context_line":"            else:"},{"line_number":335,"context_line":"                # Current binding failed"}],"source_content_type":"text/x-python","patch_set":25,"id":"7a740942_74e7a712","line":332,"in_reply_to":"9a8ffd7b_f5b0628d","updated":"2015-12-17 13:32:16.000000000","message":"Fixed in line #358 in patchset#26. refactoring made in patchset#27 moved it to 366","commit_id":"c73f3cb201e517143b69f154134d5727902d4e79"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"e1b7afd6afa389ebee483bce43705fc739efffef","unresolved":false,"context_lines":[{"line_number":329,"context_line":"                elif did_commit:"},{"line_number":330,"context_line":"                    # Always notify for successful binding"},{"line_number":331,"context_line":"                    need_notify \u003d True"},{"line_number":332,"context_line":"                    context \u003d new_context"},{"line_number":333,"context_line":""},{"line_number":334,"context_line":"            else:"},{"line_number":335,"context_line":"                # Current binding failed"}],"source_content_type":"text/x-python","patch_set":25,"id":"9a8ffd7b_f1d21b34","line":332,"in_reply_to":"ba8a016a_14a8a9da","updated":"2015-11-24 14:05:38.000000000","message":"Well, as you said it\u0027s out of scope here. we do not try again for failed commits, just for failed port binding attempts. btw, this is currently the way things are currently in master.","commit_id":"c73f3cb201e517143b69f154134d5727902d4e79"},{"author":{"_account_id":13667,"name":"ZongKai LI","email":"onionpiece@163.com","username":"lzklibj"},"change_message_id":"238a8f73ed74d7e9f7a0feff6942b2180071dda3","unresolved":false,"context_lines":[{"line_number":334,"context_line":"            else:"},{"line_number":335,"context_line":"                # Current binding failed"},{"line_number":336,"context_line":"                if orig_vif_type !\u003d portbindings.VIF_TYPE_BINDING_FAILED:"},{"line_number":337,"context_line":"                    # Port binding did not fail before"},{"line_number":338,"context_line":"                    try_again \u003d True"},{"line_number":339,"context_line":"                    context \u003d bind_context"},{"line_number":340,"context_line":"                else:"}],"source_content_type":"text/x-python","patch_set":25,"id":"9a8ffd7b_991dd268","line":337,"updated":"2015-11-25 02:26:31.000000000","message":"Quesion: could orig_vif_type be portbindings.VIF_TYPE_UNBOUND ? If so, did not fail before seems not so precision.","commit_id":"c73f3cb201e517143b69f154134d5727902d4e79"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"9b510497cf2f1cf02cbab7577679e6414380d964","unresolved":false,"context_lines":[{"line_number":334,"context_line":"            else:"},{"line_number":335,"context_line":"                # Current binding failed"},{"line_number":336,"context_line":"                if orig_vif_type !\u003d portbindings.VIF_TYPE_BINDING_FAILED:"},{"line_number":337,"context_line":"                    # Port binding did not fail before"},{"line_number":338,"context_line":"                    try_again \u003d True"},{"line_number":339,"context_line":"                    context \u003d bind_context"},{"line_number":340,"context_line":"                else:"}],"source_content_type":"text/x-python","patch_set":25,"id":"7a740942_e44e7a95","line":337,"in_reply_to":"9a8ffd7b_991dd268","updated":"2015-12-17 13:32:16.000000000","message":"Brad answered correctly, here we make sure that this is not second failure to bind this port. yet, since we must be aware of the binding state of previous attempt, I cannot use  portbindings.VIF_TYPE_UNBOUND here.\nI\u0027ll fix the comment to indicate that.","commit_id":"c73f3cb201e517143b69f154134d5727902d4e79"},{"author":{"_account_id":14957,"name":"Brad Behle","email":"behle@us.ibm.com","username":"behle"},"change_message_id":"e2ecbf4b46f80ea039991a5b6d1072912cc0709d","unresolved":false,"context_lines":[{"line_number":334,"context_line":"            else:"},{"line_number":335,"context_line":"                # Current binding failed"},{"line_number":336,"context_line":"                if orig_vif_type !\u003d portbindings.VIF_TYPE_BINDING_FAILED:"},{"line_number":337,"context_line":"                    # Port binding did not fail before"},{"line_number":338,"context_line":"                    try_again \u003d True"},{"line_number":339,"context_line":"                    context \u003d bind_context"},{"line_number":340,"context_line":"                else:"}],"source_content_type":"text/x-python","patch_set":25,"id":"9a8ffd7b_b1d3cf5e","line":337,"in_reply_to":"9a8ffd7b_991dd268","updated":"2015-12-02 05:23:55.000000000","message":"Correct, the orig_vif_type coudl be VIF_TYPE_UNBOUND if this is the first bind attempt.  \"did not fail before\" would be technically correct in this case, since this is the first bind attempt (but maybe something like \"Port binding did not fail last time or this is first attempt\" would be more precise)","commit_id":"c73f3cb201e517143b69f154134d5727902d4e79"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"9b510497cf2f1cf02cbab7577679e6414380d964","unresolved":false,"context_lines":[{"line_number":334,"context_line":"            else:"},{"line_number":335,"context_line":"                # Current binding failed"},{"line_number":336,"context_line":"                if orig_vif_type !\u003d portbindings.VIF_TYPE_BINDING_FAILED:"},{"line_number":337,"context_line":"                    # Port binding did not fail before"},{"line_number":338,"context_line":"                    try_again \u003d True"},{"line_number":339,"context_line":"                    context \u003d bind_context"},{"line_number":340,"context_line":"                else:"}],"source_content_type":"text/x-python","patch_set":25,"id":"7a740942_84453671","line":337,"in_reply_to":"9a8ffd7b_b1d3cf5e","updated":"2015-12-17 13:32:16.000000000","message":"Again, correct. Thank you :)","commit_id":"c73f3cb201e517143b69f154134d5727902d4e79"},{"author":{"_account_id":11159,"name":"Hong Hui Xiao","email":"honghui_xiao@yeah.net","username":"HongHuiXiao"},"change_message_id":"94ba78fbc3404591533dbe2512a2cf78998a1d78","unresolved":false,"context_lines":[{"line_number":340,"context_line":"                else:"},{"line_number":341,"context_line":"                    # We have failed to bind this port before,"},{"line_number":342,"context_line":"                    # commit the context, notify and bail out."},{"line_number":343,"context_line":"                    new_context, did_commit \u003d self._commit_port_binding("},{"line_number":344,"context_line":"                        plugin_context, port_id, binding, bind_context)"},{"line_number":345,"context_line":"                    if did_commit:"},{"line_number":346,"context_line":"                        need_notify \u003d True"}],"source_content_type":"text/x-python","patch_set":25,"id":"9a8ffd7b_f26c309e","line":343,"updated":"2015-11-25 07:54:43.000000000","message":"Is the commit here necessary? If it is another failed bind, there is nothing new to commit. The only reason here now seems to be that the binding don\u0027t get committed when the first bind fails. But the consequent is that the second and later failed binding will continue to enter this commit.","commit_id":"c73f3cb201e517143b69f154134d5727902d4e79"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"9b510497cf2f1cf02cbab7577679e6414380d964","unresolved":false,"context_lines":[{"line_number":340,"context_line":"                else:"},{"line_number":341,"context_line":"                    # We have failed to bind this port before,"},{"line_number":342,"context_line":"                    # commit the context, notify and bail out."},{"line_number":343,"context_line":"                    new_context, did_commit \u003d self._commit_port_binding("},{"line_number":344,"context_line":"                        plugin_context, port_id, binding, bind_context)"},{"line_number":345,"context_line":"                    if did_commit:"},{"line_number":346,"context_line":"                        need_notify \u003d True"}],"source_content_type":"text/x-python","patch_set":25,"id":"7a740942_645b6a55","line":343,"in_reply_to":"9a8ffd7b_f26c309e","updated":"2015-12-17 13:32:16.000000000","message":"This is done deliberately. copying from the commit message: \"will call _commit_port_binding at second\nfailure to bind the port.\"\nThis is in order to refrain from reverts, with will really complicate things even more.\nIn patchset #27, changes will be committed after MAX_BIND_TRIES amount of failed attempts.","commit_id":"c73f3cb201e517143b69f154134d5727902d4e79"},{"author":{"_account_id":11159,"name":"Hong Hui Xiao","email":"honghui_xiao@yeah.net","username":"HongHuiXiao"},"change_message_id":"94ba78fbc3404591533dbe2512a2cf78998a1d78","unresolved":false,"context_lines":[{"line_number":349,"context_line":"        else:"},{"line_number":350,"context_line":"            # For other binding states, or when we don\u0027t know which host"},{"line_number":351,"context_line":"            # should be used for binding, just notify and bail out"},{"line_number":352,"context_line":"            need_notify \u003d True"},{"line_number":353,"context_line":""},{"line_number":354,"context_line":"        return context, need_notify, try_again"},{"line_number":355,"context_line":""}],"source_content_type":"text/x-python","patch_set":25,"id":"9a8ffd7b_523dfc29","line":352,"updated":"2015-11-25 07:54:43.000000000","message":"Nothing has be done here, why \u0027need_notify\u0027 will be True? In the current logic, \"need_notify\" will only be forced to be True when did_commit and bind success.","commit_id":"c73f3cb201e517143b69f154134d5727902d4e79"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"9b510497cf2f1cf02cbab7577679e6414380d964","unresolved":false,"context_lines":[{"line_number":349,"context_line":"        else:"},{"line_number":350,"context_line":"            # For other binding states, or when we don\u0027t know which host"},{"line_number":351,"context_line":"            # should be used for binding, just notify and bail out"},{"line_number":352,"context_line":"            need_notify \u003d True"},{"line_number":353,"context_line":""},{"line_number":354,"context_line":"        return context, need_notify, try_again"},{"line_number":355,"context_line":""}],"source_content_type":"text/x-python","patch_set":25,"id":"3a7e1126_f98987cb","line":352,"in_reply_to":"9a8ffd7b_109cdebe","updated":"2015-12-17 13:32:16.000000000","message":"Done","commit_id":"c73f3cb201e517143b69f154134d5727902d4e79"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"9b510497cf2f1cf02cbab7577679e6414380d964","unresolved":false,"context_lines":[{"line_number":349,"context_line":"        else:"},{"line_number":350,"context_line":"            # For other binding states, or when we don\u0027t know which host"},{"line_number":351,"context_line":"            # should be used for binding, just notify and bail out"},{"line_number":352,"context_line":"            need_notify \u003d True"},{"line_number":353,"context_line":""},{"line_number":354,"context_line":"        return context, need_notify, try_again"},{"line_number":355,"context_line":""}],"source_content_type":"text/x-python","patch_set":25,"id":"3a7e1126_999ac313","line":352,"in_reply_to":"9a8ffd7b_523dfc29","updated":"2015-12-17 13:32:16.000000000","message":"Done","commit_id":"c73f3cb201e517143b69f154134d5727902d4e79"},{"author":{"_account_id":14957,"name":"Brad Behle","email":"behle@us.ibm.com","username":"behle"},"change_message_id":"e2ecbf4b46f80ea039991a5b6d1072912cc0709d","unresolved":false,"context_lines":[{"line_number":349,"context_line":"        else:"},{"line_number":350,"context_line":"            # For other binding states, or when we don\u0027t know which host"},{"line_number":351,"context_line":"            # should be used for binding, just notify and bail out"},{"line_number":352,"context_line":"            need_notify \u003d True"},{"line_number":353,"context_line":""},{"line_number":354,"context_line":"        return context, need_notify, try_again"},{"line_number":355,"context_line":""}],"source_content_type":"text/x-python","patch_set":25,"id":"9a8ffd7b_719c875d","line":352,"in_reply_to":"9a8ffd7b_523dfc29","updated":"2015-12-02 05:23:55.000000000","message":"I agree, unless there is a good reason, we should leave the current behavior, and not force need_notify to True.","commit_id":"c73f3cb201e517143b69f154134d5727902d4e79"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"9b510497cf2f1cf02cbab7577679e6414380d964","unresolved":false,"context_lines":[{"line_number":349,"context_line":"        else:"},{"line_number":350,"context_line":"            # For other binding states, or when we don\u0027t know which host"},{"line_number":351,"context_line":"            # should be used for binding, just notify and bail out"},{"line_number":352,"context_line":"            need_notify \u003d True"},{"line_number":353,"context_line":""},{"line_number":354,"context_line":"        return context, need_notify, try_again"},{"line_number":355,"context_line":""}],"source_content_type":"text/x-python","patch_set":25,"id":"3a7e1126_59a45b56","line":352,"in_reply_to":"9a8ffd7b_719c875d","updated":"2015-12-17 13:32:16.000000000","message":"Done","commit_id":"c73f3cb201e517143b69f154134d5727902d4e79"},{"author":{"_account_id":14957,"name":"Brad Behle","email":"behle@us.ibm.com","username":"behle"},"change_message_id":"025e4bb6591c2d32fe80d7a1de4a9a3ad936d3fc","unresolved":false,"context_lines":[{"line_number":349,"context_line":"        else:"},{"line_number":350,"context_line":"            # For other binding states, or when we don\u0027t know which host"},{"line_number":351,"context_line":"            # should be used for binding, just notify and bail out"},{"line_number":352,"context_line":"            need_notify \u003d True"},{"line_number":353,"context_line":""},{"line_number":354,"context_line":"        return context, need_notify, try_again"},{"line_number":355,"context_line":""}],"source_content_type":"text/x-python","patch_set":25,"id":"9a8ffd7b_109cdebe","line":352,"in_reply_to":"9a8ffd7b_719c875d","updated":"2015-12-02 21:34:22.000000000","message":"In fact, if you take out this forcing of need_notify\u003dTrue, then you can remove your changes to the existing test cases in test_port_binding.py and those tests will all pass.","commit_id":"c73f3cb201e517143b69f154134d5727902d4e79"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"c417d935892025ef5808a4952ea7b9dfe7299ed9","unresolved":false,"context_lines":[{"line_number":353,"context_line":""},{"line_number":354,"context_line":"        return context, need_notify, try_again"},{"line_number":355,"context_line":""},{"line_number":356,"context_line":"    def _bind_port(self, orig_context):"},{"line_number":357,"context_line":"        # Construct a new PortContext from the one from the previous"},{"line_number":358,"context_line":"        # transaction."},{"line_number":359,"context_line":"        port \u003d orig_context.current"}],"source_content_type":"text/x-python","patch_set":25,"id":"9a8ffd7b_acddf115","line":356,"updated":"2015-11-25 06:57:00.000000000","message":"Please add to this comment here an explanation regarding what kind of data in \u0027orig_context\u0027 might be change following this function.\n\nFor example, since port \u003d orig_context.current, if one is to change this dict in, say, L375 - then it will also change orig_context\u0027s \u0027current\u0027. In short, parts of orig_context will not be safe to use anymore, and this should be reflected somehow.\n\nI know this is out of scope, but I know you\u0027ve gone through this and it really doesn\u0027t deserve its own patch.","commit_id":"c73f3cb201e517143b69f154134d5727902d4e79"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"9b510497cf2f1cf02cbab7577679e6414380d964","unresolved":false,"context_lines":[{"line_number":353,"context_line":""},{"line_number":354,"context_line":"        return context, need_notify, try_again"},{"line_number":355,"context_line":""},{"line_number":356,"context_line":"    def _bind_port(self, orig_context):"},{"line_number":357,"context_line":"        # Construct a new PortContext from the one from the previous"},{"line_number":358,"context_line":"        # transaction."},{"line_number":359,"context_line":"        port \u003d orig_context.current"}],"source_content_type":"text/x-python","patch_set":25,"id":"3a7e1126_9304c57e","line":356,"in_reply_to":"9a8ffd7b_acddf115","updated":"2015-12-17 13:32:16.000000000","message":"For some reason it won\u0027t reproduce with the latest code.\n\nFor example:\n\nchecking the value of: new_context.vif_type in line 376 is different from orig_cintext.vif_type\n\nipdb\u003e new_context.vif_type\n\u0027binding_failed\u0027\nipdb\u003e orig_context.vif_type\n\u0027unbound\u0027\nipdb\u003e","commit_id":"c73f3cb201e517143b69f154134d5727902d4e79"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"c417d935892025ef5808a4952ea7b9dfe7299ed9","unresolved":false,"context_lines":[{"line_number":374,"context_line":"        # result."},{"line_number":375,"context_line":"        self.mechanism_manager.bind_port(new_context)"},{"line_number":376,"context_line":"        return new_context"},{"line_number":377,"context_line":""},{"line_number":378,"context_line":"    def _commit_port_binding(self, plugin_context, port_id, orig_binding,"},{"line_number":379,"context_line":"                             new_context):"},{"line_number":380,"context_line":"        session \u003d plugin_context.session"}],"source_content_type":"text/x-python","patch_set":25,"id":"9a8ffd7b_8cecadc8","line":377,"updated":"2015-11-25 06:57:00.000000000","message":"ditto.","commit_id":"c73f3cb201e517143b69f154134d5727902d4e79"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"de54eff09b4ac90c86c9f26a506f0a1bd07ff721","unresolved":false,"context_lines":[{"line_number":82,"context_line":""},{"line_number":83,"context_line":"LOG \u003d log.getLogger(__name__)"},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"MAX_BIND_TRIES \u003d 2"},{"line_number":86,"context_line":""},{"line_number":87,"context_line":""},{"line_number":88,"context_line":"class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,"}],"source_content_type":"text/x-python","patch_set":27,"id":"7a740942_61ef59e9","line":85,"updated":"2015-12-14 16:19:57.000000000","message":"why reduce the max tries so much?","commit_id":"7ec97739033199b53f2f233cd7d5b687a4f54e5d"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"c6cd09f399fe6ff512757b8dd1e333af7292c12d","unresolved":false,"context_lines":[{"line_number":82,"context_line":""},{"line_number":83,"context_line":"LOG \u003d log.getLogger(__name__)"},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"MAX_BIND_TRIES \u003d 2"},{"line_number":86,"context_line":""},{"line_number":87,"context_line":""},{"line_number":88,"context_line":"class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,"}],"source_content_type":"text/x-python","patch_set":27,"id":"3a7e1126_d39caa6b","line":85,"in_reply_to":"7a740942_61ef59e9","updated":"2015-12-17 13:33:37.000000000","message":"reverted back to 10","commit_id":"7ec97739033199b53f2f233cd7d5b687a4f54e5d"},{"author":{"_account_id":14957,"name":"Brad Behle","email":"behle@us.ibm.com","username":"behle"},"change_message_id":"df8f996ab8c83c33dd2bf02461085a3799ada155","unresolved":false,"context_lines":[{"line_number":290,"context_line":"                greenthread.sleep(0)  # yield"},{"line_number":291,"context_line":"                LOG.info(_LI(\"Attempt %(count)s to bind port %(port)s\"),"},{"line_number":292,"context_line":"                         {\u0027count\u0027: count, \u0027port\u0027: context.current[\u0027id\u0027]})"},{"line_number":293,"context_line":"            if count \u003d\u003d MAX_BIND_TRIES:"},{"line_number":294,"context_line":"                final_binding_attempt \u003d True"},{"line_number":295,"context_line":""},{"line_number":296,"context_line":"            bind_context, need_notify, try_again \u003d self._attempt_binding("}],"source_content_type":"text/x-python","patch_set":27,"id":"5a710552_99c73e45","line":293,"updated":"2015-12-14 20:20:30.000000000","message":"The final attempt through this loop is MAX_BIND_TRIES + 1, right?  So I think this should be if count \u003d\u003d MAX_BIND_TRIES + 1","commit_id":"7ec97739033199b53f2f233cd7d5b687a4f54e5d"},{"author":{"_account_id":14957,"name":"Brad Behle","email":"behle@us.ibm.com","username":"behle"},"change_message_id":"2e4dccebbacef48be239ce8a56a702ffa2789426","unresolved":false,"context_lines":[{"line_number":290,"context_line":"                greenthread.sleep(0)  # yield"},{"line_number":291,"context_line":"                LOG.info(_LI(\"Attempt %(count)s to bind port %(port)s\"),"},{"line_number":292,"context_line":"                         {\u0027count\u0027: count, \u0027port\u0027: context.current[\u0027id\u0027]})"},{"line_number":293,"context_line":"            if count \u003d\u003d MAX_BIND_TRIES:"},{"line_number":294,"context_line":"                final_binding_attempt \u003d True"},{"line_number":295,"context_line":""},{"line_number":296,"context_line":"            bind_context, need_notify, try_again \u003d self._attempt_binding("}],"source_content_type":"text/x-python","patch_set":27,"id":"3a7e1126_ff8b791c","line":293,"in_reply_to":"3a7e1126_963cd094","updated":"2015-12-17 17:35:39.000000000","message":"Yep, you\u0027re right, my mistake","commit_id":"7ec97739033199b53f2f233cd7d5b687a4f54e5d"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"c6cd09f399fe6ff512757b8dd1e333af7292c12d","unresolved":false,"context_lines":[{"line_number":290,"context_line":"                greenthread.sleep(0)  # yield"},{"line_number":291,"context_line":"                LOG.info(_LI(\"Attempt %(count)s to bind port %(port)s\"),"},{"line_number":292,"context_line":"                         {\u0027count\u0027: count, \u0027port\u0027: context.current[\u0027id\u0027]})"},{"line_number":293,"context_line":"            if count \u003d\u003d MAX_BIND_TRIES:"},{"line_number":294,"context_line":"                final_binding_attempt \u003d True"},{"line_number":295,"context_line":""},{"line_number":296,"context_line":"            bind_context, need_notify, try_again \u003d self._attempt_binding("}],"source_content_type":"text/x-python","patch_set":27,"id":"3a7e1126_963cd094","line":293,"in_reply_to":"5a710552_99c73e45","updated":"2015-12-17 13:33:37.000000000","message":"No, because range(1, MAX_BIND_TRIES+1) --\u003e [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].\n\nSo In the loop, the final value for count will be 10.","commit_id":"7ec97739033199b53f2f233cd7d5b687a4f54e5d"},{"author":{"_account_id":14957,"name":"Brad Behle","email":"behle@us.ibm.com","username":"behle"},"change_message_id":"df8f996ab8c83c33dd2bf02461085a3799ada155","unresolved":false,"context_lines":[{"line_number":343,"context_line":"        else:"},{"line_number":344,"context_line":"            # For other binding states, or when we don\u0027t know which host"},{"line_number":345,"context_line":"            # should be used for binding, just notify and bail out"},{"line_number":346,"context_line":"            need_notify \u003d True"},{"line_number":347,"context_line":""},{"line_number":348,"context_line":"        return context, need_notify, try_again"},{"line_number":349,"context_line":""}],"source_content_type":"text/x-python","patch_set":27,"id":"5a710552_30e2e6a0","line":346,"updated":"2015-12-14 20:20:30.000000000","message":"In the original code need_notify was not set to True in this case (where the bind isn\u0027t even attempted), so why is this being set to True here, especially when nothing has changed?\n\nI think if you remove this line, then you can remove your changes to the existing test cases in test_port_binding.py and those tests will all pass.","commit_id":"7ec97739033199b53f2f233cd7d5b687a4f54e5d"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"c6cd09f399fe6ff512757b8dd1e333af7292c12d","unresolved":false,"context_lines":[{"line_number":343,"context_line":"        else:"},{"line_number":344,"context_line":"            # For other binding states, or when we don\u0027t know which host"},{"line_number":345,"context_line":"            # should be used for binding, just notify and bail out"},{"line_number":346,"context_line":"            need_notify \u003d True"},{"line_number":347,"context_line":""},{"line_number":348,"context_line":"        return context, need_notify, try_again"},{"line_number":349,"context_line":""}],"source_content_type":"text/x-python","patch_set":27,"id":"3a7e1126_3935cf45","line":346,"in_reply_to":"5a710552_19599cfe","updated":"2015-12-17 13:33:37.000000000","message":"Ack. will run \u0027check experimental\u0027 just to see that nothing else is broken.","commit_id":"7ec97739033199b53f2f233cd7d5b687a4f54e5d"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"c6cd09f399fe6ff512757b8dd1e333af7292c12d","unresolved":false,"context_lines":[{"line_number":343,"context_line":"        else:"},{"line_number":344,"context_line":"            # For other binding states, or when we don\u0027t know which host"},{"line_number":345,"context_line":"            # should be used for binding, just notify and bail out"},{"line_number":346,"context_line":"            need_notify \u003d True"},{"line_number":347,"context_line":""},{"line_number":348,"context_line":"        return context, need_notify, try_again"},{"line_number":349,"context_line":""}],"source_content_type":"text/x-python","patch_set":27,"id":"3a7e1126_d9aa8b70","line":346,"in_reply_to":"5a710552_30e2e6a0","updated":"2015-12-17 13:33:37.000000000","message":"Done","commit_id":"7ec97739033199b53f2f233cd7d5b687a4f54e5d"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"bb3169ae9d02209d509d7bd00e86568a7dc1a015","unresolved":false,"context_lines":[{"line_number":343,"context_line":"        else:"},{"line_number":344,"context_line":"            # For other binding states, or when we don\u0027t know which host"},{"line_number":345,"context_line":"            # should be used for binding, just notify and bail out"},{"line_number":346,"context_line":"            need_notify \u003d True"},{"line_number":347,"context_line":""},{"line_number":348,"context_line":"        return context, need_notify, try_again"},{"line_number":349,"context_line":""}],"source_content_type":"text/x-python","patch_set":27,"id":"5a710552_88a226ad","line":346,"in_reply_to":"5a710552_30e2e6a0","updated":"2015-12-16 09:49:15.000000000","message":"I think Brad is onto something here.\n\nThe special case notification was originally introduced when we tried to unbreak Ironic DHCP options for FAILED ports (that seem the way h/w Ironic ports are represented in Neutron). The failure scenario for Ironic was that even if need_notify was originally True, but we failed to bind (because it\u0027s expected to stay FAILED), we lost the notification to DHCP agent about new DHCP options set for the port for TFTP, so Ironic machines could not boot their images from there.\n\nBrief look at the latest code for the patch suggests that we don\u0027t have the problem anymore (but the author is advised to check for himself). If so, that else: case can indeed be cleaned up.\n\nWe can validate that we don\u0027t break Ironic with \u0027check experimental\u0027 (tripleo job should be there, and tripleo uses ironic for undercloud in gate).\n\nYou can find first (not optimal) attempts to fix the notification for Ironic case in PS1 for the patch.\n\nAlso the failure scenario for Ironic was discussed back in:\n\nhttp://eavesdrop.openstack.org/irclogs/%23openstack-neutron/%23openstack-neutron.2015-03-06.log.html#t2015-03-06T16:25:06\n\n(see ihrachyshka, dprince, salv discussion there).","commit_id":"7ec97739033199b53f2f233cd7d5b687a4f54e5d"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"c6cd09f399fe6ff512757b8dd1e333af7292c12d","unresolved":false,"context_lines":[{"line_number":343,"context_line":"        else:"},{"line_number":344,"context_line":"            # For other binding states, or when we don\u0027t know which host"},{"line_number":345,"context_line":"            # should be used for binding, just notify and bail out"},{"line_number":346,"context_line":"            need_notify \u003d True"},{"line_number":347,"context_line":""},{"line_number":348,"context_line":"        return context, need_notify, try_again"},{"line_number":349,"context_line":""}],"source_content_type":"text/x-python","patch_set":27,"id":"3a7e1126_99bba3c4","line":346,"in_reply_to":"5a710552_88a226ad","updated":"2015-12-17 13:33:37.000000000","message":"Done","commit_id":"7ec97739033199b53f2f233cd7d5b687a4f54e5d"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"14c04e0d821a5bf02b9c2af6c360b3eece6a82a9","unresolved":false,"context_lines":[{"line_number":343,"context_line":"        else:"},{"line_number":344,"context_line":"            # For other binding states, or when we don\u0027t know which host"},{"line_number":345,"context_line":"            # should be used for binding, just notify and bail out"},{"line_number":346,"context_line":"            need_notify \u003d True"},{"line_number":347,"context_line":""},{"line_number":348,"context_line":"        return context, need_notify, try_again"},{"line_number":349,"context_line":""}],"source_content_type":"text/x-python","patch_set":27,"id":"5a710552_19599cfe","line":346,"in_reply_to":"5a710552_88a226ad","updated":"2015-12-16 14:31:29.000000000","message":"It looks like we run Ironic as part of the check queue now: gate-tempest-dsvm-ironic-pxe_ipa-nv","commit_id":"7ec97739033199b53f2f233cd7d5b687a4f54e5d"},{"author":{"_account_id":14957,"name":"Brad Behle","email":"behle@us.ibm.com","username":"behle"},"change_message_id":"df8f996ab8c83c33dd2bf02461085a3799ada155","unresolved":false,"context_lines":[{"line_number":362,"context_line":"                # return the unbound result from the initial"},{"line_number":363,"context_line":"                # transaction that completed before the deletion."},{"line_number":364,"context_line":"                LOG.debug(\"Port %s has been deleted concurrently\", port_id)"},{"line_number":365,"context_line":"                context \u003d orig_context"},{"line_number":366,"context_line":"            elif did_commit:"},{"line_number":367,"context_line":"                # Always notify for successful binding"},{"line_number":368,"context_line":"                need_notify \u003d True"}],"source_content_type":"text/x-python","patch_set":27,"id":"5a710552_59c55659","line":365,"updated":"2015-12-14 20:20:30.000000000","message":"This should probably set need_notify\u003dFalse and try_again\u003dFalse, since if the port has been deleted, there is no need to try again and in this case in the original code need_notify was set to False","commit_id":"7ec97739033199b53f2f233cd7d5b687a4f54e5d"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"c6cd09f399fe6ff512757b8dd1e333af7292c12d","unresolved":false,"context_lines":[{"line_number":362,"context_line":"                # return the unbound result from the initial"},{"line_number":363,"context_line":"                # transaction that completed before the deletion."},{"line_number":364,"context_line":"                LOG.debug(\"Port %s has been deleted concurrently\", port_id)"},{"line_number":365,"context_line":"                context \u003d orig_context"},{"line_number":366,"context_line":"            elif did_commit:"},{"line_number":367,"context_line":"                # Always notify for successful binding"},{"line_number":368,"context_line":"                need_notify \u003d True"}],"source_content_type":"text/x-python","patch_set":27,"id":"3a7e1126_595c5b25","line":365,"in_reply_to":"5a710552_59c55659","updated":"2015-12-17 13:33:37.000000000","message":"Done, Good catch Brad!","commit_id":"7ec97739033199b53f2f233cd7d5b687a4f54e5d"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"bb3169ae9d02209d509d7bd00e86568a7dc1a015","unresolved":false,"context_lines":[{"line_number":362,"context_line":"                # return the unbound result from the initial"},{"line_number":363,"context_line":"                # transaction that completed before the deletion."},{"line_number":364,"context_line":"                LOG.debug(\"Port %s has been deleted concurrently\", port_id)"},{"line_number":365,"context_line":"                context \u003d orig_context"},{"line_number":366,"context_line":"            elif did_commit:"},{"line_number":367,"context_line":"                # Always notify for successful binding"},{"line_number":368,"context_line":"                need_notify \u003d True"}],"source_content_type":"text/x-python","patch_set":27,"id":"5a710552_a8ba82be","line":365,"in_reply_to":"5a710552_59c55659","updated":"2015-12-16 09:49:15.000000000","message":"That\u0027s fair.","commit_id":"7ec97739033199b53f2f233cd7d5b687a4f54e5d"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"c6cd09f399fe6ff512757b8dd1e333af7292c12d","unresolved":false,"context_lines":[{"line_number":362,"context_line":"                # return the unbound result from the initial"},{"line_number":363,"context_line":"                # transaction that completed before the deletion."},{"line_number":364,"context_line":"                LOG.debug(\"Port %s has been deleted concurrently\", port_id)"},{"line_number":365,"context_line":"                context \u003d orig_context"},{"line_number":366,"context_line":"            elif did_commit:"},{"line_number":367,"context_line":"                # Always notify for successful binding"},{"line_number":368,"context_line":"                need_notify \u003d True"}],"source_content_type":"text/x-python","patch_set":27,"id":"3a7e1126_d9484b5e","line":365,"in_reply_to":"5a710552_a8ba82be","updated":"2015-12-17 13:33:37.000000000","message":"Done","commit_id":"7ec97739033199b53f2f233cd7d5b687a4f54e5d"},{"author":{"_account_id":14957,"name":"Brad Behle","email":"behle@us.ibm.com","username":"behle"},"change_message_id":"df8f996ab8c83c33dd2bf02461085a3799ada155","unresolved":false,"context_lines":[{"line_number":366,"context_line":"            elif did_commit:"},{"line_number":367,"context_line":"                # Always notify for successful binding"},{"line_number":368,"context_line":"                need_notify \u003d True"},{"line_number":369,"context_line":"                context \u003d new_context"},{"line_number":370,"context_line":"            else:"},{"line_number":371,"context_line":"                try_again \u003d True"},{"line_number":372,"context_line":"                context \u003d new_context"}],"source_content_type":"text/x-python","patch_set":27,"id":"5a710552_991dfe11","line":369,"updated":"2015-12-14 20:20:30.000000000","message":"try_again should probably be set to False here, so that the caller doesn\u0027t try the bind again.  The original behavior of this commit was that if it works, it doesn\u0027t try again.","commit_id":"7ec97739033199b53f2f233cd7d5b687a4f54e5d"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"bb3169ae9d02209d509d7bd00e86568a7dc1a015","unresolved":false,"context_lines":[{"line_number":366,"context_line":"            elif did_commit:"},{"line_number":367,"context_line":"                # Always notify for successful binding"},{"line_number":368,"context_line":"                need_notify \u003d True"},{"line_number":369,"context_line":"                context \u003d new_context"},{"line_number":370,"context_line":"            else:"},{"line_number":371,"context_line":"                try_again \u003d True"},{"line_number":372,"context_line":"                context \u003d new_context"}],"source_content_type":"text/x-python","patch_set":27,"id":"5a710552_c8c58e3c","line":369,"in_reply_to":"5a710552_991dfe11","updated":"2015-12-16 09:49:15.000000000","message":"Sounds right.","commit_id":"7ec97739033199b53f2f233cd7d5b687a4f54e5d"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"c6cd09f399fe6ff512757b8dd1e333af7292c12d","unresolved":false,"context_lines":[{"line_number":366,"context_line":"            elif did_commit:"},{"line_number":367,"context_line":"                # Always notify for successful binding"},{"line_number":368,"context_line":"                need_notify \u003d True"},{"line_number":369,"context_line":"                context \u003d new_context"},{"line_number":370,"context_line":"            else:"},{"line_number":371,"context_line":"                try_again \u003d True"},{"line_number":372,"context_line":"                context \u003d new_context"}],"source_content_type":"text/x-python","patch_set":27,"id":"3a7e1126_79d03754","line":369,"in_reply_to":"5a710552_c8c58e3c","updated":"2015-12-17 13:33:37.000000000","message":"Done","commit_id":"7ec97739033199b53f2f233cd7d5b687a4f54e5d"},{"author":{"_account_id":14957,"name":"Brad Behle","email":"behle@us.ibm.com","username":"behle"},"change_message_id":"716e1e2d75b10bc6424081f7ce1b49395dfd1e08","unresolved":false,"context_lines":[{"line_number":362,"context_line":"            elif did_commit:"},{"line_number":363,"context_line":"                # Always notify for successful binding"},{"line_number":364,"context_line":"                need_notify \u003d True"},{"line_number":365,"context_line":"                context \u003d new_context"},{"line_number":366,"context_line":"            else:"},{"line_number":367,"context_line":"                try_again \u003d True"},{"line_number":368,"context_line":"                context \u003d new_context"}],"source_content_type":"text/x-python","patch_set":29,"id":"3a7e1126_1f78c5f1","line":365,"updated":"2015-12-17 17:37:29.000000000","message":"The comments in ps27 indicated you were going to set try_again\u003dFalse here, but it looks like it was missed?","commit_id":"a75a698246338c0769cacf3f0bc8d86734cd01ab"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"32c803a484ab97f4b7d49cab7d15d0d92363dabb","unresolved":false,"context_lines":[{"line_number":362,"context_line":"            elif did_commit:"},{"line_number":363,"context_line":"                # Always notify for successful binding"},{"line_number":364,"context_line":"                need_notify \u003d True"},{"line_number":365,"context_line":"                context \u003d new_context"},{"line_number":366,"context_line":"            else:"},{"line_number":367,"context_line":"                try_again \u003d True"},{"line_number":368,"context_line":"                context \u003d new_context"}],"source_content_type":"text/x-python","patch_set":29,"id":"3a7e1126_a5cde2b8","line":365,"in_reply_to":"3a7e1126_1f78c5f1","updated":"2015-12-17 17:55:09.000000000","message":"my bad, done.","commit_id":"a75a698246338c0769cacf3f0bc8d86734cd01ab"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"c0f21ab55dc4ecccfd3e7919202d4efd6ed25302","unresolved":false,"context_lines":[{"line_number":281,"context_line":""},{"line_number":282,"context_line":"        for count in range(1, portbindings.MAX_BIND_TRIES + 1):"},{"line_number":283,"context_line":"            if count \u003e 1:"},{"line_number":284,"context_line":"                # multiple attempts shouldn\u0027t happen very often so we log each"},{"line_number":285,"context_line":"                # attempt after the 1st."},{"line_number":286,"context_line":""},{"line_number":287,"context_line":"                # yield for binding retries so that we give other threads a"},{"line_number":288,"context_line":"                # chance to do their work"}],"source_content_type":"text/x-python","patch_set":31,"id":"1a7b0d38_d7a8dddd","line":285,"range":{"start_line":284,"start_character":67,"end_line":285,"end_character":39},"updated":"2015-12-24 17:34:18.000000000","message":"This should be moved to before line 290.","commit_id":"f502fc59a18080bdaa3f6d226a49e199e0b9f9af"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"a389f60b998c0b800c42b474fe66d764927695e4","unresolved":false,"context_lines":[{"line_number":281,"context_line":""},{"line_number":282,"context_line":"        for count in range(1, portbindings.MAX_BIND_TRIES + 1):"},{"line_number":283,"context_line":"            if count \u003e 1:"},{"line_number":284,"context_line":"                # multiple attempts shouldn\u0027t happen very often so we log each"},{"line_number":285,"context_line":"                # attempt after the 1st."},{"line_number":286,"context_line":""},{"line_number":287,"context_line":"                # yield for binding retries so that we give other threads a"},{"line_number":288,"context_line":"                # chance to do their work"}],"source_content_type":"text/x-python","patch_set":31,"id":"1a7b0d38_effb99bf","line":285,"range":{"start_line":284,"start_character":67,"end_line":285,"end_character":39},"in_reply_to":"1a7b0d38_d7a8dddd","updated":"2015-12-27 10:55:10.000000000","message":"Done","commit_id":"f502fc59a18080bdaa3f6d226a49e199e0b9f9af"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"c0f21ab55dc4ecccfd3e7919202d4efd6ed25302","unresolved":false,"context_lines":[{"line_number":289,"context_line":"                greenthread.sleep(0)"},{"line_number":290,"context_line":"                LOG.info(_LI(\"Attempt %(count)s to bind port %(port)s\"),"},{"line_number":291,"context_line":"                         {\u0027count\u0027: count, \u0027port\u0027: context.current[\u0027id\u0027]})"},{"line_number":292,"context_line":"            if count \u003d\u003d portbindings.MAX_BIND_TRIES:"},{"line_number":293,"context_line":"                final_binding_attempt \u003d True"},{"line_number":294,"context_line":""},{"line_number":295,"context_line":"            bind_context, need_notify, try_again \u003d self._attempt_binding("}],"source_content_type":"text/x-python","patch_set":31,"id":"1a7b0d38_d771bda9","line":292,"range":{"start_line":292,"start_character":15,"end_line":292,"end_character":51},"updated":"2015-12-24 17:34:18.000000000","message":"final_binding_attempt \u003d (count \u003d\u003d portbindings.MAX_BIND_TRIES)\n\nAlso, it really doesn\u0027t deserve its own variable - line 298 can directly check if count \u003d\u003d MAX_BIND_TRIES.","commit_id":"f502fc59a18080bdaa3f6d226a49e199e0b9f9af"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"a389f60b998c0b800c42b474fe66d764927695e4","unresolved":false,"context_lines":[{"line_number":289,"context_line":"                greenthread.sleep(0)"},{"line_number":290,"context_line":"                LOG.info(_LI(\"Attempt %(count)s to bind port %(port)s\"),"},{"line_number":291,"context_line":"                         {\u0027count\u0027: count, \u0027port\u0027: context.current[\u0027id\u0027]})"},{"line_number":292,"context_line":"            if count \u003d\u003d portbindings.MAX_BIND_TRIES:"},{"line_number":293,"context_line":"                final_binding_attempt \u003d True"},{"line_number":294,"context_line":""},{"line_number":295,"context_line":"            bind_context, need_notify, try_again \u003d self._attempt_binding("}],"source_content_type":"text/x-python","patch_set":31,"id":"1a7b0d38_0ff945c7","line":292,"range":{"start_line":292,"start_character":15,"end_line":292,"end_character":51},"in_reply_to":"1a7b0d38_d771bda9","updated":"2015-12-27 10:55:10.000000000","message":"Done","commit_id":"f502fc59a18080bdaa3f6d226a49e199e0b9f9af"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"c0f21ab55dc4ecccfd3e7919202d4efd6ed25302","unresolved":false,"context_lines":[{"line_number":292,"context_line":"            if count \u003d\u003d portbindings.MAX_BIND_TRIES:"},{"line_number":293,"context_line":"                final_binding_attempt \u003d True"},{"line_number":294,"context_line":""},{"line_number":295,"context_line":"            bind_context, need_notify, try_again \u003d self._attempt_binding("},{"line_number":296,"context_line":"                context, need_notify)"},{"line_number":297,"context_line":""},{"line_number":298,"context_line":"            if final_binding_attempt or not try_again:"}],"source_content_type":"text/x-python","patch_set":31,"id":"1a7b0d38_578ced7e","line":295,"range":{"start_line":295,"start_character":39,"end_line":295,"end_character":48},"updated":"2015-12-24 17:34:18.000000000","message":"try_again can be either \u0027True\u0027 (meaning \u0027binding failed\u0027) or \u0027False\u0027 (meaning \u0027binding successful\u0027). Why not just rename it to \u0027is_successful\u0027 or something more explicit??","commit_id":"f502fc59a18080bdaa3f6d226a49e199e0b9f9af"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"a389f60b998c0b800c42b474fe66d764927695e4","unresolved":false,"context_lines":[{"line_number":292,"context_line":"            if count \u003d\u003d portbindings.MAX_BIND_TRIES:"},{"line_number":293,"context_line":"                final_binding_attempt \u003d True"},{"line_number":294,"context_line":""},{"line_number":295,"context_line":"            bind_context, need_notify, try_again \u003d self._attempt_binding("},{"line_number":296,"context_line":"                context, need_notify)"},{"line_number":297,"context_line":""},{"line_number":298,"context_line":"            if final_binding_attempt or not try_again:"}],"source_content_type":"text/x-python","patch_set":31,"id":"1a7b0d38_2f80c1f6","line":295,"range":{"start_line":295,"start_character":39,"end_line":295,"end_character":48},"in_reply_to":"1a7b0d38_578ced7e","updated":"2015-12-27 10:55:10.000000000","message":"1. try_again can be False for unsuccessful bindings, in cases were we have reached the last binding attempt (which failed) see line \n\n2. try_again can be True for successful binding with an unsuccessful binding commit (line 368). This btw, is how it currently works in master.\n\nto conclude, we try again (or stop trying again) for more than one reason. To me it this name seem more descriptive. also it keeps the naming closer to what we currently have in master.","commit_id":"f502fc59a18080bdaa3f6d226a49e199e0b9f9af"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"c0f21ab55dc4ecccfd3e7919202d4efd6ed25302","unresolved":false,"context_lines":[{"line_number":332,"context_line":"            bind_context \u003d self._bind_port(context)"},{"line_number":333,"context_line":""},{"line_number":334,"context_line":"            if bind_context.vif_type !\u003d portbindings.VIF_TYPE_BINDING_FAILED:"},{"line_number":335,"context_line":"                # Binding succeeded. Notify for successful binding."},{"line_number":336,"context_line":"                need_notify \u003d True"},{"line_number":337,"context_line":"            else:"},{"line_number":338,"context_line":"                # Current attempt binding failed, try to bind again."}],"source_content_type":"text/x-python","patch_set":31,"id":"1a7b0d38_7721e94c","line":335,"range":{"start_line":335,"start_character":37,"end_line":335,"end_character":43},"updated":"2015-12-24 17:34:18.000000000","message":"It should actually say \u0027Suggest notifying of successful binding\u0027, since in case \u0027allow_notify\u003dFalse\u0027 in _bind_port_if_needed nothing will be done.\n\nI would drop this comment altogether if you\u0027re renaming \u0027try_again\u0027 to \u0027is_successful\u0027.","commit_id":"f502fc59a18080bdaa3f6d226a49e199e0b9f9af"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"a389f60b998c0b800c42b474fe66d764927695e4","unresolved":false,"context_lines":[{"line_number":332,"context_line":"            bind_context \u003d self._bind_port(context)"},{"line_number":333,"context_line":""},{"line_number":334,"context_line":"            if bind_context.vif_type !\u003d portbindings.VIF_TYPE_BINDING_FAILED:"},{"line_number":335,"context_line":"                # Binding succeeded. Notify for successful binding."},{"line_number":336,"context_line":"                need_notify \u003d True"},{"line_number":337,"context_line":"            else:"},{"line_number":338,"context_line":"                # Current attempt binding failed, try to bind again."}],"source_content_type":"text/x-python","patch_set":31,"id":"1a7b0d38_0f7ce51d","line":335,"range":{"start_line":335,"start_character":37,"end_line":335,"end_character":43},"in_reply_to":"1a7b0d38_7721e94c","updated":"2015-12-27 10:55:10.000000000","message":"Done","commit_id":"f502fc59a18080bdaa3f6d226a49e199e0b9f9af"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"c0f21ab55dc4ecccfd3e7919202d4efd6ed25302","unresolved":false,"context_lines":[{"line_number":341,"context_line":""},{"line_number":342,"context_line":"        return context, need_notify, try_again"},{"line_number":343,"context_line":""},{"line_number":344,"context_line":"    def _attempt_commit_port_binding(self, orig_context, bind_context,"},{"line_number":345,"context_line":"                                     need_notify, try_again):"},{"line_number":346,"context_line":"        plugin_context \u003d orig_context._plugin_context"},{"line_number":347,"context_line":"        port_id \u003d orig_context.current[\u0027id\u0027]"}],"source_content_type":"text/x-python","patch_set":31,"id":"1a7b0d38_5272bb4a","line":344,"range":{"start_line":344,"start_character":8,"end_line":344,"end_character":36},"updated":"2015-12-24 17:34:18.000000000","message":"TL;DR: \u0027_commit_port_binding\u0027 should be taught to speak in \u0027context, need_notify, try_again\u0027 and not in the \u0027context, did_commit\u0027 language, and this function should then (probably) be removed.\n\nI\u0027ve been trying to pin-point the reason I don\u0027t like this function, and the reason I don\u0027t like it is that, at the end of the day, it simply wraps \u0027_commit_port_binding\u0027 and nothing more. It means that, for example, if the port has been concurrently deleted, the result is translated from terms of \u0027committed_context, did_commit\u0027 is translated to \u0027context, need_notify, try_again\u0027.\n\nThese translations are 1-to-1 in that it\u0027s hard coded in the code. Since we are going through this much pain modifying this code, we might as well go the whole nine yards and rework \u0027_commit_port_binding\u0027 as well. Note that this might seem painful but it shouldn\u0027t - only the return statements should be modified (I\u0027m not looking for an entire re-work of the function).","commit_id":"f502fc59a18080bdaa3f6d226a49e199e0b9f9af"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"a389f60b998c0b800c42b474fe66d764927695e4","unresolved":false,"context_lines":[{"line_number":341,"context_line":""},{"line_number":342,"context_line":"        return context, need_notify, try_again"},{"line_number":343,"context_line":""},{"line_number":344,"context_line":"    def _attempt_commit_port_binding(self, orig_context, bind_context,"},{"line_number":345,"context_line":"                                     need_notify, try_again):"},{"line_number":346,"context_line":"        plugin_context \u003d orig_context._plugin_context"},{"line_number":347,"context_line":"        port_id \u003d orig_context.current[\u0027id\u0027]"}],"source_content_type":"text/x-python","patch_set":31,"id":"1a7b0d38_cf725d11","line":344,"range":{"start_line":344,"start_character":8,"end_line":344,"end_character":36},"in_reply_to":"1a7b0d38_5272bb4a","updated":"2015-12-27 10:55:10.000000000","message":"Well, while I understand the logic behind this argument, I\u0027ve have to disagree:\n\n1. Splitting this logic from _commit_port_binding is, IMO, no different than the split between _attempt_binding and _bind_port.\n\n2. This function was originated from _attempt_binding, which in patchset 23, you (rightfully) commented that was too long (line 293). So I\u0027ve split the logic of binding the port and committing the port binding state into two different functions.\n\n3. _commit_port_binding is already 85 lines long, do we really want to expand it even more? I looked at it and frankly I don\u0027t know if and how it would be possible to make it shorter in a nice way.\n\n4. I\u0027m not saying that a significant refactor of _commit_port_binding is not needed, but I really don\u0027t think it belongs to this patch which should only handle the port binding retries.","commit_id":"f502fc59a18080bdaa3f6d226a49e199e0b9f9af"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"834544a46981a066fce612b2cc0720fbe9afe054","unresolved":false,"context_lines":[{"line_number":341,"context_line":""},{"line_number":342,"context_line":"        return context, need_notify, try_again"},{"line_number":343,"context_line":""},{"line_number":344,"context_line":"    def _attempt_commit_port_binding(self, orig_context, bind_context,"},{"line_number":345,"context_line":"                                     need_notify, try_again):"},{"line_number":346,"context_line":"        plugin_context \u003d orig_context._plugin_context"},{"line_number":347,"context_line":"        port_id \u003d orig_context.current[\u0027id\u0027]"}],"source_content_type":"text/x-python","patch_set":31,"id":"1a7b0d38_37aeaa98","line":344,"range":{"start_line":344,"start_character":8,"end_line":344,"end_character":36},"in_reply_to":"1a7b0d38_cf725d11","updated":"2015-12-29 12:22:22.000000000","message":"1. It is different, since ultimately _attempt_commit_port_binding adds no functionality except converting _commit_port_binding\u0027s \u0027did_commit\u0027 return value to \u0027need_notify, try_again\u0027. Since this is all the added value of this function, it can be eliminated and merged into _commit_port_binding. Also, \u0027_attempt_binding\u0027 is not as long as ~40 lines of code - this function is. Lastly, it might be better to remove \u0027_attempt_binding\u0027 as well, but I\u0027m not gonna push it.\n2. Fine by me, and I\u0027m happy you did.\n3. We\u0027d only expend it by a few more lines. Besides, you ought to be looking at it as \"we are eliminating some ~30 lines of code (\u0027_attempt_commit_port_binding\u0027 runs from L331 to L369) and adding a few more lines to \u0027_commit_port_binding\u0027, but ultimately making the code smaller\".\n4. I\u0027m not looking for a refactor of \u0027_commit_port_binding\u0027 - I\u0027m looking for a refactor of ;_attempt_commit_port_binding;.","commit_id":"f502fc59a18080bdaa3f6d226a49e199e0b9f9af"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"c0f21ab55dc4ecccfd3e7919202d4efd6ed25302","unresolved":false,"context_lines":[{"line_number":348,"context_line":"        binding \u003d orig_context._binding"},{"line_number":349,"context_line":""},{"line_number":350,"context_line":"        if self._should_bind_port(orig_context):"},{"line_number":351,"context_line":"            new_context, did_commit \u003d self._commit_port_binding("},{"line_number":352,"context_line":"                plugin_context, port_id, binding, bind_context)"},{"line_number":353,"context_line":""},{"line_number":354,"context_line":"            if not new_context:"}],"source_content_type":"text/x-python","patch_set":31,"id":"1a7b0d38_f2d08755","line":351,"range":{"start_line":351,"start_character":12,"end_line":351,"end_character":23},"updated":"2015-12-24 17:34:18.000000000","message":"Consider renaming \u0027new_context\u0027 to \u0027committed_context\u0027 for readability.","commit_id":"f502fc59a18080bdaa3f6d226a49e199e0b9f9af"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"729a314f4cd3965fec57017ec0c2dd803e30be79","unresolved":false,"context_lines":[{"line_number":348,"context_line":"        binding \u003d orig_context._binding"},{"line_number":349,"context_line":""},{"line_number":350,"context_line":"        if self._should_bind_port(orig_context):"},{"line_number":351,"context_line":"            new_context, did_commit \u003d self._commit_port_binding("},{"line_number":352,"context_line":"                plugin_context, port_id, binding, bind_context)"},{"line_number":353,"context_line":""},{"line_number":354,"context_line":"            if not new_context:"}],"source_content_type":"text/x-python","patch_set":31,"id":"fa69d971_a9838bcb","line":351,"range":{"start_line":351,"start_character":12,"end_line":351,"end_character":23},"in_reply_to":"1a7b0d38_37b30aeb","updated":"2016-01-18 10:43:51.000000000","message":"the naming here is not ideal, but in this case i think it should be left as-is.","commit_id":"f502fc59a18080bdaa3f6d226a49e199e0b9f9af"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"834544a46981a066fce612b2cc0720fbe9afe054","unresolved":false,"context_lines":[{"line_number":348,"context_line":"        binding \u003d orig_context._binding"},{"line_number":349,"context_line":""},{"line_number":350,"context_line":"        if self._should_bind_port(orig_context):"},{"line_number":351,"context_line":"            new_context, did_commit \u003d self._commit_port_binding("},{"line_number":352,"context_line":"                plugin_context, port_id, binding, bind_context)"},{"line_number":353,"context_line":""},{"line_number":354,"context_line":"            if not new_context:"}],"source_content_type":"text/x-python","patch_set":31,"id":"1a7b0d38_37b30aeb","line":351,"range":{"start_line":351,"start_character":12,"end_line":351,"end_character":23},"in_reply_to":"1a7b0d38_6a28f786","updated":"2015-12-29 12:22:22.000000000","message":"gah. the naming scheme is the worst here (not your fault).","commit_id":"f502fc59a18080bdaa3f6d226a49e199e0b9f9af"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"a389f60b998c0b800c42b474fe66d764927695e4","unresolved":false,"context_lines":[{"line_number":348,"context_line":"        binding \u003d orig_context._binding"},{"line_number":349,"context_line":""},{"line_number":350,"context_line":"        if self._should_bind_port(orig_context):"},{"line_number":351,"context_line":"            new_context, did_commit \u003d self._commit_port_binding("},{"line_number":352,"context_line":"                plugin_context, port_id, binding, bind_context)"},{"line_number":353,"context_line":""},{"line_number":354,"context_line":"            if not new_context:"}],"source_content_type":"text/x-python","patch_set":31,"id":"1a7b0d38_6a28f786","line":351,"range":{"start_line":351,"start_character":12,"end_line":351,"end_character":23},"in_reply_to":"1a7b0d38_f2d08755","updated":"2015-12-27 10:55:10.000000000","message":"what if we get some obj in new_context while did_commit\u003dFalse? we end up in line 367, but the context was not committed.","commit_id":"f502fc59a18080bdaa3f6d226a49e199e0b9f9af"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"c0f21ab55dc4ecccfd3e7919202d4efd6ed25302","unresolved":false,"context_lines":[{"line_number":352,"context_line":"                plugin_context, port_id, binding, bind_context)"},{"line_number":353,"context_line":""},{"line_number":354,"context_line":"            if not new_context:"},{"line_number":355,"context_line":"                # The port has been deleted concurrently, so just"},{"line_number":356,"context_line":"                # return the unbound result from the initial"},{"line_number":357,"context_line":"                # transaction that completed before the deletion."},{"line_number":358,"context_line":"                LOG.debug(\"Port %s has been deleted concurrently\", port_id)"}],"source_content_type":"text/x-python","patch_set":31,"id":"1a7b0d38_37a0419f","line":355,"range":{"start_line":355,"start_character":16,"end_line":355,"end_character":56},"updated":"2015-12-24 17:34:18.000000000","message":"This comment suggest to me that the (huge) comment in lines 320-328 should actually be moved to this function.","commit_id":"f502fc59a18080bdaa3f6d226a49e199e0b9f9af"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"a389f60b998c0b800c42b474fe66d764927695e4","unresolved":false,"context_lines":[{"line_number":352,"context_line":"                plugin_context, port_id, binding, bind_context)"},{"line_number":353,"context_line":""},{"line_number":354,"context_line":"            if not new_context:"},{"line_number":355,"context_line":"                # The port has been deleted concurrently, so just"},{"line_number":356,"context_line":"                # return the unbound result from the initial"},{"line_number":357,"context_line":"                # transaction that completed before the deletion."},{"line_number":358,"context_line":"                LOG.debug(\"Port %s has been deleted concurrently\", port_id)"}],"source_content_type":"text/x-python","patch_set":31,"id":"1a7b0d38_4a23bba7","line":355,"range":{"start_line":355,"start_character":16,"end_line":355,"end_character":56},"in_reply_to":"1a7b0d38_37a0419f","updated":"2015-12-27 10:55:10.000000000","message":"Done","commit_id":"f502fc59a18080bdaa3f6d226a49e199e0b9f9af"},{"author":{"_account_id":13667,"name":"ZongKai LI","email":"onionpiece@163.com","username":"lzklibj"},"change_message_id":"916362df65b1bca88775f3f4e2301f0d9ccd53d9","unresolved":false,"context_lines":[{"line_number":330,"context_line":""},{"line_number":331,"context_line":"    def _should_bind_port(self, context):"},{"line_number":332,"context_line":"        # The port isn\u0027t already bound and the necessary"},{"line_number":333,"context_line":"        # information is available, so attempt to bind the port."},{"line_number":334,"context_line":"        return (context._binding.host and context._binding.vif_type"},{"line_number":335,"context_line":"                in (portbindings.VIF_TYPE_UNBOUND,"},{"line_number":336,"context_line":"                    portbindings.VIF_TYPE_BINDING_FAILED))"}],"source_content_type":"text/x-python","patch_set":36,"id":"5a5ae5dd_74a05691","line":333,"updated":"2016-02-03 02:24:47.000000000","message":"Should update the comments.","commit_id":"67fa62770124894d971ef9c86f24f2654545a6f9"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"3dc7027c7cad5bbf59848b7e706b790bb0fc14b8","unresolved":false,"context_lines":[{"line_number":330,"context_line":""},{"line_number":331,"context_line":"    def _should_bind_port(self, context):"},{"line_number":332,"context_line":"        # The port isn\u0027t already bound and the necessary"},{"line_number":333,"context_line":"        # information is available, so attempt to bind the port."},{"line_number":334,"context_line":"        return (context._binding.host and context._binding.vif_type"},{"line_number":335,"context_line":"                in (portbindings.VIF_TYPE_UNBOUND,"},{"line_number":336,"context_line":"                    portbindings.VIF_TYPE_BINDING_FAILED))"}],"source_content_type":"text/x-python","patch_set":36,"id":"5a5ae5dd_9416d653","line":333,"in_reply_to":"5a5ae5dd_74a05691","updated":"2016-02-04 14:17:07.000000000","message":"care to elaborate?","commit_id":"67fa62770124894d971ef9c86f24f2654545a6f9"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"27812b69663191664d9084969a261bbad36af5d1","unresolved":false,"context_lines":[{"line_number":311,"context_line":""},{"line_number":312,"context_line":"            if count \u003d\u003d portbindings.MAX_BIND_TRIES or not try_again:"},{"line_number":313,"context_line":"                if self._should_bind_port(context):"},{"line_number":314,"context_line":"                    # tried to bind a port"},{"line_number":315,"context_line":"                    context, need_notify, try_again \u003d ("},{"line_number":316,"context_line":"                        self._commit_port_binding(context, bind_context,"},{"line_number":317,"context_line":"                                                  need_notify, try_again))"}],"source_content_type":"text/x-python","patch_set":38,"id":"5a5ae5dd_05362ee6","line":314,"range":{"start_line":314,"start_character":20,"end_line":314,"end_character":42},"updated":"2016-02-04 14:53:50.000000000","message":"Please extend this comment a bit more to describe where we are in the flow. \u0027tried to bind a port\u0027 isn\u0027t descriptive enough.","commit_id":"d260e1d51e3702082963cd839a3cb6f799b1e187"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"b671282a122f9d826821bd49c4f698ff0b35ce46","unresolved":false,"context_lines":[{"line_number":311,"context_line":""},{"line_number":312,"context_line":"            if count \u003d\u003d portbindings.MAX_BIND_TRIES or not try_again:"},{"line_number":313,"context_line":"                if self._should_bind_port(context):"},{"line_number":314,"context_line":"                    # tried to bind a port"},{"line_number":315,"context_line":"                    context, need_notify, try_again \u003d ("},{"line_number":316,"context_line":"                        self._commit_port_binding(context, bind_context,"},{"line_number":317,"context_line":"                                                  need_notify, try_again))"}],"source_content_type":"text/x-python","patch_set":38,"id":"5a5ae5dd_7c30c69e","line":314,"range":{"start_line":314,"start_character":20,"end_line":314,"end_character":42},"in_reply_to":"5a5ae5dd_05362ee6","updated":"2016-02-07 10:45:43.000000000","message":"Done","commit_id":"d260e1d51e3702082963cd839a3cb6f799b1e187"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"27812b69663191664d9084969a261bbad36af5d1","unresolved":false,"context_lines":[{"line_number":329,"context_line":"        return context"},{"line_number":330,"context_line":""},{"line_number":331,"context_line":"    def _should_bind_port(self, context):"},{"line_number":332,"context_line":"        # The port isn\u0027t already bound and the necessary"},{"line_number":333,"context_line":"        # information is available, so attempt to bind the port."},{"line_number":334,"context_line":"        return (context._binding.host and context._binding.vif_type"},{"line_number":335,"context_line":"                in (portbindings.VIF_TYPE_UNBOUND,"},{"line_number":336,"context_line":"                    portbindings.VIF_TYPE_BINDING_FAILED))"}],"source_content_type":"text/x-python","patch_set":38,"id":"5a5ae5dd_babdf969","line":333,"range":{"start_line":332,"start_character":7,"end_line":333,"end_character":64},"updated":"2016-02-04 14:53:50.000000000","message":"This comment is not relevant to the latest iteration of the code.","commit_id":"d260e1d51e3702082963cd839a3cb6f799b1e187"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"b671282a122f9d826821bd49c4f698ff0b35ce46","unresolved":false,"context_lines":[{"line_number":329,"context_line":"        return context"},{"line_number":330,"context_line":""},{"line_number":331,"context_line":"    def _should_bind_port(self, context):"},{"line_number":332,"context_line":"        # The port isn\u0027t already bound and the necessary"},{"line_number":333,"context_line":"        # information is available, so attempt to bind the port."},{"line_number":334,"context_line":"        return (context._binding.host and context._binding.vif_type"},{"line_number":335,"context_line":"                in (portbindings.VIF_TYPE_UNBOUND,"},{"line_number":336,"context_line":"                    portbindings.VIF_TYPE_BINDING_FAILED))"}],"source_content_type":"text/x-python","patch_set":38,"id":"5a5ae5dd_9cf262d1","line":333,"range":{"start_line":332,"start_character":7,"end_line":333,"end_character":64},"in_reply_to":"5a5ae5dd_babdf969","updated":"2016-02-07 10:45:43.000000000","message":"Agreed. Removing the comment since this is a tiny function and the code in it is descriptive enough","commit_id":"d260e1d51e3702082963cd839a3cb6f799b1e187"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"83454fe30d2b56bd42d754c69264ff879a46d2ba","unresolved":false,"context_lines":[{"line_number":453,"context_line":"                    port_db.status \u003d bind_context._new_port_status"},{"line_number":454,"context_line":"                    port[\u0027status\u0027] \u003d bind_context._new_port_status"},{"line_number":455,"context_line":""},{"line_number":456,"context_line":"                # Call the mechanism driver precommit methods, commit"},{"line_number":457,"context_line":"                # the results, and call the postcommit methods."},{"line_number":458,"context_line":"                self.mechanism_manager.update_port_precommit(cur_context)"},{"line_number":459,"context_line":"        if commit:"},{"line_number":460,"context_line":"            self.mechanism_manager.update_port_postcommit(cur_context)"}],"source_content_type":"text/x-python","patch_set":43,"id":"5a5ae5dd_83301609","line":457,"range":{"start_line":456,"start_character":63,"end_line":457,"end_character":29},"updated":"2016-02-09 13:28:24.000000000","message":"Do you have an idea where the commit referred by the comment happens?","commit_id":"bbe03658f0ce0da0e033a384b757f8bdb8a99463"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"280ac592f10699e93c72da075938525586d59c8f","unresolved":false,"context_lines":[{"line_number":453,"context_line":"                    port_db.status \u003d bind_context._new_port_status"},{"line_number":454,"context_line":"                    port[\u0027status\u0027] \u003d bind_context._new_port_status"},{"line_number":455,"context_line":""},{"line_number":456,"context_line":"                # Call the mechanism driver precommit methods, commit"},{"line_number":457,"context_line":"                # the results, and call the postcommit methods."},{"line_number":458,"context_line":"                self.mechanism_manager.update_port_precommit(cur_context)"},{"line_number":459,"context_line":"        if commit:"},{"line_number":460,"context_line":"            self.mechanism_manager.update_port_postcommit(cur_context)"}],"source_content_type":"text/x-python","patch_set":43,"id":"3a57f1b5_8ef36373","line":457,"range":{"start_line":456,"start_character":63,"end_line":457,"end_character":29},"in_reply_to":"5a5ae5dd_83301609","updated":"2016-02-10 09:26:29.000000000","message":"Sorry, disregard. The commit is done when transaction is closed.","commit_id":"bbe03658f0ce0da0e033a384b757f8bdb8a99463"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"83454fe30d2b56bd42d754c69264ff879a46d2ba","unresolved":false,"context_lines":[{"line_number":472,"context_line":"        # used. If attributes such as binding:host_id, binding:profile,"},{"line_number":473,"context_line":"        # or binding:vnic_type are updated concurrently, the try_again flag is"},{"line_number":474,"context_line":"        # returned to indicate that the commit was unsuccessful."},{"line_number":475,"context_line":"        if not cur_context:"},{"line_number":476,"context_line":"            # The port has been deleted concurrently, so just"},{"line_number":477,"context_line":"            # return the unbound result from the initial"},{"line_number":478,"context_line":"            # transaction that completed before the deletion."}],"source_content_type":"text/x-python","patch_set":43,"id":"5a5ae5dd_238602ba","line":475,"updated":"2016-02-09 13:28:24.000000000","message":"I am not sure when it will happen: the object is initialized in line 423, and there is no way the code won\u0027t trigger that line, so the block below won\u0027t ever happen.","commit_id":"bbe03658f0ce0da0e033a384b757f8bdb8a99463"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"2016987757521b5ac8012882fcca759604534208","unresolved":false,"context_lines":[{"line_number":472,"context_line":"        # used. If attributes such as binding:host_id, binding:profile,"},{"line_number":473,"context_line":"        # or binding:vnic_type are updated concurrently, the try_again flag is"},{"line_number":474,"context_line":"        # returned to indicate that the commit was unsuccessful."},{"line_number":475,"context_line":"        if not cur_context:"},{"line_number":476,"context_line":"            # The port has been deleted concurrently, so just"},{"line_number":477,"context_line":"            # return the unbound result from the initial"},{"line_number":478,"context_line":"            # transaction that completed before the deletion."}],"source_content_type":"text/x-python","patch_set":43,"id":"5a5ae5dd_35a957e0","line":475,"in_reply_to":"5a5ae5dd_238602ba","updated":"2016-02-10 15:05:58.000000000","message":"This block was inherited from master[1]. I simply squashed (with some modifications) _commit_port_binding and _attempt_binding.\n\nFollowing to our chat, I understand your comment is also related to the return statement in line#396, and you are correct, it remained unhandled.\n\nI have two solutions in mind:\n\n1. Revert the if statement in line#394 and modify the if statement in line#475 to handle port_db \u003d None --\u003e See patchset#44.\n\n2. Split _commit_port_binding to two functions, which I tried before --\u003e See patchset#33 line#331. This was changed due to jschwarz\u0027s comment in patchset#31 line344\n\n[1] https://github.com/openstack/neutron/blob/master/neutron/plugins/ml2/plugin.py#L352-L354","commit_id":"bbe03658f0ce0da0e033a384b757f8bdb8a99463"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"052913370ac8cbd231cf537a3fdff52b8e414ca3","unresolved":false,"context_lines":[{"line_number":473,"context_line":"        # used. If attributes such as binding:host_id, binding:profile,"},{"line_number":474,"context_line":"        # or binding:vnic_type are updated concurrently, the try_again flag is"},{"line_number":475,"context_line":"        # returned to indicate that the commit was unsuccessful."},{"line_number":476,"context_line":"        if not (cur_context and port_db):"},{"line_number":477,"context_line":"            # The port has been deleted concurrently, so just"},{"line_number":478,"context_line":"            # return the unbound result from the initial"},{"line_number":479,"context_line":"            # transaction that completed before the deletion."}],"source_content_type":"text/x-python","patch_set":44,"id":"3a57f1b5_a14b8586","line":476,"range":{"start_line":476,"start_character":16,"end_line":476,"end_character":27},"updated":"2016-02-11 12:14:48.000000000","message":"check for cur_context is redundant: it\u0027s always bool() \u003d\u003d True if port_db is boo() \u003d\u003d True.","commit_id":"9d0c2dd6f9468c0450f2e48c73f60b6cf10b8dd9"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"b9917075eed646ad4406423b8256bc5ea8c8ca1b","unresolved":false,"context_lines":[{"line_number":473,"context_line":"        # used. If attributes such as binding:host_id, binding:profile,"},{"line_number":474,"context_line":"        # or binding:vnic_type are updated concurrently, the try_again flag is"},{"line_number":475,"context_line":"        # returned to indicate that the commit was unsuccessful."},{"line_number":476,"context_line":"        if not (cur_context and port_db):"},{"line_number":477,"context_line":"            # The port has been deleted concurrently, so just"},{"line_number":478,"context_line":"            # return the unbound result from the initial"},{"line_number":479,"context_line":"            # transaction that completed before the deletion."}],"source_content_type":"text/x-python","patch_set":44,"id":"dae33548_16b48af0","line":476,"range":{"start_line":476,"start_character":16,"end_line":476,"end_character":27},"in_reply_to":"3a57f1b5_a14b8586","updated":"2016-02-14 14:30:33.000000000","message":"Done","commit_id":"9d0c2dd6f9468c0450f2e48c73f60b6cf10b8dd9"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"052913370ac8cbd231cf537a3fdff52b8e414ca3","unresolved":false,"context_lines":[{"line_number":474,"context_line":"        # or binding:vnic_type are updated concurrently, the try_again flag is"},{"line_number":475,"context_line":"        # returned to indicate that the commit was unsuccessful."},{"line_number":476,"context_line":"        if not (cur_context and port_db):"},{"line_number":477,"context_line":"            # The port has been deleted concurrently, so just"},{"line_number":478,"context_line":"            # return the unbound result from the initial"},{"line_number":479,"context_line":"            # transaction that completed before the deletion."},{"line_number":480,"context_line":"            LOG.debug(\"Port %s has been deleted concurrently\", port_id)"},{"line_number":481,"context_line":"            context \u003d orig_context"},{"line_number":482,"context_line":"            need_notify \u003d False"},{"line_number":483,"context_line":"            try_again \u003d False"},{"line_number":484,"context_line":"        elif commit:"},{"line_number":485,"context_line":"            # Always notify for successful binding"},{"line_number":486,"context_line":"            need_notify \u003d True"}],"source_content_type":"text/x-python","patch_set":44,"id":"3a57f1b5_fc19227a","line":483,"range":{"start_line":477,"start_character":12,"end_line":483,"end_character":29},"updated":"2016-02-11 12:14:48.000000000","message":"I suggest we move the handling to where the situation is detected: line 395. That way it\u0027s easier to follow the logic.","commit_id":"9d0c2dd6f9468c0450f2e48c73f60b6cf10b8dd9"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"b9917075eed646ad4406423b8256bc5ea8c8ca1b","unresolved":false,"context_lines":[{"line_number":474,"context_line":"        # or binding:vnic_type are updated concurrently, the try_again flag is"},{"line_number":475,"context_line":"        # returned to indicate that the commit was unsuccessful."},{"line_number":476,"context_line":"        if not (cur_context and port_db):"},{"line_number":477,"context_line":"            # The port has been deleted concurrently, so just"},{"line_number":478,"context_line":"            # return the unbound result from the initial"},{"line_number":479,"context_line":"            # transaction that completed before the deletion."},{"line_number":480,"context_line":"            LOG.debug(\"Port %s has been deleted concurrently\", port_id)"},{"line_number":481,"context_line":"            context \u003d orig_context"},{"line_number":482,"context_line":"            need_notify \u003d False"},{"line_number":483,"context_line":"            try_again \u003d False"},{"line_number":484,"context_line":"        elif commit:"},{"line_number":485,"context_line":"            # Always notify for successful binding"},{"line_number":486,"context_line":"            need_notify \u003d True"}],"source_content_type":"text/x-python","patch_set":44,"id":"dae33548_76eeb6ed","line":483,"range":{"start_line":477,"start_character":12,"end_line":483,"end_character":29},"in_reply_to":"3a57f1b5_fc19227a","updated":"2016-02-14 14:30:33.000000000","message":"Done","commit_id":"9d0c2dd6f9468c0450f2e48c73f60b6cf10b8dd9"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"052913370ac8cbd231cf537a3fdff52b8e414ca3","unresolved":false,"context_lines":[{"line_number":482,"context_line":"            need_notify \u003d False"},{"line_number":483,"context_line":"            try_again \u003d False"},{"line_number":484,"context_line":"        elif commit:"},{"line_number":485,"context_line":"            # Always notify for successful binding"},{"line_number":486,"context_line":"            need_notify \u003d True"},{"line_number":487,"context_line":"            try_again \u003d False"},{"line_number":488,"context_line":"            context \u003d cur_context"},{"line_number":489,"context_line":"        else:"},{"line_number":490,"context_line":"            try_again \u003d True"},{"line_number":491,"context_line":"            context \u003d cur_context"}],"source_content_type":"text/x-python","patch_set":44,"id":"3a57f1b5_5ca63611","line":488,"range":{"start_line":485,"start_character":12,"end_line":488,"end_character":33},"updated":"2016-02-11 12:14:48.000000000","message":"This section could easily go into line 462.","commit_id":"9d0c2dd6f9468c0450f2e48c73f60b6cf10b8dd9"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"b9917075eed646ad4406423b8256bc5ea8c8ca1b","unresolved":false,"context_lines":[{"line_number":482,"context_line":"            need_notify \u003d False"},{"line_number":483,"context_line":"            try_again \u003d False"},{"line_number":484,"context_line":"        elif commit:"},{"line_number":485,"context_line":"            # Always notify for successful binding"},{"line_number":486,"context_line":"            need_notify \u003d True"},{"line_number":487,"context_line":"            try_again \u003d False"},{"line_number":488,"context_line":"            context \u003d cur_context"},{"line_number":489,"context_line":"        else:"},{"line_number":490,"context_line":"            try_again \u003d True"},{"line_number":491,"context_line":"            context \u003d cur_context"}],"source_content_type":"text/x-python","patch_set":44,"id":"dae33548_d6b982ee","line":488,"range":{"start_line":485,"start_character":12,"end_line":488,"end_character":33},"in_reply_to":"3a57f1b5_5ca63611","updated":"2016-02-14 14:30:33.000000000","message":"Done","commit_id":"9d0c2dd6f9468c0450f2e48c73f60b6cf10b8dd9"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"052913370ac8cbd231cf537a3fdff52b8e414ca3","unresolved":false,"context_lines":[{"line_number":487,"context_line":"            try_again \u003d False"},{"line_number":488,"context_line":"            context \u003d cur_context"},{"line_number":489,"context_line":"        else:"},{"line_number":490,"context_line":"            try_again \u003d True"},{"line_number":491,"context_line":"            context \u003d cur_context"},{"line_number":492,"context_line":""},{"line_number":493,"context_line":"        return context, need_notify, try_again"},{"line_number":494,"context_line":""}],"source_content_type":"text/x-python","patch_set":44,"id":"3a57f1b5_9c834e56","line":491,"range":{"start_line":490,"start_character":12,"end_line":491,"end_character":33},"updated":"2016-02-11 12:14:48.000000000","message":"Should also be put above.","commit_id":"9d0c2dd6f9468c0450f2e48c73f60b6cf10b8dd9"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"b9917075eed646ad4406423b8256bc5ea8c8ca1b","unresolved":false,"context_lines":[{"line_number":487,"context_line":"            try_again \u003d False"},{"line_number":488,"context_line":"            context \u003d cur_context"},{"line_number":489,"context_line":"        else:"},{"line_number":490,"context_line":"            try_again \u003d True"},{"line_number":491,"context_line":"            context \u003d cur_context"},{"line_number":492,"context_line":""},{"line_number":493,"context_line":"        return context, need_notify, try_again"},{"line_number":494,"context_line":""}],"source_content_type":"text/x-python","patch_set":44,"id":"dae33548_b6be7ed2","line":491,"range":{"start_line":490,"start_character":12,"end_line":491,"end_character":33},"in_reply_to":"3a57f1b5_9c834e56","updated":"2016-02-14 14:30:33.000000000","message":"Done","commit_id":"9d0c2dd6f9468c0450f2e48c73f60b6cf10b8dd9"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"77b3a540f6601d56371c85547824339f074b0220","unresolved":false,"context_lines":[{"line_number":479,"context_line":"            context \u003d cur_context"},{"line_number":480,"context_line":"        else:"},{"line_number":481,"context_line":"            try_again \u003d True"},{"line_number":482,"context_line":"            context \u003d cur_context"},{"line_number":483,"context_line":""},{"line_number":484,"context_line":"        return context, need_notify, try_again"},{"line_number":485,"context_line":""}],"source_content_type":"text/x-python","patch_set":45,"id":"dae33548_ac20d84a","line":482,"updated":"2016-02-15 10:09:26.000000000","message":"nitty nitty nit: lines 482 and 479 could just be removed, and you would instead return it directly in line 484.","commit_id":"8158cb91f7581f47beb86b780ff5eb70c7c7b71f"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"7f4cdf12d647adb529eba54e89cd6a97aead6331","unresolved":false,"context_lines":[{"line_number":479,"context_line":"            context \u003d cur_context"},{"line_number":480,"context_line":"        else:"},{"line_number":481,"context_line":"            try_again \u003d True"},{"line_number":482,"context_line":"            context \u003d cur_context"},{"line_number":483,"context_line":""},{"line_number":484,"context_line":"        return context, need_notify, try_again"},{"line_number":485,"context_line":""}],"source_content_type":"text/x-python","patch_set":45,"id":"dae33548_475da7e8","line":482,"in_reply_to":"dae33548_ac20d84a","updated":"2016-02-15 10:31:35.000000000","message":"Done :-)","commit_id":"8158cb91f7581f47beb86b780ff5eb70c7c7b71f"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"36c04d186f605d5ac24d56df5b11bcdc14f39603","unresolved":false,"context_lines":[{"line_number":84,"context_line":"LOG \u003d log.getLogger(__name__)"},{"line_number":85,"context_line":""},{"line_number":86,"context_line":"MAX_BIND_TRIES \u003d 10"},{"line_number":87,"context_line":""},{"line_number":88,"context_line":""},{"line_number":89,"context_line":"SERVICE_PLUGINS_REQUIRED_DRIVERS \u003d {"},{"line_number":90,"context_line":"    \u0027qos\u0027: [qos_ext.QOS_EXT_DRIVER_ALIAS]"}],"source_content_type":"text/x-python","patch_set":47,"id":"dae33548_bdf5a384","side":"PARENT","line":87,"updated":"2016-02-15 11:40:29.000000000","message":"this change is unrelated","commit_id":"d6d43b32ca825b6c3c2c908f5ff7bc50c736546e"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"fd4472fe3b0c3fb606e18af59cc0723b285d8ad2","unresolved":false,"context_lines":[{"line_number":84,"context_line":"LOG \u003d log.getLogger(__name__)"},{"line_number":85,"context_line":""},{"line_number":86,"context_line":"MAX_BIND_TRIES \u003d 10"},{"line_number":87,"context_line":""},{"line_number":88,"context_line":""},{"line_number":89,"context_line":"SERVICE_PLUGINS_REQUIRED_DRIVERS \u003d {"},{"line_number":90,"context_line":"    \u0027qos\u0027: [qos_ext.QOS_EXT_DRIVER_ALIAS]"}],"source_content_type":"text/x-python","patch_set":47,"id":"dae33548_a641100e","side":"PARENT","line":87,"in_reply_to":"dae33548_bdf5a384","updated":"2016-02-15 12:27:17.000000000","message":"Done","commit_id":"d6d43b32ca825b6c3c2c908f5ff7bc50c736546e"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"36c04d186f605d5ac24d56df5b11bcdc14f39603","unresolved":false,"context_lines":[{"line_number":314,"context_line":"                    self._notify_port_updated(context)"},{"line_number":315,"context_line":"                return context"},{"line_number":316,"context_line":""},{"line_number":317,"context_line":"        LOG.error(_LE(\"Failed to commit binding results for %(port)s \""},{"line_number":318,"context_line":"                      \"after %(max)s tries\"),"},{"line_number":319,"context_line":"                  {\u0027port\u0027: context.current[\u0027id\u0027], \u0027max\u0027: MAX_BIND_TRIES})"},{"line_number":320,"context_line":"        return context"}],"source_content_type":"text/x-python","patch_set":47,"id":"dae33548_1d212ffc","side":"PARENT","line":317,"updated":"2016-02-15 11:40:29.000000000","message":"why does this log need to change?","commit_id":"d6d43b32ca825b6c3c2c908f5ff7bc50c736546e"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"fd4472fe3b0c3fb606e18af59cc0723b285d8ad2","unresolved":false,"context_lines":[{"line_number":314,"context_line":"                    self._notify_port_updated(context)"},{"line_number":315,"context_line":"                return context"},{"line_number":316,"context_line":""},{"line_number":317,"context_line":"        LOG.error(_LE(\"Failed to commit binding results for %(port)s \""},{"line_number":318,"context_line":"                      \"after %(max)s tries\"),"},{"line_number":319,"context_line":"                  {\u0027port\u0027: context.current[\u0027id\u0027], \u0027max\u0027: MAX_BIND_TRIES})"},{"line_number":320,"context_line":"        return context"}],"source_content_type":"text/x-python","patch_set":47,"id":"dae33548_266d0099","side":"PARENT","line":317,"in_reply_to":"dae33548_1d212ffc","updated":"2016-02-15 12:27:17.000000000","message":"Done","commit_id":"d6d43b32ca825b6c3c2c908f5ff7bc50c736546e"}],"neutron/tests/common/helpers.py":[{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"27812b69663191664d9084969a261bbad36af5d1","unresolved":false,"context_lines":[{"line_number":119,"context_line":""},{"line_number":120,"context_line":"def revive_agent(agent_id):"},{"line_number":121,"context_line":"    now \u003d timeutils.utcnow()"},{"line_number":122,"context_line":"    return FakePlugin().update_agent("},{"line_number":123,"context_line":"        context.get_admin_context(), agent_id,"},{"line_number":124,"context_line":"        {\u0027agent\u0027: {\u0027started_at\u0027: now, \u0027heartbeat_timestamp\u0027: now}})"},{"line_number":125,"context_line":""}],"source_content_type":"text/x-python","patch_set":38,"id":"5a5ae5dd_05e94e14","line":122,"range":{"start_line":122,"start_character":4,"end_line":122,"end_character":10},"updated":"2016-02-04 14:53:50.000000000","message":"As far as I can see, the return value of revive_agent is never used - so this \u0027return\u0027 should not be here. Same for the above \u0027return\u0027 in kill_agent.","commit_id":"d260e1d51e3702082963cd839a3cb6f799b1e187"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"b671282a122f9d826821bd49c4f698ff0b35ce46","unresolved":false,"context_lines":[{"line_number":119,"context_line":""},{"line_number":120,"context_line":"def revive_agent(agent_id):"},{"line_number":121,"context_line":"    now \u003d timeutils.utcnow()"},{"line_number":122,"context_line":"    return FakePlugin().update_agent("},{"line_number":123,"context_line":"        context.get_admin_context(), agent_id,"},{"line_number":124,"context_line":"        {\u0027agent\u0027: {\u0027started_at\u0027: now, \u0027heartbeat_timestamp\u0027: now}})"},{"line_number":125,"context_line":""}],"source_content_type":"text/x-python","patch_set":38,"id":"5a5ae5dd_dc969a4b","line":122,"range":{"start_line":122,"start_character":4,"end_line":122,"end_character":10},"in_reply_to":"5a5ae5dd_05e94e14","updated":"2016-02-07 10:45:43.000000000","message":"Done","commit_id":"d260e1d51e3702082963cd839a3cb6f799b1e187"}],"neutron/tests/functional/plugins/ml2/test_plugin.py":[{"author":{"_account_id":17776,"name":"Reedip","email":"reedip.banerjee@gmail.com","username":"Reedip"},"change_message_id":"13fbe46b27e69af43198b882cfd854f3da5a69a0","unresolved":false,"context_lines":[{"line_number":12,"context_line":"#    License for the specific language governing permissions and limitations"},{"line_number":13,"context_line":"#    under the License."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"# TODO: Functional tests"}],"source_content_type":"text/x-python","patch_set":20,"id":"fa80f949_f1b14248","line":15,"updated":"2015-11-06 01:33:49.000000000","message":"Can you rewrite this?\nJenkins is failing because of this:\n\n\n2015-11-05 10:29:30.310 |   /home/jenkins/workspace/gate-neutron-pep8$ /home/jenkins/workspace/gate-neutron-pep8/.tox/pep8/bin/flake8 \n2015-11-05 10:29:36.616 | ./neutron/tests/functional/plugins/ml2/test_plugin.py:1:1: H104  File contains nothing but comments\n2015-11-05 10:29:36.616 | # Copyright (c) 2015 Red Hat, Inc.\n2015-11-05 10:29:36.616 | ^\n2015-11-05 10:29:36.616 | ./neutron/tests/functional/plugins/ml2/test_plugin.py:15:3: H101  Use TODO(NAME)\n2015-11-05 10:29:36.616 | # TODO: Functional tests","commit_id":"faa4b17c12b18a9f67cf384b6d42ad2271ef992c"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"b3601e879b40b96378f9cfdbd8efc6a6a8ad33b5","unresolved":false,"context_lines":[{"line_number":12,"context_line":"#    License for the specific language governing permissions and limitations"},{"line_number":13,"context_line":"#    under the License."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"# TODO: Functional tests"}],"source_content_type":"text/x-python","patch_set":20,"id":"da85f559_90bb6072","line":15,"in_reply_to":"fa80f949_f1b14248","updated":"2015-11-09 15:08:09.000000000","message":"Done, until i finish the tests.","commit_id":"faa4b17c12b18a9f67cf384b6d42ad2271ef992c"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"27812b69663191664d9084969a261bbad36af5d1","unresolved":false,"context_lines":[{"line_number":23,"context_line":"from neutron.tests.unit.plugins.ml2 import base as ml2_test_base"},{"line_number":24,"context_line":""},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"DEVICE_OWNER_COMPUTE \u003d constants.DEVICE_OWNER_COMPUTE_PREFIX + \u0027fake\u0027"},{"line_number":27,"context_line":""},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"class TestMl2PortBinding(ml2_test_base.ML2TestFramework,"}],"source_content_type":"text/x-python","patch_set":38,"id":"5a5ae5dd_a5139a0c","line":26,"range":{"start_line":26,"start_character":0,"end_line":26,"end_character":20},"updated":"2016-02-04 14:53:50.000000000","message":"This constant is defined (numerous times) elsewhere and should be imported and not re-defined IMO. Sure, it\u0027s already done by practically anyone else, but we shouldn\u0027t follow existing bad code just because it\u0027s already there.","commit_id":"d260e1d51e3702082963cd839a3cb6f799b1e187"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"b671282a122f9d826821bd49c4f698ff0b35ce46","unresolved":false,"context_lines":[{"line_number":23,"context_line":"from neutron.tests.unit.plugins.ml2 import base as ml2_test_base"},{"line_number":24,"context_line":""},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"DEVICE_OWNER_COMPUTE \u003d constants.DEVICE_OWNER_COMPUTE_PREFIX + \u0027fake\u0027"},{"line_number":27,"context_line":""},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"class TestMl2PortBinding(ml2_test_base.ML2TestFramework,"}],"source_content_type":"text/x-python","patch_set":38,"id":"5a5ae5dd_37e1c02d","line":26,"range":{"start_line":26,"start_character":0,"end_line":26,"end_character":20},"in_reply_to":"5a5ae5dd_a5139a0c","updated":"2016-02-07 10:45:43.000000000","message":"Done","commit_id":"d260e1d51e3702082963cd839a3cb6f799b1e187"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"27812b69663191664d9084969a261bbad36af5d1","unresolved":false,"context_lines":[{"line_number":30,"context_line":"                         agents_db.AgentDbMixin):"},{"line_number":31,"context_line":"    def setUp(self):"},{"line_number":32,"context_line":"        super(TestMl2PortBinding, self).setUp()"},{"line_number":33,"context_line":"        self.ctx \u003d context.get_admin_context()"},{"line_number":34,"context_line":"        self.host_args \u003d {portbindings.HOST_ID: helpers.HOST,"},{"line_number":35,"context_line":"                          \u0027admin_state_up\u0027: True}"},{"line_number":36,"context_line":""}],"source_content_type":"text/x-python","patch_set":38,"id":"5a5ae5dd_c561f63a","line":33,"range":{"start_line":33,"start_character":13,"end_line":33,"end_character":17},"updated":"2016-02-04 14:53:50.000000000","message":"Rename to admin_context.","commit_id":"d260e1d51e3702082963cd839a3cb6f799b1e187"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"b671282a122f9d826821bd49c4f698ff0b35ce46","unresolved":false,"context_lines":[{"line_number":30,"context_line":"                         agents_db.AgentDbMixin):"},{"line_number":31,"context_line":"    def setUp(self):"},{"line_number":32,"context_line":"        super(TestMl2PortBinding, self).setUp()"},{"line_number":33,"context_line":"        self.ctx \u003d context.get_admin_context()"},{"line_number":34,"context_line":"        self.host_args \u003d {portbindings.HOST_ID: helpers.HOST,"},{"line_number":35,"context_line":"                          \u0027admin_state_up\u0027: True}"},{"line_number":36,"context_line":""}],"source_content_type":"text/x-python","patch_set":38,"id":"5a5ae5dd_7c8c4635","line":33,"range":{"start_line":33,"start_character":13,"end_line":33,"end_character":17},"in_reply_to":"5a5ae5dd_c561f63a","updated":"2016-02-07 10:45:43.000000000","message":"Done","commit_id":"d260e1d51e3702082963cd839a3cb6f799b1e187"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"27812b69663191664d9084969a261bbad36af5d1","unresolved":false,"context_lines":[{"line_number":34,"context_line":"        self.host_args \u003d {portbindings.HOST_ID: helpers.HOST,"},{"line_number":35,"context_line":"                          \u0027admin_state_up\u0027: True}"},{"line_number":36,"context_line":""},{"line_number":37,"context_line":"    def test_port_bind_successfully(self):"},{"line_number":38,"context_line":"        helpers.register_ovs_agent(host\u003dhelpers.HOST)"},{"line_number":39,"context_line":"        with self.network() as network:"},{"line_number":40,"context_line":"            with self.subnet(network\u003dnetwork) as subnet:"}],"source_content_type":"text/x-python","patch_set":38,"id":"5a5ae5dd_25f9ea4d","line":37,"range":{"start_line":37,"start_character":8,"end_line":37,"end_character":36},"updated":"2016-02-04 14:53:50.000000000","message":"It\u0027s probably a good idea to describe in a comment/docstring that self.port() runs bind_port_if_needed on its own accord so all we need to do is to make sure that it was successful. It is not easily inferred from the code.","commit_id":"d260e1d51e3702082963cd839a3cb6f799b1e187"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"b671282a122f9d826821bd49c4f698ff0b35ce46","unresolved":false,"context_lines":[{"line_number":34,"context_line":"        self.host_args \u003d {portbindings.HOST_ID: helpers.HOST,"},{"line_number":35,"context_line":"                          \u0027admin_state_up\u0027: True}"},{"line_number":36,"context_line":""},{"line_number":37,"context_line":"    def test_port_bind_successfully(self):"},{"line_number":38,"context_line":"        helpers.register_ovs_agent(host\u003dhelpers.HOST)"},{"line_number":39,"context_line":"        with self.network() as network:"},{"line_number":40,"context_line":"            with self.subnet(network\u003dnetwork) as subnet:"}],"source_content_type":"text/x-python","patch_set":38,"id":"5a5ae5dd_17e2842f","line":37,"range":{"start_line":37,"start_character":8,"end_line":37,"end_character":36},"in_reply_to":"5a5ae5dd_25f9ea4d","updated":"2016-02-07 10:45:43.000000000","message":"Done","commit_id":"d260e1d51e3702082963cd839a3cb6f799b1e187"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"27812b69663191664d9084969a261bbad36af5d1","unresolved":false,"context_lines":[{"line_number":59,"context_line":"                                     portbindings.VIF_TYPE_BINDING_FAILED)"},{"line_number":60,"context_line":"                    binding \u003d ml2_db.get_locked_port_and_binding("},{"line_number":61,"context_line":"                            self.context.session, port[\u0027port\u0027][\u0027id\u0027])[1]"},{"line_number":62,"context_line":"                    port_ctx \u003d driver_context.PortContext(self.driver,"},{"line_number":63,"context_line":"                                                          self.ctx,"},{"line_number":64,"context_line":"                                                          port[\u0027port\u0027],"},{"line_number":65,"context_line":"                                                          network[\u0027network\u0027],"}],"source_content_type":"text/x-python","patch_set":38,"id":"5a5ae5dd_c5bd7669","line":62,"range":{"start_line":62,"start_character":20,"end_line":62,"end_character":28},"updated":"2016-02-04 14:53:50.000000000","message":"Rename to \u0027port_context\u0027 to match the other \u0027*_context\u0027 variables.","commit_id":"d260e1d51e3702082963cd839a3cb6f799b1e187"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"b671282a122f9d826821bd49c4f698ff0b35ce46","unresolved":false,"context_lines":[{"line_number":59,"context_line":"                                     portbindings.VIF_TYPE_BINDING_FAILED)"},{"line_number":60,"context_line":"                    binding \u003d ml2_db.get_locked_port_and_binding("},{"line_number":61,"context_line":"                            self.context.session, port[\u0027port\u0027][\u0027id\u0027])[1]"},{"line_number":62,"context_line":"                    port_ctx \u003d driver_context.PortContext(self.driver,"},{"line_number":63,"context_line":"                                                          self.ctx,"},{"line_number":64,"context_line":"                                                          port[\u0027port\u0027],"},{"line_number":65,"context_line":"                                                          network[\u0027network\u0027],"}],"source_content_type":"text/x-python","patch_set":38,"id":"5a5ae5dd_3c9d6e59","line":62,"range":{"start_line":62,"start_character":20,"end_line":62,"end_character":28},"in_reply_to":"5a5ae5dd_c5bd7669","updated":"2016-02-07 10:45:43.000000000","message":"Done","commit_id":"d260e1d51e3702082963cd839a3cb6f799b1e187"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"27812b69663191664d9084969a261bbad36af5d1","unresolved":false,"context_lines":[{"line_number":67,"context_line":"                                                          None)"},{"line_number":68,"context_line":"                    helpers.revive_agent(agent.id)"},{"line_number":69,"context_line":"                    # Since the agent is back online, expect binding to succeed"},{"line_number":70,"context_line":"                    import ipdb; ipdb.set_trace()"},{"line_number":71,"context_line":"                    bound_context \u003d self.plugin._bind_port_if_needed(port_ctx)"},{"line_number":72,"context_line":"                    self.assertEqual(bound_context.vif_type,"},{"line_number":73,"context_line":"                                     portbindings.VIF_TYPE_OVS)"}],"source_content_type":"text/x-python","patch_set":38,"id":"5a5ae5dd_85a69e0e","line":70,"range":{"start_line":70,"start_character":20,"end_line":70,"end_character":49},"updated":"2016-02-04 14:53:50.000000000","message":"yikes.","commit_id":"d260e1d51e3702082963cd839a3cb6f799b1e187"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"b671282a122f9d826821bd49c4f698ff0b35ce46","unresolved":false,"context_lines":[{"line_number":67,"context_line":"                                                          None)"},{"line_number":68,"context_line":"                    helpers.revive_agent(agent.id)"},{"line_number":69,"context_line":"                    # Since the agent is back online, expect binding to succeed"},{"line_number":70,"context_line":"                    import ipdb; ipdb.set_trace()"},{"line_number":71,"context_line":"                    bound_context \u003d self.plugin._bind_port_if_needed(port_ctx)"},{"line_number":72,"context_line":"                    self.assertEqual(bound_context.vif_type,"},{"line_number":73,"context_line":"                                     portbindings.VIF_TYPE_OVS)"}],"source_content_type":"text/x-python","patch_set":38,"id":"5a5ae5dd_9c77c239","line":70,"range":{"start_line":70,"start_character":20,"end_line":70,"end_character":49},"in_reply_to":"5a5ae5dd_85a69e0e","updated":"2016-02-07 10:45:43.000000000","message":"Removed, sorry :)","commit_id":"d260e1d51e3702082963cd839a3cb6f799b1e187"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"b4605071ddb5f165c7076164a9d3ae8690ac00db","unresolved":false,"context_lines":[{"line_number":28,"context_line":"        self.admin_context \u003d context.get_admin_context()"},{"line_number":29,"context_line":"        self.host_args \u003d {portbindings.HOST_ID: helpers.HOST,"},{"line_number":30,"context_line":"                          \u0027admin_state_up\u0027: True}"},{"line_number":31,"context_line":"        self.fake_device_owner \u003d (constants.DEVICE_OWNER_COMPUTE_PREFIX +"},{"line_number":32,"context_line":"                                  helpers.HOST)"},{"line_number":33,"context_line":""},{"line_number":34,"context_line":"    def test_port_bind_successfully(self):"}],"source_content_type":"text/x-python","patch_set":41,"id":"5a5ae5dd_6550d00b","line":31,"range":{"start_line":31,"start_character":13,"end_line":31,"end_character":30},"updated":"2016-02-08 09:34:07.000000000","message":"nit: This should be a module-level constant","commit_id":"aeb88f04b7fcf8b6d79b265b90fdab983643dda9"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"ddf5622febf6792dd3e8959df9f96a391e588333","unresolved":false,"context_lines":[{"line_number":28,"context_line":"        self.admin_context \u003d context.get_admin_context()"},{"line_number":29,"context_line":"        self.host_args \u003d {portbindings.HOST_ID: helpers.HOST,"},{"line_number":30,"context_line":"                          \u0027admin_state_up\u0027: True}"},{"line_number":31,"context_line":"        self.fake_device_owner \u003d (constants.DEVICE_OWNER_COMPUTE_PREFIX +"},{"line_number":32,"context_line":"                                  helpers.HOST)"},{"line_number":33,"context_line":""},{"line_number":34,"context_line":"    def test_port_bind_successfully(self):"}],"source_content_type":"text/x-python","patch_set":41,"id":"5a5ae5dd_40f582ea","line":31,"range":{"start_line":31,"start_character":13,"end_line":31,"end_character":30},"in_reply_to":"5a5ae5dd_6550d00b","updated":"2016-02-08 09:53:35.000000000","message":"indeed. which is what I did in patchset#39. Since there are no common tests constants this is re-defined in each module.\nI\u0027ll refactor this in a follow-up patch.","commit_id":"aeb88f04b7fcf8b6d79b265b90fdab983643dda9"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"b4605071ddb5f165c7076164a9d3ae8690ac00db","unresolved":false,"context_lines":[{"line_number":42,"context_line":"                    # Note: Port creation invokes _bind_port_if_needed(),"},{"line_number":43,"context_line":"                    # therefore it is all we need in order to test a successful"},{"line_number":44,"context_line":"                    # binding"},{"line_number":45,"context_line":"                    self.assertEqual(port[\u0027port\u0027][\u0027binding:vif_type\u0027],"},{"line_number":46,"context_line":"                                     portbindings.VIF_TYPE_OVS)"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"    def test_port_bind_retry(self):"}],"source_content_type":"text/x-python","patch_set":41,"id":"5a5ae5dd_65d3f060","line":45,"range":{"start_line":45,"start_character":37,"end_line":45,"end_character":69},"updated":"2016-02-08 09:34:07.000000000","message":"Why in this test you\u0027re checking dict (port[\u0027port\u0027][\u0027binding:vif_type\u0027], but in line 67 you check bound_context.vif_type? Shouldn\u0027t they be the same?","commit_id":"aeb88f04b7fcf8b6d79b265b90fdab983643dda9"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"ddf5622febf6792dd3e8959df9f96a391e588333","unresolved":false,"context_lines":[{"line_number":42,"context_line":"                    # Note: Port creation invokes _bind_port_if_needed(),"},{"line_number":43,"context_line":"                    # therefore it is all we need in order to test a successful"},{"line_number":44,"context_line":"                    # binding"},{"line_number":45,"context_line":"                    self.assertEqual(port[\u0027port\u0027][\u0027binding:vif_type\u0027],"},{"line_number":46,"context_line":"                                     portbindings.VIF_TYPE_OVS)"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"    def test_port_bind_retry(self):"}],"source_content_type":"text/x-python","patch_set":41,"id":"5a5ae5dd_a0bd5603","line":45,"range":{"start_line":45,"start_character":37,"end_line":45,"end_character":69},"in_reply_to":"5a5ae5dd_65d3f060","updated":"2016-02-08 09:53:35.000000000","message":"This is because port is a port-dict whereas bound_context is a context object. I\u0027ve added an additional assert to verify that bound_context.current[\u0027binding:vif_type\u0027] is synced.","commit_id":"aeb88f04b7fcf8b6d79b265b90fdab983643dda9"}],"neutron/tests/unit/ml2/test_ml2_plugin.py":[{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"2316d301839757045341d7966a51b568f779d1b6","unresolved":false,"context_lines":[{"line_number":645,"context_line":"        # test when _commit_port_binding return binding_failed"},{"line_number":646,"context_line":"        self._test_bind_port_if_needed(plugin, mech_context, False)"},{"line_number":647,"context_line":"        # test when _commit_port_binding NOT return binding_failed"},{"line_number":648,"context_line":"        self._test_bind_port_if_needed(plugin, mech_context, True)"},{"line_number":649,"context_line":""},{"line_number":650,"context_line":"    def _test_bind_port_if_needed(self, plugin, mech_context, commit_fail):"},{"line_number":651,"context_line":"        for need_notify in (True, False):"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a80dd14_ed1f8a6e","line":648,"updated":"2015-03-12 02:44:44.000000000","message":"swapped comments?","commit_id":"9cb3ff4b6c3f2ebb9b56da4cf8e007f429897bd7"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"aed82e10dac404185b07eb7e4ff4b8f71e412845","unresolved":false,"context_lines":[{"line_number":645,"context_line":"        # test when _commit_port_binding return binding_failed"},{"line_number":646,"context_line":"        self._test_bind_port_if_needed(plugin, mech_context, False)"},{"line_number":647,"context_line":"        # test when _commit_port_binding NOT return binding_failed"},{"line_number":648,"context_line":"        self._test_bind_port_if_needed(plugin, mech_context, True)"},{"line_number":649,"context_line":""},{"line_number":650,"context_line":"    def _test_bind_port_if_needed(self, plugin, mech_context, commit_fail):"},{"line_number":651,"context_line":"        for need_notify in (True, False):"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a80dd14_c0c44042","line":648,"in_reply_to":"9a80dd14_ed1f8a6e","updated":"2015-03-12 10:47:52.000000000","message":"Ouch. I should have re-read the patch that I try to extend.","commit_id":"9cb3ff4b6c3f2ebb9b56da4cf8e007f429897bd7"},{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"2316d301839757045341d7966a51b568f779d1b6","unresolved":false,"context_lines":[{"line_number":682,"context_line":"                    else:"},{"line_number":683,"context_line":"                        self.assertEqual(portbindings.VIF_TYPE_OVS,"},{"line_number":684,"context_line":"                                bound_context._binding.vif_type)"},{"line_number":685,"context_line":"                    self.assertEqual(need_notify, notify.called)"},{"line_number":686,"context_line":""},{"line_number":687,"context_line":"    def test_port_binding_profile_not_changed(self):"},{"line_number":688,"context_line":"        profile \u003d {\u0027e\u0027: 5}"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a80dd14_8d5a8e81","line":685,"updated":"2015-03-12 02:44:44.000000000","message":"how about adding a check to confirm that it\u0027s called with the expected context?","commit_id":"9cb3ff4b6c3f2ebb9b56da4cf8e007f429897bd7"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"aed82e10dac404185b07eb7e4ff4b8f71e412845","unresolved":false,"context_lines":[{"line_number":682,"context_line":"                    else:"},{"line_number":683,"context_line":"                        self.assertEqual(portbindings.VIF_TYPE_OVS,"},{"line_number":684,"context_line":"                                bound_context._binding.vif_type)"},{"line_number":685,"context_line":"                    self.assertEqual(need_notify, notify.called)"},{"line_number":686,"context_line":""},{"line_number":687,"context_line":"    def test_port_binding_profile_not_changed(self):"},{"line_number":688,"context_line":"        profile \u003d {\u0027e\u0027: 5}"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a80dd14_74c99578","line":685,"in_reply_to":"9a80dd14_8d5a8e81","updated":"2015-03-12 10:47:52.000000000","message":"Good idea, will do.","commit_id":"9cb3ff4b6c3f2ebb9b56da4cf8e007f429897bd7"},{"author":{"_account_id":17096,"name":"Aditi Rajagopal","email":"arajagopal@us.ibm.com","username":"aditirajagopal"},"change_message_id":"56b006d7e74d2953d7cb9bcdd1ca101345a7113d","unresolved":false,"context_lines":[{"line_number":649,"context_line":""},{"line_number":650,"context_line":"    def _test_bind_port_if_needed(self, plugin, mech_context, commit_fail):"},{"line_number":651,"context_line":"        for need_notify in (True, False):"},{"line_number":652,"context_line":"            # mock _commit_port_binding"},{"line_number":653,"context_line":"            commit_context \u003d mock.MagicMock()"},{"line_number":654,"context_line":"            if commit_fail:"},{"line_number":655,"context_line":"                commit_context._binding.vif_type \u003d ("}],"source_content_type":"text/x-python","patch_set":12,"id":"ba3cc151_82ae617f","line":652,"updated":"2015-07-01 18:50:36.000000000","message":"Not sure if this is WIP, but please make sure you remove this in future commits if it is not being used","commit_id":"37b872468220057c85971f8b1aae7c804f60a715"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"fe30703441e5fc58930017b9f682980afd04d94d","unresolved":false,"context_lines":[{"line_number":649,"context_line":""},{"line_number":650,"context_line":"    def _test_bind_port_if_needed(self, plugin, mech_context, commit_fail):"},{"line_number":651,"context_line":"        for need_notify in (True, False):"},{"line_number":652,"context_line":"            # mock _commit_port_binding"},{"line_number":653,"context_line":"            commit_context \u003d mock.MagicMock()"},{"line_number":654,"context_line":"            if commit_fail:"},{"line_number":655,"context_line":"                commit_context._binding.vif_type \u003d ("}],"source_content_type":"text/x-python","patch_set":12,"id":"ba15a1d1_30d22a5d","line":652,"in_reply_to":"ba3cc151_82ae617f","updated":"2015-09-17 11:18:13.000000000","message":"Done","commit_id":"37b872468220057c85971f8b1aae7c804f60a715"}],"neutron/tests/unit/plugins/ml2/test_plugin.py":[{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"f39015c3e675d317227ebffd4775e43660f17e33","unresolved":false,"context_lines":[{"line_number":913,"context_line":"        # test when _commit_port_binding NOT return binding_failed"},{"line_number":914,"context_line":"        self._test_bind_port_if_needed(plugin, mech_context, False)"},{"line_number":915,"context_line":""},{"line_number":916,"context_line":"    def _test_bind_port_if_needed(self, plugin, mech_context, commit_fail):"},{"line_number":917,"context_line":"        for need_notify in (True, False):"},{"line_number":918,"context_line":"            commit_context \u003d mock.MagicMock()"},{"line_number":919,"context_line":"            if commit_fail:"}],"source_content_type":"text/x-python","patch_set":16,"id":"ba15a1d1_fdb6caf7","line":916,"updated":"2015-09-17 12:00:20.000000000","message":"Did you consider a mockless test?","commit_id":"7e0d8caeb0d4b77c3a610ac6d8b7521592aae885"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"55714559d4e79da8836ec632bac98b54263074b6","unresolved":false,"context_lines":[{"line_number":913,"context_line":"        # test when _commit_port_binding NOT return binding_failed"},{"line_number":914,"context_line":"        self._test_bind_port_if_needed(plugin, mech_context, False)"},{"line_number":915,"context_line":""},{"line_number":916,"context_line":"    def _test_bind_port_if_needed(self, plugin, mech_context, commit_fail):"},{"line_number":917,"context_line":"        for need_notify in (True, False):"},{"line_number":918,"context_line":"            commit_context \u003d mock.MagicMock()"},{"line_number":919,"context_line":"            if commit_fail:"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a26ad4f_f32bbee9","line":916,"in_reply_to":"ba15a1d1_fdb6caf7","updated":"2015-10-29 14:00:56.000000000","message":"Agreed. better tests (functional and unit) to be added in upcoming patch-sets.","commit_id":"7e0d8caeb0d4b77c3a610ac6d8b7521592aae885"},{"author":{"_account_id":11682,"name":"Ryan Moats","email":"rmoats@us.ibm.com","username":"regXboi"},"change_message_id":"bee30508e5b2bb4d1df1c9ea5a713c09f19d9a3b","unresolved":false,"context_lines":[{"line_number":913,"context_line":"        # test when _commit_port_binding NOT return binding_failed"},{"line_number":914,"context_line":"        self._test_bind_port_if_needed(plugin, mech_context, False)"},{"line_number":915,"context_line":""},{"line_number":916,"context_line":"    def _test_bind_port_if_needed(self, plugin, mech_context, commit_fail):"},{"line_number":917,"context_line":"        for need_notify in (True, False):"},{"line_number":918,"context_line":"            commit_context \u003d mock.MagicMock()"},{"line_number":919,"context_line":"            if commit_fail:"}],"source_content_type":"text/x-python","patch_set":16,"id":"ba15a1d1_9f85375b","line":916,"in_reply_to":"ba15a1d1_fdb6caf7","updated":"2015-09-17 14:48:29.000000000","message":"Given that pep8 notes that contextlib.nested is deprecated, that is probably a worthwhile consideration","commit_id":"7e0d8caeb0d4b77c3a610ac6d8b7521592aae885"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"c0f21ab55dc4ecccfd3e7919202d4efd6ed25302","unresolved":false,"context_lines":[{"line_number":918,"context_line":"            # should have returned before calling _make_port_dict"},{"line_number":919,"context_line":"            self.assertFalse(mpd_mock.mock_calls)"},{"line_number":920,"context_line":""},{"line_number":921,"context_line":"    def test_bind_port_if_needed(self):"},{"line_number":922,"context_line":"        # create a port and set its vif_type to binding_failed"},{"line_number":923,"context_line":"        with self.port() as port:"},{"line_number":924,"context_line":"            plugin \u003d manager.NeutronManager.get_plugin()"}],"source_content_type":"text/x-python","patch_set":31,"id":"1a7b0d38_52ee3bb5","line":921,"range":{"start_line":921,"start_character":8,"end_line":921,"end_character":32},"updated":"2015-12-24 17:34:18.000000000","message":"The fact that this test defines oh-so-many mocks (in the helper method \u0027_test_bind_port_if_needed\u0027, hints that it probably should be checked without mocks at all or be moved to a functional test.","commit_id":"f502fc59a18080bdaa3f6d226a49e199e0b9f9af"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"a389f60b998c0b800c42b474fe66d764927695e4","unresolved":false,"context_lines":[{"line_number":918,"context_line":"            # should have returned before calling _make_port_dict"},{"line_number":919,"context_line":"            self.assertFalse(mpd_mock.mock_calls)"},{"line_number":920,"context_line":""},{"line_number":921,"context_line":"    def test_bind_port_if_needed(self):"},{"line_number":922,"context_line":"        # create a port and set its vif_type to binding_failed"},{"line_number":923,"context_line":"        with self.port() as port:"},{"line_number":924,"context_line":"            plugin \u003d manager.NeutronManager.get_plugin()"}],"source_content_type":"text/x-python","patch_set":31,"id":"1a7b0d38_ea438740","line":921,"range":{"start_line":921,"start_character":8,"end_line":921,"end_character":32},"in_reply_to":"1a7b0d38_52ee3bb5","updated":"2015-12-27 10:55:10.000000000","message":"This test was originated from the original patchset, which was not written by (but was modified) myself.\n\nI\u0027m not fond of such heavy use of mocks either, but this is needed in order to isolate the unit test for this function.\n\nThis of course, won\u0027t come at an expense of functional tests, which are in the works.","commit_id":"f502fc59a18080bdaa3f6d226a49e199e0b9f9af"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"834544a46981a066fce612b2cc0720fbe9afe054","unresolved":false,"context_lines":[{"line_number":918,"context_line":"            # should have returned before calling _make_port_dict"},{"line_number":919,"context_line":"            self.assertFalse(mpd_mock.mock_calls)"},{"line_number":920,"context_line":""},{"line_number":921,"context_line":"    def test_bind_port_if_needed(self):"},{"line_number":922,"context_line":"        # create a port and set its vif_type to binding_failed"},{"line_number":923,"context_line":"        with self.port() as port:"},{"line_number":924,"context_line":"            plugin \u003d manager.NeutronManager.get_plugin()"}],"source_content_type":"text/x-python","patch_set":31,"id":"1a7b0d38_f7534269","line":921,"range":{"start_line":921,"start_character":8,"end_line":921,"end_character":32},"in_reply_to":"1a7b0d38_ea438740","updated":"2015-12-29 12:22:22.000000000","message":"For all intents and purposes, this test merely binds a port, except for the whole \"I don\u0027t want to actually bind it or put it in the DB\" restraints that unit tests hold. However, functional tests don\u0027t have this kind of restraints, so I suggest we rewrite this entire test in the functional suite instead.","commit_id":"f502fc59a18080bdaa3f6d226a49e199e0b9f9af"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"729a314f4cd3965fec57017ec0c2dd803e30be79","unresolved":false,"context_lines":[{"line_number":918,"context_line":"            # should have returned before calling _make_port_dict"},{"line_number":919,"context_line":"            self.assertFalse(mpd_mock.mock_calls)"},{"line_number":920,"context_line":""},{"line_number":921,"context_line":"    def test_bind_port_if_needed(self):"},{"line_number":922,"context_line":"        # create a port and set its vif_type to binding_failed"},{"line_number":923,"context_line":"        with self.port() as port:"},{"line_number":924,"context_line":"            plugin \u003d manager.NeutronManager.get_plugin()"}],"source_content_type":"text/x-python","patch_set":31,"id":"da6ed579_14c77e46","line":921,"range":{"start_line":921,"start_character":8,"end_line":921,"end_character":32},"in_reply_to":"1a7b0d38_f7534269","updated":"2016-01-18 10:43:51.000000000","message":"Ack. removing this test.\nWill replace it with functional tests.","commit_id":"f502fc59a18080bdaa3f6d226a49e199e0b9f9af"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"c0f21ab55dc4ecccfd3e7919202d4efd6ed25302","unresolved":false,"context_lines":[{"line_number":985,"context_line":"                plugin.get_network(self.context, port[\u0027port\u0027][\u0027network_id\u0027]),"},{"line_number":986,"context_line":"                binding, None)"},{"line_number":987,"context_line":"            bound_context \u003d mock.MagicMock()"},{"line_number":988,"context_line":"            if vif_type \u003d\u003d portbindings.VIF_TYPE_UNBOUND:"},{"line_number":989,"context_line":"                bound_context.vif_type \u003d portbindings.VIF_TYPE_OVS"},{"line_number":990,"context_line":"            else:"},{"line_number":991,"context_line":"                bound_context.vif_type \u003d vif_type"}],"source_content_type":"text/x-python","patch_set":31,"id":"1a7b0d38_127d13e7","line":988,"range":{"start_line":988,"start_character":15,"end_line":988,"end_character":23},"updated":"2015-12-24 17:34:18.000000000","message":"What if I want to write a test with an actual vif_type \u003d UNBOUND? This function translates \u0027UNBOUND\u0027 to \u0027OVS\u0027 without being explicit about it at all.. :\u003c","commit_id":"f502fc59a18080bdaa3f6d226a49e199e0b9f9af"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"a389f60b998c0b800c42b474fe66d764927695e4","unresolved":false,"context_lines":[{"line_number":985,"context_line":"                plugin.get_network(self.context, port[\u0027port\u0027][\u0027network_id\u0027]),"},{"line_number":986,"context_line":"                binding, None)"},{"line_number":987,"context_line":"            bound_context \u003d mock.MagicMock()"},{"line_number":988,"context_line":"            if vif_type \u003d\u003d portbindings.VIF_TYPE_UNBOUND:"},{"line_number":989,"context_line":"                bound_context.vif_type \u003d portbindings.VIF_TYPE_OVS"},{"line_number":990,"context_line":"            else:"},{"line_number":991,"context_line":"                bound_context.vif_type \u003d vif_type"}],"source_content_type":"text/x-python","patch_set":31,"id":"1a7b0d38_8a7be38b","line":988,"range":{"start_line":988,"start_character":15,"end_line":988,"end_character":23},"in_reply_to":"1a7b0d38_127d13e7","updated":"2015-12-27 10:55:10.000000000","message":"that\u0027s because it generates port_context, which is the context _before_ the binding attempt. and bound_context, which is the context for _after_ the binding attempt.\nthe bound_context obj is needed in order to test _attempt_binding and _attempt_commit_port_binding without invocation of _bind_port.\nI will add such comment to make it more explicit.","commit_id":"f502fc59a18080bdaa3f6d226a49e199e0b9f9af"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"c0f21ab55dc4ecccfd3e7919202d4efd6ed25302","unresolved":false,"context_lines":[{"line_number":1005,"context_line":"                notify_expected \u003d vif_type not in ("},{"line_number":1006,"context_line":"                    portbindings.VIF_TYPE_BINDING_FAILED,"},{"line_number":1007,"context_line":"                    portbindings.VIF_TYPE_OVS)"},{"line_number":1008,"context_line":"                if vif_type \u003d\u003d portbindings.VIF_TYPE_BINDING_FAILED:"},{"line_number":1009,"context_line":"                    self.assertTrue(try_again)"},{"line_number":1010,"context_line":"                    self.assertTrue(bd_mock.called)"},{"line_number":1011,"context_line":"                    self.assertEqual(need_notify, notify_expected)"}],"source_content_type":"text/x-python","patch_set":31,"id":"1a7b0d38_f2608737","line":1008,"range":{"start_line":1008,"start_character":16,"end_line":1008,"end_character":18},"updated":"2015-12-24 17:34:18.000000000","message":"Most of the next 8 asserts are very much alike, meaning this can be shortened quite a lot.","commit_id":"f502fc59a18080bdaa3f6d226a49e199e0b9f9af"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"a389f60b998c0b800c42b474fe66d764927695e4","unresolved":false,"context_lines":[{"line_number":1005,"context_line":"                notify_expected \u003d vif_type not in ("},{"line_number":1006,"context_line":"                    portbindings.VIF_TYPE_BINDING_FAILED,"},{"line_number":1007,"context_line":"                    portbindings.VIF_TYPE_OVS)"},{"line_number":1008,"context_line":"                if vif_type \u003d\u003d portbindings.VIF_TYPE_BINDING_FAILED:"},{"line_number":1009,"context_line":"                    self.assertTrue(try_again)"},{"line_number":1010,"context_line":"                    self.assertTrue(bd_mock.called)"},{"line_number":1011,"context_line":"                    self.assertEqual(need_notify, notify_expected)"}],"source_content_type":"text/x-python","patch_set":31,"id":"1a7b0d38_0a413338","line":1008,"range":{"start_line":1008,"start_character":16,"end_line":1008,"end_character":18},"in_reply_to":"1a7b0d38_f2608737","updated":"2015-12-27 10:55:10.000000000","message":"I\u0027ve managed to merge two lines, nothing more.","commit_id":"f502fc59a18080bdaa3f6d226a49e199e0b9f9af"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"834544a46981a066fce612b2cc0720fbe9afe054","unresolved":false,"context_lines":[{"line_number":1007,"context_line":"                    portbindings.VIF_TYPE_OVS)"},{"line_number":1008,"context_line":"                if vif_type \u003d\u003d portbindings.VIF_TYPE_BINDING_FAILED:"},{"line_number":1009,"context_line":"                    self.assertTrue(try_again)"},{"line_number":1010,"context_line":"                    self.assertTrue(bd_mock.called)"},{"line_number":1011,"context_line":"                    self.assertEqual(need_notify, notify_expected)"},{"line_number":1012,"context_line":"                    self.assertEqual(context.vif_type, vif_type)"},{"line_number":1013,"context_line":"                elif vif_type in (portbindings.VIF_TYPE_UNBOUND,"}],"source_content_type":"text/x-python","patch_set":31,"id":"1a7b0d38_37eb0a7a","line":1010,"range":{"start_line":1010,"start_character":25,"end_line":1010,"end_character":35},"updated":"2015-12-29 12:22:22.000000000","message":"Why is this \u0027assertTrue\u0027 but in line 1016 it\u0027s \u0027assertEqual\u0027? Perhaps we can unify them to a single statement and remove another code duplication?","commit_id":"f502fc59a18080bdaa3f6d226a49e199e0b9f9af"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"729a314f4cd3965fec57017ec0c2dd803e30be79","unresolved":false,"context_lines":[{"line_number":1007,"context_line":"                    portbindings.VIF_TYPE_OVS)"},{"line_number":1008,"context_line":"                if vif_type \u003d\u003d portbindings.VIF_TYPE_BINDING_FAILED:"},{"line_number":1009,"context_line":"                    self.assertTrue(try_again)"},{"line_number":1010,"context_line":"                    self.assertTrue(bd_mock.called)"},{"line_number":1011,"context_line":"                    self.assertEqual(need_notify, notify_expected)"},{"line_number":1012,"context_line":"                    self.assertEqual(context.vif_type, vif_type)"},{"line_number":1013,"context_line":"                elif vif_type in (portbindings.VIF_TYPE_UNBOUND,"}],"source_content_type":"text/x-python","patch_set":31,"id":"da6ed579_5f166f56","line":1010,"range":{"start_line":1010,"start_character":25,"end_line":1010,"end_character":35},"in_reply_to":"1a7b0d38_37eb0a7a","updated":"2016-01-18 10:43:51.000000000","message":"replied in next comment","commit_id":"f502fc59a18080bdaa3f6d226a49e199e0b9f9af"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"834544a46981a066fce612b2cc0720fbe9afe054","unresolved":false,"context_lines":[{"line_number":1009,"context_line":"                    self.assertTrue(try_again)"},{"line_number":1010,"context_line":"                    self.assertTrue(bd_mock.called)"},{"line_number":1011,"context_line":"                    self.assertEqual(need_notify, notify_expected)"},{"line_number":1012,"context_line":"                    self.assertEqual(context.vif_type, vif_type)"},{"line_number":1013,"context_line":"                elif vif_type in (portbindings.VIF_TYPE_UNBOUND,"},{"line_number":1014,"context_line":"                                  portbindings.VIF_TYPE_OVS):"},{"line_number":1015,"context_line":"                    self.assertFalse(try_again)"}],"source_content_type":"text/x-python","patch_set":31,"id":"1a7b0d38_d78ba6c1","line":1012,"range":{"start_line":1012,"start_character":20,"end_line":1012,"end_character":64},"updated":"2015-12-29 12:22:22.000000000","message":"Remove this line by using:\n\n if vif_type \u003d\u003d portbindings.VIF_TYPE_BINDING_FAILED:\n     expected_vif_type \u003d vif_type\n else:\n     expected_vif_type \u003d portbindings.VIF_TYPE_OVS\n self.assertEqual(expected_vif_type, context.vif_type)","commit_id":"f502fc59a18080bdaa3f6d226a49e199e0b9f9af"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"729a314f4cd3965fec57017ec0c2dd803e30be79","unresolved":false,"context_lines":[{"line_number":1009,"context_line":"                    self.assertTrue(try_again)"},{"line_number":1010,"context_line":"                    self.assertTrue(bd_mock.called)"},{"line_number":1011,"context_line":"                    self.assertEqual(need_notify, notify_expected)"},{"line_number":1012,"context_line":"                    self.assertEqual(context.vif_type, vif_type)"},{"line_number":1013,"context_line":"                elif vif_type in (portbindings.VIF_TYPE_UNBOUND,"},{"line_number":1014,"context_line":"                                  portbindings.VIF_TYPE_OVS):"},{"line_number":1015,"context_line":"                    self.assertFalse(try_again)"}],"source_content_type":"text/x-python","patch_set":31,"id":"da6ed579_9f1ce778","line":1012,"range":{"start_line":1012,"start_character":20,"end_line":1012,"end_character":64},"in_reply_to":"1a7b0d38_d78ba6c1","updated":"2016-01-18 10:43:51.000000000","message":"I used that approach, and number of assertions was reduced to 4. the trade-off is that I had to initialize some variables under that if/else statement.","commit_id":"f502fc59a18080bdaa3f6d226a49e199e0b9f9af"},{"author":{"_account_id":14957,"name":"Brad Behle","email":"behle@us.ibm.com","username":"behle"},"change_message_id":"c717f3533b561c940fb314c1ea3e5c624e1d9cd8","unresolved":false,"context_lines":[{"line_number":940,"context_line":"        for need_notify in (True, False):"},{"line_number":941,"context_line":"            commit_context \u003d mock.MagicMock()"},{"line_number":942,"context_line":"            commit_context._binding.vif_type \u003d (portbindings."},{"line_number":943,"context_line":"                                                VIF_TYPE_BINDING_FAILED)"},{"line_number":944,"context_line":"            with mock.patch(\u0027neutron.plugins.ml2.plugin.db.get_locked_port_and\u0027"},{"line_number":945,"context_line":"                            \u0027_binding\u0027, return_value\u003d(None, None)),\\"},{"line_number":946,"context_line":"                    mock.patch(\u0027neutron.plugins.ml2.plugin.Ml2Plugin.\u0027"}],"source_content_type":"text/x-python","patch_set":34,"id":"fa69d971_96968d3c","line":943,"range":{"start_line":943,"start_character":48,"end_line":943,"end_character":71},"updated":"2016-01-05 20:36:49.000000000","message":"Just putting this BINDING_FAILED flag in here isn\u0027t accomplishing anything, and was actually confusing me as I was trying to understand this test.  If the binding fails with \"VIF_TYPE_BINDING_FAILED\", then the bind is retried up to portbindings.MAX_BIND_TRIES.  However since you have mocked _bind_port below but not specified VIF_TYPE_BINDING_FAILED in the return_value, the code thinks that the binding succeeded and doesn\u0027t retry.  By putting this here and not adding it to the mock return value, the test is testing a specific code path that will never be run.\n\nIt would probably be enough just to have this unit test test out that the notification happens correctly in the cases where need_notify and did_commit are set to True or False, and handle the BINDING_FAILED cases in another unit test, or maybe in the functional tests","commit_id":"a7c3f1f92bdb7ddb01f6a53656cb9a6b0fb20ae1"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"07885a3d4caa9a18d77b2a50a68c594a8bb44edd","unresolved":false,"context_lines":[{"line_number":940,"context_line":"        for need_notify in (True, False):"},{"line_number":941,"context_line":"            commit_context \u003d mock.MagicMock()"},{"line_number":942,"context_line":"            commit_context._binding.vif_type \u003d (portbindings."},{"line_number":943,"context_line":"                                                VIF_TYPE_BINDING_FAILED)"},{"line_number":944,"context_line":"            with mock.patch(\u0027neutron.plugins.ml2.plugin.db.get_locked_port_and\u0027"},{"line_number":945,"context_line":"                            \u0027_binding\u0027, return_value\u003d(None, None)),\\"},{"line_number":946,"context_line":"                    mock.patch(\u0027neutron.plugins.ml2.plugin.Ml2Plugin.\u0027"}],"source_content_type":"text/x-python","patch_set":34,"id":"5a5ae5dd_d7869064","line":943,"range":{"start_line":943,"start_character":48,"end_line":943,"end_character":71},"in_reply_to":"7a5de9d1_6549598e","updated":"2016-02-04 14:17:17.000000000","message":"Functional tests were added in patchset #37","commit_id":"a7c3f1f92bdb7ddb01f6a53656cb9a6b0fb20ae1"},{"author":{"_account_id":14957,"name":"Brad Behle","email":"behle@us.ibm.com","username":"behle"},"change_message_id":"6c444b4350272f4be154d4010265e31567d6cc0f","unresolved":false,"context_lines":[{"line_number":940,"context_line":"        for need_notify in (True, False):"},{"line_number":941,"context_line":"            commit_context \u003d mock.MagicMock()"},{"line_number":942,"context_line":"            commit_context._binding.vif_type \u003d (portbindings."},{"line_number":943,"context_line":"                                                VIF_TYPE_BINDING_FAILED)"},{"line_number":944,"context_line":"            with mock.patch(\u0027neutron.plugins.ml2.plugin.db.get_locked_port_and\u0027"},{"line_number":945,"context_line":"                            \u0027_binding\u0027, return_value\u003d(None, None)),\\"},{"line_number":946,"context_line":"                    mock.patch(\u0027neutron.plugins.ml2.plugin.Ml2Plugin.\u0027"}],"source_content_type":"text/x-python","patch_set":34,"id":"7a5de9d1_6549598e","line":943,"range":{"start_line":943,"start_character":48,"end_line":943,"end_character":71},"in_reply_to":"da6ed579_5a243dae","updated":"2016-02-03 01:38:14.000000000","message":"Okay, makes sense.  I\u0027m looking forward to seeing the functional tests","commit_id":"a7c3f1f92bdb7ddb01f6a53656cb9a6b0fb20ae1"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"3367f522d79d4055fd8043f0cee9596ce5ea4d70","unresolved":false,"context_lines":[{"line_number":940,"context_line":"        for need_notify in (True, False):"},{"line_number":941,"context_line":"            commit_context \u003d mock.MagicMock()"},{"line_number":942,"context_line":"            commit_context._binding.vif_type \u003d (portbindings."},{"line_number":943,"context_line":"                                                VIF_TYPE_BINDING_FAILED)"},{"line_number":944,"context_line":"            with mock.patch(\u0027neutron.plugins.ml2.plugin.db.get_locked_port_and\u0027"},{"line_number":945,"context_line":"                            \u0027_binding\u0027, return_value\u003d(None, None)),\\"},{"line_number":946,"context_line":"                    mock.patch(\u0027neutron.plugins.ml2.plugin.Ml2Plugin.\u0027"}],"source_content_type":"text/x-python","patch_set":34,"id":"da6ed579_5a243dae","line":943,"range":{"start_line":943,"start_character":48,"end_line":943,"end_character":71},"in_reply_to":"fa69d971_96968d3c","updated":"2016-01-18 10:44:03.000000000","message":"Hi Brad. This test was provided with the original patch, and per your feedback (in addition to John\u0027s) I\u0027ve decided that this should indeed be replaced with a functional tests (which I planned to implement anyways). Thanks a lot for your feedback.","commit_id":"a7c3f1f92bdb7ddb01f6a53656cb9a6b0fb20ae1"},{"author":{"_account_id":14957,"name":"Brad Behle","email":"behle@us.ibm.com","username":"behle"},"change_message_id":"c717f3533b561c940fb314c1ea3e5c624e1d9cd8","unresolved":false,"context_lines":[{"line_number":948,"context_line":"                    mock.patch(\u0027neutron.plugins.ml2.plugin.Ml2Plugin._commit_\u0027"},{"line_number":949,"context_line":"                               \u0027port_binding\u0027,"},{"line_number":950,"context_line":"                               return_value\u003d(commit_context,"},{"line_number":951,"context_line":"                                             True)) as (commit_mock),\\"},{"line_number":952,"context_line":"                    mock.patch(\u0027neutron.plugins.ml2.driver_context.\u0027"},{"line_number":953,"context_line":"                               \u0027PortContext.bottom_bound_segment\u0027),\\"},{"line_number":954,"context_line":"                    mock.patch.object(plugin.notifier,"}],"source_content_type":"text/x-python","patch_set":34,"id":"fa69d971_96c76d97","line":951,"range":{"start_line":951,"start_character":45,"end_line":951,"end_character":49},"updated":"2016-01-05 20:36:49.000000000","message":"Shouldn\u0027t this be \"did_commit\"?","commit_id":"a7c3f1f92bdb7ddb01f6a53656cb9a6b0fb20ae1"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"3367f522d79d4055fd8043f0cee9596ce5ea4d70","unresolved":false,"context_lines":[{"line_number":948,"context_line":"                    mock.patch(\u0027neutron.plugins.ml2.plugin.Ml2Plugin._commit_\u0027"},{"line_number":949,"context_line":"                               \u0027port_binding\u0027,"},{"line_number":950,"context_line":"                               return_value\u003d(commit_context,"},{"line_number":951,"context_line":"                                             True)) as (commit_mock),\\"},{"line_number":952,"context_line":"                    mock.patch(\u0027neutron.plugins.ml2.driver_context.\u0027"},{"line_number":953,"context_line":"                               \u0027PortContext.bottom_bound_segment\u0027),\\"},{"line_number":954,"context_line":"                    mock.patch.object(plugin.notifier,"}],"source_content_type":"text/x-python","patch_set":34,"id":"da6ed579_9a03950d","line":951,"range":{"start_line":951,"start_character":45,"end_line":951,"end_character":49},"in_reply_to":"fa69d971_96c76d97","updated":"2016-01-18 10:44:03.000000000","message":"ditto.","commit_id":"a7c3f1f92bdb7ddb01f6a53656cb9a6b0fb20ae1"},{"author":{"_account_id":14957,"name":"Brad Behle","email":"behle@us.ibm.com","username":"behle"},"change_message_id":"c717f3533b561c940fb314c1ea3e5c624e1d9cd8","unresolved":false,"context_lines":[{"line_number":966,"context_line":"                self.assertEqual(portbindings.VIF_TYPE_BINDING_FAILED,"},{"line_number":967,"context_line":"                                 bound_context._binding.vif_type)"},{"line_number":968,"context_line":"                # check that notification was sent"},{"line_number":969,"context_line":"                notify_expected \u003d did_commit or (need_notify or did_commit)"},{"line_number":970,"context_line":"                if notify_expected:"},{"line_number":971,"context_line":"                    notify.assert_called_once_with("},{"line_number":972,"context_line":"                        bound_context._plugin_context,"}],"source_content_type":"text/x-python","patch_set":34,"id":"fa69d971_d62c0504","line":969,"range":{"start_line":969,"start_character":61,"end_line":969,"end_character":74},"updated":"2016-01-05 20:36:49.000000000","message":"This last did_commit is unnecessary, right?  Since the logical statement starts with \"did_commit or ...\"","commit_id":"a7c3f1f92bdb7ddb01f6a53656cb9a6b0fb20ae1"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"3367f522d79d4055fd8043f0cee9596ce5ea4d70","unresolved":false,"context_lines":[{"line_number":966,"context_line":"                self.assertEqual(portbindings.VIF_TYPE_BINDING_FAILED,"},{"line_number":967,"context_line":"                                 bound_context._binding.vif_type)"},{"line_number":968,"context_line":"                # check that notification was sent"},{"line_number":969,"context_line":"                notify_expected \u003d did_commit or (need_notify or did_commit)"},{"line_number":970,"context_line":"                if notify_expected:"},{"line_number":971,"context_line":"                    notify.assert_called_once_with("},{"line_number":972,"context_line":"                        bound_context._plugin_context,"}],"source_content_type":"text/x-python","patch_set":34,"id":"da6ed579_da302deb","line":969,"range":{"start_line":969,"start_character":61,"end_line":969,"end_character":74},"in_reply_to":"fa69d971_d62c0504","updated":"2016-01-18 10:44:03.000000000","message":"ditto.","commit_id":"a7c3f1f92bdb7ddb01f6a53656cb9a6b0fb20ae1"},{"author":{"_account_id":14957,"name":"Brad Behle","email":"behle@us.ibm.com","username":"behle"},"change_message_id":"c717f3533b561c940fb314c1ea3e5c624e1d9cd8","unresolved":false,"context_lines":[{"line_number":989,"context_line":"            # to look after _bind_port."},{"line_number":990,"context_line":"            bound_context \u003d mock.MagicMock()"},{"line_number":991,"context_line":"            if vif_type \u003d\u003d portbindings.VIF_TYPE_UNBOUND:"},{"line_number":992,"context_line":"                bound_context.vif_type \u003d portbindings.VIF_TYPE_OVS"},{"line_number":993,"context_line":"            else:"},{"line_number":994,"context_line":"                bound_context.vif_type \u003d vif_type"},{"line_number":995,"context_line":"            return plugin, port_context, bound_context"}],"source_content_type":"text/x-python","patch_set":34,"id":"fa69d971_840170b1","line":992,"updated":"2016-01-05 20:36:49.000000000","message":"I agree with John\u0027s previous comment here, this line was confusing to me at first.  I understand that you are simulating the _before_ context being UNBOUND and the _after_ context being OVS (successfully bound).  Adding a comment would be okay with me, however I think a better way to do this would be to allow the caller of this method to pass in the \"after\" vif_type by adding a vif_type_after parameter.  This way the caller could explicitly set up a test where the port is FAILED or UNBOUND before the bind but OVS (successfully bound) after the bind.  It would also make the test more clear in the case where the port bind status is FAILED before the bind and also FAILED after the bind (so one doesn\u0027t assume that a failed before the bind would be converted to OVS after the bind.","commit_id":"a7c3f1f92bdb7ddb01f6a53656cb9a6b0fb20ae1"},{"author":{"_account_id":14957,"name":"Brad Behle","email":"behle@us.ibm.com","username":"behle"},"change_message_id":"6c444b4350272f4be154d4010265e31567d6cc0f","unresolved":false,"context_lines":[{"line_number":989,"context_line":"            # to look after _bind_port."},{"line_number":990,"context_line":"            bound_context \u003d mock.MagicMock()"},{"line_number":991,"context_line":"            if vif_type \u003d\u003d portbindings.VIF_TYPE_UNBOUND:"},{"line_number":992,"context_line":"                bound_context.vif_type \u003d portbindings.VIF_TYPE_OVS"},{"line_number":993,"context_line":"            else:"},{"line_number":994,"context_line":"                bound_context.vif_type \u003d vif_type"},{"line_number":995,"context_line":"            return plugin, port_context, bound_context"}],"source_content_type":"text/x-python","patch_set":34,"id":"7a5de9d1_8567b524","line":992,"in_reply_to":"da6ed579_5a5c3ded","updated":"2016-02-03 01:38:14.000000000","message":"Thanks","commit_id":"a7c3f1f92bdb7ddb01f6a53656cb9a6b0fb20ae1"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"3367f522d79d4055fd8043f0cee9596ce5ea4d70","unresolved":false,"context_lines":[{"line_number":989,"context_line":"            # to look after _bind_port."},{"line_number":990,"context_line":"            bound_context \u003d mock.MagicMock()"},{"line_number":991,"context_line":"            if vif_type \u003d\u003d portbindings.VIF_TYPE_UNBOUND:"},{"line_number":992,"context_line":"                bound_context.vif_type \u003d portbindings.VIF_TYPE_OVS"},{"line_number":993,"context_line":"            else:"},{"line_number":994,"context_line":"                bound_context.vif_type \u003d vif_type"},{"line_number":995,"context_line":"            return plugin, port_context, bound_context"}],"source_content_type":"text/x-python","patch_set":34,"id":"da6ed579_5a5c3ded","line":992,"in_reply_to":"fa69d971_840170b1","updated":"2016-01-18 10:44:03.000000000","message":"That fair. I\u0027ve added an option for the caller to generate a bound_vif_type by preference.\nAlso took your advise in regards to the before and after vif_types in the test, for clarity.","commit_id":"a7c3f1f92bdb7ddb01f6a53656cb9a6b0fb20ae1"},{"author":{"_account_id":14957,"name":"Brad Behle","email":"behle@us.ibm.com","username":"behle"},"change_message_id":"c717f3533b561c940fb314c1ea3e5c624e1d9cd8","unresolved":false,"context_lines":[{"line_number":1017,"context_line":"                elif vif_type in (portbindings.VIF_TYPE_UNBOUND,"},{"line_number":1018,"context_line":"                                  portbindings.VIF_TYPE_OVS):"},{"line_number":1019,"context_line":"                    self.assertFalse(try_again)"},{"line_number":1020,"context_line":"                    self.assertEqual(bd_mock.called, notify_expected)"},{"line_number":1021,"context_line":"                    self.assertEqual(context.vif_type,"},{"line_number":1022,"context_line":"                                     portbindings.VIF_TYPE_OVS)"},{"line_number":1023,"context_line":""}],"source_content_type":"text/x-python","patch_set":34,"id":"fa69d971_a45d9416","line":1020,"updated":"2016-01-05 20:36:49.000000000","message":"For clarity, can you change this to assertEqual(bd_mock.called, vif_type \u003d\u003d portbindings.VIF_TYPE_UNBOUND)?  It seems this would be more clear \nsince whether _bind_port is called doesn\u0027t have anything to do with notify_expected, but is actually triggered by needing to try to bind since vif_type is either UNBOUND or FAILED","commit_id":"a7c3f1f92bdb7ddb01f6a53656cb9a6b0fb20ae1"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"3367f522d79d4055fd8043f0cee9596ce5ea4d70","unresolved":false,"context_lines":[{"line_number":1017,"context_line":"                elif vif_type in (portbindings.VIF_TYPE_UNBOUND,"},{"line_number":1018,"context_line":"                                  portbindings.VIF_TYPE_OVS):"},{"line_number":1019,"context_line":"                    self.assertFalse(try_again)"},{"line_number":1020,"context_line":"                    self.assertEqual(bd_mock.called, notify_expected)"},{"line_number":1021,"context_line":"                    self.assertEqual(context.vif_type,"},{"line_number":1022,"context_line":"                                     portbindings.VIF_TYPE_OVS)"},{"line_number":1023,"context_line":""}],"source_content_type":"text/x-python","patch_set":34,"id":"da6ed579_faae51e6","line":1020,"in_reply_to":"fa69d971_a45d9416","updated":"2016-01-18 10:44:03.000000000","message":"Done","commit_id":"a7c3f1f92bdb7ddb01f6a53656cb9a6b0fb20ae1"},{"author":{"_account_id":14957,"name":"Brad Behle","email":"behle@us.ibm.com","username":"behle"},"change_message_id":"6c444b4350272f4be154d4010265e31567d6cc0f","unresolved":false,"context_lines":[{"line_number":1017,"context_line":"                elif vif_type in (portbindings.VIF_TYPE_UNBOUND,"},{"line_number":1018,"context_line":"                                  portbindings.VIF_TYPE_OVS):"},{"line_number":1019,"context_line":"                    self.assertFalse(try_again)"},{"line_number":1020,"context_line":"                    self.assertEqual(bd_mock.called, notify_expected)"},{"line_number":1021,"context_line":"                    self.assertEqual(context.vif_type,"},{"line_number":1022,"context_line":"                                     portbindings.VIF_TYPE_OVS)"},{"line_number":1023,"context_line":""}],"source_content_type":"text/x-python","patch_set":34,"id":"7a5de9d1_65307908","line":1020,"in_reply_to":"fa69d971_a45d9416","updated":"2016-02-03 01:38:14.000000000","message":"Thanks","commit_id":"a7c3f1f92bdb7ddb01f6a53656cb9a6b0fb20ae1"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"27812b69663191664d9084969a261bbad36af5d1","unresolved":false,"context_lines":[{"line_number":1082,"context_line":"                    portbindings.VIF_TYPE_BINDING_FAILED,"},{"line_number":1083,"context_line":"                    portbindings.VIF_TYPE_OVS)"},{"line_number":1084,"context_line":""},{"line_number":1085,"context_line":"                if port_vif_type \u003d\u003d portbindings.VIF_TYPE_BINDING_FAILED:"},{"line_number":1086,"context_line":"                    expected_vif_type \u003d port_vif_type"},{"line_number":1087,"context_line":"                    expected_try_again \u003d True"},{"line_number":1088,"context_line":"                    expected_bd_mock_called \u003d True"}],"source_content_type":"text/x-python","patch_set":38,"id":"5a5ae5dd_201a386f","line":1085,"range":{"start_line":1085,"start_character":19,"end_line":1085,"end_character":72},"updated":"2016-02-04 14:53:50.000000000","message":"I\u0027m tempted to ask for some mock check that _attempt_binding was called exactly MAX_BIND_TRIES times.","commit_id":"d260e1d51e3702082963cd839a3cb6f799b1e187"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"b671282a122f9d826821bd49c4f698ff0b35ce46","unresolved":false,"context_lines":[{"line_number":1082,"context_line":"                    portbindings.VIF_TYPE_BINDING_FAILED,"},{"line_number":1083,"context_line":"                    portbindings.VIF_TYPE_OVS)"},{"line_number":1084,"context_line":""},{"line_number":1085,"context_line":"                if port_vif_type \u003d\u003d portbindings.VIF_TYPE_BINDING_FAILED:"},{"line_number":1086,"context_line":"                    expected_vif_type \u003d port_vif_type"},{"line_number":1087,"context_line":"                    expected_try_again \u003d True"},{"line_number":1088,"context_line":"                    expected_bd_mock_called \u003d True"}],"source_content_type":"text/x-python","patch_set":38,"id":"5a5ae5dd_37fc606f","line":1085,"range":{"start_line":1085,"start_character":19,"end_line":1085,"end_character":72},"in_reply_to":"5a5ae5dd_201a386f","updated":"2016-02-07 10:45:43.000000000","message":"I\u0027ve added a test to check that specifically. See test__attempt_binding_retries.\nAs Brad mentioned, this test needs many mocks.3 mocks was as low as I could manage.","commit_id":"d260e1d51e3702082963cd839a3cb6f799b1e187"},{"author":{"_account_id":14957,"name":"Brad Behle","email":"behle@us.ibm.com","username":"behle"},"change_message_id":"1d72b3271e6e85a9e47bc9aceaab575fbc30c62e","unresolved":false,"context_lines":[{"line_number":1082,"context_line":"                    portbindings.VIF_TYPE_BINDING_FAILED,"},{"line_number":1083,"context_line":"                    portbindings.VIF_TYPE_OVS)"},{"line_number":1084,"context_line":""},{"line_number":1085,"context_line":"                if port_vif_type \u003d\u003d portbindings.VIF_TYPE_BINDING_FAILED:"},{"line_number":1086,"context_line":"                    expected_vif_type \u003d port_vif_type"},{"line_number":1087,"context_line":"                    expected_try_again \u003d True"},{"line_number":1088,"context_line":"                    expected_bd_mock_called \u003d True"}],"source_content_type":"text/x-python","patch_set":38,"id":"5a5ae5dd_44c17f7f","line":1085,"range":{"start_line":1085,"start_character":19,"end_line":1085,"end_character":72},"in_reply_to":"5a5ae5dd_201a386f","updated":"2016-02-04 17:25:15.000000000","message":"This is only a test of _attempt_binding(), so it won\u0027t be retried.  The retry logic is in _bind_port_if_needed, which doesn\u0027t have a unit test due to the number of mocks needed to try to test parts of it.  It might be possible to unit test that the binding is attempted the correct number of retry times, but also might be a lot more trouble than it is worth.","commit_id":"d260e1d51e3702082963cd839a3cb6f799b1e187"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"27812b69663191664d9084969a261bbad36af5d1","unresolved":false,"context_lines":[{"line_number":1086,"context_line":"                    expected_vif_type \u003d port_vif_type"},{"line_number":1087,"context_line":"                    expected_try_again \u003d True"},{"line_number":1088,"context_line":"                    expected_bd_mock_called \u003d True"},{"line_number":1089,"context_line":"                else:"},{"line_number":1090,"context_line":"                    expected_vif_type \u003d portbindings.VIF_TYPE_OVS"},{"line_number":1091,"context_line":"                    expected_try_again \u003d False"},{"line_number":1092,"context_line":"                    expected_bd_mock_called \u003d (port_vif_type \u003d\u003d"}],"source_content_type":"text/x-python","patch_set":38,"id":"5a5ae5dd_403c14c8","line":1089,"range":{"start_line":1089,"start_character":16,"end_line":1089,"end_character":20},"updated":"2016-02-04 14:53:50.000000000","message":"I\u0027m also tempted to ask for some mock that checks _attempt_binding was called exactly once...","commit_id":"d260e1d51e3702082963cd839a3cb6f799b1e187"},{"author":{"_account_id":14957,"name":"Brad Behle","email":"behle@us.ibm.com","username":"behle"},"change_message_id":"1d72b3271e6e85a9e47bc9aceaab575fbc30c62e","unresolved":false,"context_lines":[{"line_number":1086,"context_line":"                    expected_vif_type \u003d port_vif_type"},{"line_number":1087,"context_line":"                    expected_try_again \u003d True"},{"line_number":1088,"context_line":"                    expected_bd_mock_called \u003d True"},{"line_number":1089,"context_line":"                else:"},{"line_number":1090,"context_line":"                    expected_vif_type \u003d portbindings.VIF_TYPE_OVS"},{"line_number":1091,"context_line":"                    expected_try_again \u003d False"},{"line_number":1092,"context_line":"                    expected_bd_mock_called \u003d (port_vif_type \u003d\u003d"}],"source_content_type":"text/x-python","patch_set":38,"id":"5a5ae5dd_64427b12","line":1089,"range":{"start_line":1089,"start_character":16,"end_line":1089,"end_character":20},"in_reply_to":"5a5ae5dd_403c14c8","updated":"2016-02-04 17:25:15.000000000","message":"See above","commit_id":"d260e1d51e3702082963cd839a3cb6f799b1e187"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"83454fe30d2b56bd42d754c69264ff879a46d2ba","unresolved":false,"context_lines":[{"line_number":1099,"context_line":""},{"line_number":1100,"context_line":"    def test__attempt_binding_retries(self):"},{"line_number":1101,"context_line":"        # Simulate a successful binding for vif_type unbound"},{"line_number":1102,"context_line":"        # and keep the same binding state for other vif types."},{"line_number":1103,"context_line":"        vif_types \u003d [(portbindings.VIF_TYPE_UNBOUND,"},{"line_number":1104,"context_line":"                      portbindings.VIF_TYPE_BINDING_FAILED),"},{"line_number":1105,"context_line":"                     (portbindings.VIF_TYPE_UNBOUND,"}],"source_content_type":"text/x-python","patch_set":43,"id":"5a5ae5dd_de68258a","line":1102,"updated":"2016-02-09 13:28:24.000000000","message":"is the comment correct?","commit_id":"bbe03658f0ce0da0e033a384b757f8bdb8a99463"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"2016987757521b5ac8012882fcca759604534208","unresolved":false,"context_lines":[{"line_number":1099,"context_line":""},{"line_number":1100,"context_line":"    def test__attempt_binding_retries(self):"},{"line_number":1101,"context_line":"        # Simulate a successful binding for vif_type unbound"},{"line_number":1102,"context_line":"        # and keep the same binding state for other vif types."},{"line_number":1103,"context_line":"        vif_types \u003d [(portbindings.VIF_TYPE_UNBOUND,"},{"line_number":1104,"context_line":"                      portbindings.VIF_TYPE_BINDING_FAILED),"},{"line_number":1105,"context_line":"                     (portbindings.VIF_TYPE_UNBOUND,"}],"source_content_type":"text/x-python","patch_set":43,"id":"3a57f1b5_630aae28","line":1102,"in_reply_to":"5a5ae5dd_de68258a","updated":"2016-02-10 15:05:58.000000000","message":"Done","commit_id":"bbe03658f0ce0da0e033a384b757f8bdb8a99463"}],"neutron/tests/unit/plugins/ml2/test_port_binding.py":[{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"64ad6849f3b004715de227751f8394cdc13848ac","unresolved":false,"context_lines":[{"line_number":156,"context_line":"                                     new_host)"},{"line_number":157,"context_line":"                else:"},{"line_number":158,"context_line":"                    self.assertEqual(port_data[portbindings.HOST_ID], host)"},{"line_number":159,"context_line":"                if new_host is not None or new_host !\u003d host:"},{"line_number":160,"context_line":"                    notify_mock.assert_called_once_with(mock.ANY)"},{"line_number":161,"context_line":""},{"line_number":162,"context_line":"    def test_update_with_new_host_binding_notifies_agent(self):"}],"source_content_type":"text/x-python","patch_set":20,"id":"fa80f949_9afc7c73","line":159,"updated":"2015-11-06 12:44:41.000000000","message":"can you explain the change?","commit_id":"faa4b17c12b18a9f67cf384b6d42ad2271ef992c"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"b3601e879b40b96378f9cfdbd8efc6a6a8ad33b5","unresolved":false,"context_lines":[{"line_number":156,"context_line":"                                     new_host)"},{"line_number":157,"context_line":"                else:"},{"line_number":158,"context_line":"                    self.assertEqual(port_data[portbindings.HOST_ID], host)"},{"line_number":159,"context_line":"                if new_host is not None or new_host !\u003d host:"},{"line_number":160,"context_line":"                    notify_mock.assert_called_once_with(mock.ANY)"},{"line_number":161,"context_line":""},{"line_number":162,"context_line":"    def test_update_with_new_host_binding_notifies_agent(self):"}],"source_content_type":"text/x-python","patch_set":20,"id":"da85f559_90b920ec","line":159,"in_reply_to":"fa80f949_9afc7c73","updated":"2015-11-09 15:08:09.000000000","message":"it\u0027s because both in test_update_with_same_host_binding_does_notify and test_update_without_binding_does_notify we now send notification.\n\n\nin test_update_with_same_host_binding_does_notify --\u003e\nhost \u003d host-ovs-no_filter ; \nnew_host \u003d host-ovs-no_filter\n\n\nin test_update_without_binding_does_notify --\u003e\nhost \u003d host-ovs-no_filter ; \nnew_host \u003d None\n\n\nso, this if statement will handle both cases.","commit_id":"faa4b17c12b18a9f67cf384b6d42ad2271ef992c"},{"author":{"_account_id":14957,"name":"Brad Behle","email":"behle@us.ibm.com","username":"behle"},"change_message_id":"025e4bb6591c2d32fe80d7a1de4a9a3ad936d3fc","unresolved":false,"context_lines":[{"line_number":156,"context_line":"                                     new_host)"},{"line_number":157,"context_line":"                else:"},{"line_number":158,"context_line":"                    self.assertEqual(port_data[portbindings.HOST_ID], host)"},{"line_number":159,"context_line":"                if new_host is not None or new_host !\u003d host:"},{"line_number":160,"context_line":"                    notify_mock.assert_called_once_with(mock.ANY)"},{"line_number":161,"context_line":""},{"line_number":162,"context_line":"    def test_update_with_new_host_binding_notifies_agent(self):"}],"source_content_type":"text/x-python","patch_set":25,"id":"9a8ffd7b_90fa0ebc","line":159,"updated":"2015-12-02 21:34:22.000000000","message":"Instead of changing these existing test cases so they pass with the new code, you should modify the new code so the test cases pass.  I put a few comments in plugin.py for how to fix the new code so these test case modifications aren\u0027t needed.  Unless there is a reason we do want to notify now in these cases where we didn\u0027t before?","commit_id":"c73f3cb201e517143b69f154134d5727902d4e79"},{"author":{"_account_id":14957,"name":"Brad Behle","email":"behle@us.ibm.com","username":"behle"},"change_message_id":"df8f996ab8c83c33dd2bf02461085a3799ada155","unresolved":false,"context_lines":[{"line_number":156,"context_line":"                                     new_host)"},{"line_number":157,"context_line":"                else:"},{"line_number":158,"context_line":"                    self.assertEqual(port_data[portbindings.HOST_ID], host)"},{"line_number":159,"context_line":"                if new_host is not None or new_host !\u003d host:"},{"line_number":160,"context_line":"                    notify_mock.assert_called_once_with(mock.ANY)"},{"line_number":161,"context_line":""},{"line_number":162,"context_line":"    def test_update_with_new_host_binding_notifies_agent(self):"}],"source_content_type":"text/x-python","patch_set":27,"id":"5a710552_995bbe54","line":159,"updated":"2015-12-14 20:20:30.000000000","message":"Same comment as before, Instead of changing these existing test cases so they pass with the new code, you should modify the new code so the test cases pass. I put a few comments in plugin.py for how to fix the new code so these test case modifications aren\u0027t needed. Unless there is a reason we do want to notify now in these cases where we didn\u0027t before?","commit_id":"7ec97739033199b53f2f233cd7d5b687a4f54e5d"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"c6cd09f399fe6ff512757b8dd1e333af7292c12d","unresolved":false,"context_lines":[{"line_number":156,"context_line":"                                     new_host)"},{"line_number":157,"context_line":"                else:"},{"line_number":158,"context_line":"                    self.assertEqual(port_data[portbindings.HOST_ID], host)"},{"line_number":159,"context_line":"                if new_host is not None or new_host !\u003d host:"},{"line_number":160,"context_line":"                    notify_mock.assert_called_once_with(mock.ANY)"},{"line_number":161,"context_line":""},{"line_number":162,"context_line":"    def test_update_with_new_host_binding_notifies_agent(self):"}],"source_content_type":"text/x-python","patch_set":27,"id":"3a7e1126_4970f872","line":159,"in_reply_to":"5a710552_995bbe54","updated":"2015-12-17 13:33:37.000000000","message":"Done","commit_id":"7ec97739033199b53f2f233cd7d5b687a4f54e5d"}],"releasenotes/notes/add-port-rebinding-chance-33178b9abacf5804.yaml":[{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"77b3a540f6601d56371c85547824339f074b0220","unresolved":false,"context_lines":[{"line_number":2,"context_line":"prelude: \u003e"},{"line_number":3,"context_line":"    Ports can now recover from binding failed state."},{"line_number":4,"context_line":"features:"},{"line_number":5,"context_line":"  - Ports who fail to bind when L2 agent was offline, can now recover by"},{"line_number":6,"context_line":"    binding reattempts when the agent is back online."},{"line_number":7,"context_line":"fixes:"},{"line_number":8,"context_line":"  - Closes bug 1399249"}],"source_content_type":"text/x-yaml","patch_set":45,"id":"dae33548_2cd3283a","line":5,"updated":"2016-02-15 10:09:26.000000000","message":"who -\u003e that, also I think comma is not needed.\n\nAdd a note that it\u0027s for ml2 plugin only.","commit_id":"8158cb91f7581f47beb86b780ff5eb70c7c7b71f"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"7f4cdf12d647adb529eba54e89cd6a97aead6331","unresolved":false,"context_lines":[{"line_number":2,"context_line":"prelude: \u003e"},{"line_number":3,"context_line":"    Ports can now recover from binding failed state."},{"line_number":4,"context_line":"features:"},{"line_number":5,"context_line":"  - Ports who fail to bind when L2 agent was offline, can now recover by"},{"line_number":6,"context_line":"    binding reattempts when the agent is back online."},{"line_number":7,"context_line":"fixes:"},{"line_number":8,"context_line":"  - Closes bug 1399249"}],"source_content_type":"text/x-yaml","patch_set":45,"id":"dae33548_cc039c0e","line":5,"in_reply_to":"dae33548_2cd3283a","updated":"2016-02-15 10:31:35.000000000","message":"Done","commit_id":"8158cb91f7581f47beb86b780ff5eb70c7c7b71f"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"77b3a540f6601d56371c85547824339f074b0220","unresolved":false,"context_lines":[{"line_number":5,"context_line":"  - Ports who fail to bind when L2 agent was offline, can now recover by"},{"line_number":6,"context_line":"    binding reattempts when the agent is back online."},{"line_number":7,"context_line":"fixes:"},{"line_number":8,"context_line":"  - Closes bug 1399249"}],"source_content_type":"text/x-yaml","patch_set":45,"id":"dae33548_2ca168aa","line":8,"updated":"2016-02-15 10:09:26.000000000","message":"I don\u0027t think you want the bug number here, do you? Suggesting removing fixes section.","commit_id":"8158cb91f7581f47beb86b780ff5eb70c7c7b71f"},{"author":{"_account_id":6579,"name":"Nir Magnezi","email":"nmagnezi@redhat.com","username":"nmagnezi"},"change_message_id":"7f4cdf12d647adb529eba54e89cd6a97aead6331","unresolved":false,"context_lines":[{"line_number":5,"context_line":"  - Ports who fail to bind when L2 agent was offline, can now recover by"},{"line_number":6,"context_line":"    binding reattempts when the agent is back online."},{"line_number":7,"context_line":"fixes:"},{"line_number":8,"context_line":"  - Closes bug 1399249"}],"source_content_type":"text/x-yaml","patch_set":45,"id":"dae33548_ecfca040","line":8,"in_reply_to":"dae33548_2ca168aa","updated":"2016-02-15 10:31:35.000000000","message":"Done","commit_id":"8158cb91f7581f47beb86b780ff5eb70c7c7b71f"}]}
