)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"9d2c826ec11a73b82a9bd99c14b351e736f13727","unresolved":false,"context_lines":[{"line_number":9,"context_line":"Previously, nova would delete all of the ports on an instance when"},{"line_number":10,"context_line":"the instance was deleted. Though it should only delete the ports that"},{"line_number":11,"context_line":"it had allocated. For example, ports explicitly passed in via"},{"line_number":12,"context_line":"--nic port-id\u003d\u003c\u003e should not be delete. This is done by adding a no_cleanup"},{"line_number":13,"context_line":"attribute in the info_cache which stores False if a port was allocated by"},{"line_number":14,"context_line":"nova and True if it was passed in via the api."},{"line_number":15,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":8,"id":"AAAAWH%2F%2FHtk%3D","line":12,"updated":"2014-03-20 04:40:47.000000000","message":"s/no_cleanup/preserve_on_delete :)","commit_id":"9c417e116981cfc75beebc0ff1dd625cbddf52ea"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"dc8326e78e42d2efb32825a3932bbb0334ab0c91","unresolved":false,"context_lines":[{"line_number":9,"context_line":"Previously, nova would delete all of the ports on an instance when"},{"line_number":10,"context_line":"the instance was deleted. Though it should only delete the ports that"},{"line_number":11,"context_line":"it had allocated. For example, ports explicitly passed in via"},{"line_number":12,"context_line":"--nic port-id\u003d\u003c\u003e should not be delete. This is done by adding a no_cleanup"},{"line_number":13,"context_line":"attribute in the info_cache which stores False if a port was allocated by"},{"line_number":14,"context_line":"nova and True if it was passed in via the api."},{"line_number":15,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":8,"id":"AAAAWH%2F%2FCdM%3D","line":12,"in_reply_to":"AAAAWH%2F%2FHtk%3D","updated":"2014-03-20 18:29:21.000000000","message":"Damn.","commit_id":"9c417e116981cfc75beebc0ff1dd625cbddf52ea"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"b4b5967885c1dba15900e92dbaf0d4e512156cd5","unresolved":false,"context_lines":[{"line_number":9,"context_line":"Previously, nova would delete all of the ports on an instance when"},{"line_number":10,"context_line":"the instance was deleted. Though it should only delete the ports that"},{"line_number":11,"context_line":"it had allocated. For example, ports explicitly passed in via"},{"line_number":12,"context_line":"--nic port-id\u003d\u003c\u003e should not be delete. This is done by adding a"},{"line_number":13,"context_line":"preserve_on_delete attribute in the info_cache which stores False if a port"},{"line_number":14,"context_line":"was allocated by nova and True if it was passed in via the api."},{"line_number":15,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":19,"id":"5adbc538_9c493c8e","line":12,"updated":"2014-05-25 19:55:44.000000000","message":"s/not be delete/not be deleted/","commit_id":"969cfa7ef235cf851828efc5021cbc55312ac942"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"8bf3435bb8e56abc529c02898a8155aadfdcd534","unresolved":false,"context_lines":[{"line_number":9,"context_line":"Previously, nova would delete all of the ports on an instance when"},{"line_number":10,"context_line":"the instance was deleted. Though it should only delete the ports that"},{"line_number":11,"context_line":"it had allocated. For example, ports explicitly passed in via"},{"line_number":12,"context_line":"--nic port-id\u003d\u003c\u003e should not be delete. This is done by adding a"},{"line_number":13,"context_line":"preserve_on_delete attribute in the info_cache which stores False if a port"},{"line_number":14,"context_line":"was allocated by nova and True if it was passed in via the api."},{"line_number":15,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":19,"id":"3ae8d1ca_54e77012","line":12,"in_reply_to":"5adbc538_9c493c8e","updated":"2014-05-28 16:48:37.000000000","message":"Done","commit_id":"969cfa7ef235cf851828efc5021cbc55312ac942"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"b4b5967885c1dba15900e92dbaf0d4e512156cd5","unresolved":false,"context_lines":[{"line_number":17,"context_line":"as it\u0027s a better name."},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"This patch also moves instance.info_cache.delete() to be called after"},{"line_number":20,"context_line":"_shutdown in the compute manger as shutdown calls deallocate_for_instance so"},{"line_number":21,"context_line":"the info_cache is still needed at this point."},{"line_number":22,"context_line":""},{"line_number":23,"context_line":"Change-Id: Ib99e62b786d5b545fbe12601a077008d2fa6d39d"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":19,"id":"5adbc538_bc5d184b","line":20,"updated":"2014-05-25 19:55:44.000000000","message":"s/manger/manager/","commit_id":"969cfa7ef235cf851828efc5021cbc55312ac942"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"8bf3435bb8e56abc529c02898a8155aadfdcd534","unresolved":false,"context_lines":[{"line_number":17,"context_line":"as it\u0027s a better name."},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"This patch also moves instance.info_cache.delete() to be called after"},{"line_number":20,"context_line":"_shutdown in the compute manger as shutdown calls deallocate_for_instance so"},{"line_number":21,"context_line":"the info_cache is still needed at this point."},{"line_number":22,"context_line":""},{"line_number":23,"context_line":"Change-Id: Ib99e62b786d5b545fbe12601a077008d2fa6d39d"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":19,"id":"3ae8d1ca_74e46c0d","line":20,"in_reply_to":"5adbc538_bc5d184b","updated":"2014-05-28 16:48:37.000000000","message":"Done","commit_id":"969cfa7ef235cf851828efc5021cbc55312ac942"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"bc7ad3f861d173a8d6ec65a20cee303691659b33","unresolved":false,"context_lines":[{"line_number":13,"context_line":"preserve_on_delete attribute in the info_cache which stores False if a port"},{"line_number":14,"context_line":"was allocated by nova and True if it was passed in via the api."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"This patch also renames touched_port_ids to preexisting_port_ids everywhere"},{"line_number":17,"context_line":"as it\u0027s a better name."},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"This patch also moves instance.info_cache.delete() to be called after"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":21,"id":"1ae5cdf2_121f1a5c","line":16,"updated":"2014-06-12 20:04:29.000000000","message":"Would have been nice to make this a dependent cleanup patch just to ease the burden on review...","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"7133d9ac267b3e988917d08620de6a6307ab9137","unresolved":false,"context_lines":[{"line_number":13,"context_line":"preserve_on_delete attribute in the info_cache which stores False if a port"},{"line_number":14,"context_line":"was allocated by nova and True if it was passed in via the api."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"This patch also renames touched_port_ids to preexisting_port_ids everywhere"},{"line_number":17,"context_line":"as it\u0027s a better name."},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"This patch also moves instance.info_cache.delete() to be called after"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":21,"id":"1ae5cdf2_5d745367","line":16,"in_reply_to":"1ae5cdf2_121f1a5c","updated":"2014-06-12 20:33:30.000000000","message":"Done","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"}],"nova/compute/manager.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"bc7ad3f861d173a8d6ec65a20cee303691659b33","unresolved":false,"context_lines":[{"line_number":2233,"context_line":"            self._notify_about_instance_usage(context, instance,"},{"line_number":2234,"context_line":"                                              \"delete.start\")"},{"line_number":2235,"context_line":"            self._shutdown_instance(context, db_inst, bdms)"},{"line_number":2236,"context_line":"            instance.info_cache.delete()"},{"line_number":2237,"context_line":"            # NOTE(vish): We have already deleted the instance, so we have"},{"line_number":2238,"context_line":"            #             to ignore problems cleaning up the volumes. It"},{"line_number":2239,"context_line":"            #             would be nice to let the user know somehow that"}],"source_content_type":"text/x-python","patch_set":21,"id":"1ae5cdf2_52436241","line":2236,"updated":"2014-06-12 20:04:29.000000000","message":"Would be nice to enforce the order of calls here somewhere in the unit tests, preferably something in nova.tests.compute.test_compute_mgr that mocks or stubs the calls out somehow to ensure they are called in the proper order.\n\nWhat happens if this gets screwed up at some point and the nw info_cache is gone when deallocate_for_instance is called?  Do we just silently leak/fail or will we reload the cache so we do the deallocate properly?","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"7133d9ac267b3e988917d08620de6a6307ab9137","unresolved":false,"context_lines":[{"line_number":2233,"context_line":"            self._notify_about_instance_usage(context, instance,"},{"line_number":2234,"context_line":"                                              \"delete.start\")"},{"line_number":2235,"context_line":"            self._shutdown_instance(context, db_inst, bdms)"},{"line_number":2236,"context_line":"            instance.info_cache.delete()"},{"line_number":2237,"context_line":"            # NOTE(vish): We have already deleted the instance, so we have"},{"line_number":2238,"context_line":"            #             to ignore problems cleaning up the volumes. It"},{"line_number":2239,"context_line":"            #             would be nice to let the user know somehow that"}],"source_content_type":"text/x-python","patch_set":21,"id":"1ae5cdf2_9dab3b74","line":2236,"in_reply_to":"1ae5cdf2_52436241","updated":"2014-06-12 20:33:30.000000000","message":"Sounds good I\u0027ll add a test. \n\nWe silently leak, though if this occurs i think it would be better to fix the bug rather than trying to do a reload to work around it.","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"d915e0ddcb2391270cc48c7cb53f8160fe545a46","unresolved":false,"context_lines":[{"line_number":2233,"context_line":"            self._notify_about_instance_usage(context, instance,"},{"line_number":2234,"context_line":"                                              \"delete.start\")"},{"line_number":2235,"context_line":"            self._shutdown_instance(context, db_inst, bdms)"},{"line_number":2236,"context_line":"            instance.info_cache.delete()"},{"line_number":2237,"context_line":"            # NOTE(vish): We have already deleted the instance, so we have"},{"line_number":2238,"context_line":"            #             to ignore problems cleaning up the volumes. It"},{"line_number":2239,"context_line":"            #             would be nice to let the user know somehow that"}],"source_content_type":"text/x-python","patch_set":21,"id":"1ae5cdf2_edb42884","line":2236,"in_reply_to":"1ae5cdf2_719853c0","updated":"2014-06-16 22:34:17.000000000","message":"Man this is a tough test to add :/ been at this for a while now X.x","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"dd0083a4dab8d838e10ed57b1814abb6f8a91eae","unresolved":false,"context_lines":[{"line_number":2233,"context_line":"            self._notify_about_instance_usage(context, instance,"},{"line_number":2234,"context_line":"                                              \"delete.start\")"},{"line_number":2235,"context_line":"            self._shutdown_instance(context, db_inst, bdms)"},{"line_number":2236,"context_line":"            instance.info_cache.delete()"},{"line_number":2237,"context_line":"            # NOTE(vish): We have already deleted the instance, so we have"},{"line_number":2238,"context_line":"            #             to ignore problems cleaning up the volumes. It"},{"line_number":2239,"context_line":"            #             would be nice to let the user know somehow that"}],"source_content_type":"text/x-python","patch_set":21,"id":"1ae5cdf2_719853c0","line":2236,"in_reply_to":"1ae5cdf2_9dab3b74","updated":"2014-06-13 01:53:56.000000000","message":"Rather than silently leak can we fail somehow, like if nw info cache isn\u0027t available when we expect it to be?  Asked the same later.","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"22deaed9a1b9b57a54a3794222c07ef4502b0aa2","unresolved":false,"context_lines":[{"line_number":2233,"context_line":"            self._notify_about_instance_usage(context, instance,"},{"line_number":2234,"context_line":"                                              \"delete.start\")"},{"line_number":2235,"context_line":"            self._shutdown_instance(context, db_inst, bdms)"},{"line_number":2236,"context_line":"            instance.info_cache.delete()"},{"line_number":2237,"context_line":"            # NOTE(vish): We have already deleted the instance, so we have"},{"line_number":2238,"context_line":"            #             to ignore problems cleaning up the volumes. It"},{"line_number":2239,"context_line":"            #             would be nice to let the user know somehow that"}],"source_content_type":"text/x-python","patch_set":21,"id":"baada198_a34e618e","line":2236,"in_reply_to":"1ae5cdf2_edb42884","updated":"2014-08-08 14:42:11.000000000","message":"Yeah, but if the ordering is that critical, a test would be good.","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"}],"nova/network/model.py":[{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"0b42ea7a2bb730e7dfcc62de940624d0eebf384a","unresolved":false,"context_lines":[{"line_number":264,"context_line":"        self[\u0027network\u0027] \u003d network or None"},{"line_number":265,"context_line":"        self[\u0027type\u0027] \u003d type"},{"line_number":266,"context_line":"        self[\u0027devname\u0027] \u003d devname"},{"line_number":267,"context_line":"        self[\u0027no_cleanup\u0027] \u003d no_cleanup"},{"line_number":268,"context_line":""},{"line_number":269,"context_line":"        self[\u0027ovs_interfaceid\u0027] \u003d ovs_interfaceid"},{"line_number":270,"context_line":"        self[\u0027qbh_params\u0027] \u003d qbh_params"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAWH%2F%2FIrw%3D","line":267,"updated":"2014-03-20 01:08:42.000000000","message":"I\u0027m wondering if \"preserve_on_delete\" might be more descriptive here? Thoughts?","commit_id":"c3e86f60029b9418e50f9ea8ea1d19cce4c525aa"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"06fdb6c8acf5709f8f4fde30e17706a1f9b65a19","unresolved":false,"context_lines":[{"line_number":264,"context_line":"        self[\u0027network\u0027] \u003d network or None"},{"line_number":265,"context_line":"        self[\u0027type\u0027] \u003d type"},{"line_number":266,"context_line":"        self[\u0027devname\u0027] \u003d devname"},{"line_number":267,"context_line":"        self[\u0027no_cleanup\u0027] \u003d no_cleanup"},{"line_number":268,"context_line":""},{"line_number":269,"context_line":"        self[\u0027ovs_interfaceid\u0027] \u003d ovs_interfaceid"},{"line_number":270,"context_line":"        self[\u0027qbh_params\u0027] \u003d qbh_params"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAWH%2F%2FIPQ%3D","line":267,"in_reply_to":"AAAAWH%2F%2FIrw%3D","updated":"2014-03-20 02:58:08.000000000","message":"I agree this is a better name. Thanks.","commit_id":"c3e86f60029b9418e50f9ea8ea1d19cce4c525aa"}],"nova/network/neutronv2/api.py":[{"author":{"_account_id":7170,"name":"Zang MingJie","email":"zealot0630@gmail.com","username":"zealot"},"change_message_id":"db6f5879c6cf0054ced157eab3edb517d5719b79","unresolved":false,"context_lines":[{"line_number":353,"context_line":""},{"line_number":354,"context_line":"        nw_info \u003d self.get_instance_nw_info(context, instance, networks\u003dnets,"},{"line_number":355,"context_line":"                                            port_ids\u003dports_in_requested_order,"},{"line_number":356,"context_line":"                                            touched_port_ids\u003dtouched_port_ids)"},{"line_number":357,"context_line":"        # NOTE(danms): Only return info about ports we created in this run."},{"line_number":358,"context_line":"        # In the initial allocation case, this will be everything we created,"},{"line_number":359,"context_line":"        # and in later runs will only be what was created that time. Thus,"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAVn%2F%2F9EU%3D","line":356,"updated":"2014-03-03 07:49:45.000000000","message":"where does this come from ?","commit_id":"325afca7bf2b2fa7ec8dcb6a64bb154a12b73949"},{"author":{"_account_id":7170,"name":"Zang MingJie","email":"zealot0630@gmail.com","username":"zealot"},"change_message_id":"367ab61bc53e01c22bd4c1b73214046a099d2848","unresolved":false,"context_lines":[{"line_number":353,"context_line":""},{"line_number":354,"context_line":"        nw_info \u003d self.get_instance_nw_info(context, instance, networks\u003dnets,"},{"line_number":355,"context_line":"                                            port_ids\u003dports_in_requested_order,"},{"line_number":356,"context_line":"                                            touched_port_ids\u003dtouched_port_ids)"},{"line_number":357,"context_line":"        # NOTE(danms): Only return info about ports we created in this run."},{"line_number":358,"context_line":"        # In the initial allocation case, this will be everything we created,"},{"line_number":359,"context_line":"        # and in later runs will only be what was created that time. Thus,"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAVn%2F%2Fwgg%3D","line":356,"in_reply_to":"AAAAVn%2F%2F3e0%3D","updated":"2014-03-04 09:54:48.000000000","message":"sorry haven\u0027t seen the depending patch","commit_id":"325afca7bf2b2fa7ec8dcb6a64bb154a12b73949"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"f5dc92dad0a8957041e2545df3f6f71ad22d3fd6","unresolved":false,"context_lines":[{"line_number":353,"context_line":""},{"line_number":354,"context_line":"        nw_info \u003d self.get_instance_nw_info(context, instance, networks\u003dnets,"},{"line_number":355,"context_line":"                                            port_ids\u003dports_in_requested_order,"},{"line_number":356,"context_line":"                                            touched_port_ids\u003dtouched_port_ids)"},{"line_number":357,"context_line":"        # NOTE(danms): Only return info about ports we created in this run."},{"line_number":358,"context_line":"        # In the initial allocation case, this will be everything we created,"},{"line_number":359,"context_line":"        # and in later runs will only be what was created that time. Thus,"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAVn%2F%2F3e0%3D","line":356,"in_reply_to":"AAAAVn%2F%2F9EU%3D","updated":"2014-03-03 18:17:09.000000000","message":"above in this method..?","commit_id":"325afca7bf2b2fa7ec8dcb6a64bb154a12b73949"},{"author":{"_account_id":7170,"name":"Zang MingJie","email":"zealot0630@gmail.com","username":"zealot"},"change_message_id":"367ab61bc53e01c22bd4c1b73214046a099d2848","unresolved":false,"context_lines":[{"line_number":411,"context_line":"                ports_to_skip.append(iface[\u0027id\u0027])"},{"line_number":412,"context_line":"        ports \u003d set(ports) - set(ports_to_skip)"},{"line_number":413,"context_line":""},{"line_number":414,"context_line":"        try:"},{"line_number":415,"context_line":"            for port in ports:"},{"line_number":416,"context_line":"                neutron.delete_port(port)"},{"line_number":417,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAVn%2F%2Fwf0%3D","line":414,"updated":"2014-03-04 09:54:48.000000000","message":"Why pull the `try` out ? I think the following ports should be deleted even if the first port deleting fails","commit_id":"325afca7bf2b2fa7ec8dcb6a64bb154a12b73949"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"966f0e6bf1447fb91c4a12d720c163349666126c","unresolved":false,"context_lines":[{"line_number":411,"context_line":"                ports_to_skip.append(iface[\u0027id\u0027])"},{"line_number":412,"context_line":"        ports \u003d set(ports) - set(ports_to_skip)"},{"line_number":413,"context_line":""},{"line_number":414,"context_line":"        try:"},{"line_number":415,"context_line":"            for port in ports:"},{"line_number":416,"context_line":"                neutron.delete_port(port)"},{"line_number":417,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAWH%2F%2FxKc%3D","line":414,"in_reply_to":"AAAAVn%2F%2Fwf0%3D","updated":"2014-03-13 22:54:44.000000000","message":"Whoops this was a mistake.","commit_id":"325afca7bf2b2fa7ec8dcb6a64bb154a12b73949"},{"author":{"_account_id":7170,"name":"Zang MingJie","email":"zealot0630@gmail.com","username":"zealot"},"change_message_id":"367ab61bc53e01c22bd4c1b73214046a099d2848","unresolved":false,"context_lines":[{"line_number":462,"context_line":"    @refresh_cache"},{"line_number":463,"context_line":"    def get_instance_nw_info(self, context, instance, networks\u003dNone,"},{"line_number":464,"context_line":"                             port_ids\u003dNone, touched_port_ids\u003dNone,"},{"line_number":465,"context_line":"                             use_slave\u003dFalse):"},{"line_number":466,"context_line":"        \"\"\"Return network information for specified instance"},{"line_number":467,"context_line":"           and update cache."},{"line_number":468,"context_line":"        \"\"\""}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAVn%2F%2FwFw%3D","line":465,"updated":"2014-03-04 09:54:48.000000000","message":"I suggest add a new function instead of modifying this one. Because it is not only fetch\u0026update the cache but also polluting the cache with essential information.","commit_id":"325afca7bf2b2fa7ec8dcb6a64bb154a12b73949"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"966f0e6bf1447fb91c4a12d720c163349666126c","unresolved":false,"context_lines":[{"line_number":462,"context_line":"    @refresh_cache"},{"line_number":463,"context_line":"    def get_instance_nw_info(self, context, instance, networks\u003dNone,"},{"line_number":464,"context_line":"                             port_ids\u003dNone, touched_port_ids\u003dNone,"},{"line_number":465,"context_line":"                             use_slave\u003dFalse):"},{"line_number":466,"context_line":"        \"\"\"Return network information for specified instance"},{"line_number":467,"context_line":"           and update cache."},{"line_number":468,"context_line":"        \"\"\""}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAWH%2F%2FxJ0%3D","line":465,"in_reply_to":"AAAAVn%2F%2FwFw%3D","updated":"2014-03-13 22:54:44.000000000","message":"This should probably be refactored in the future but currrently everything is already going through this method this way to _build_network_info.","commit_id":"325afca7bf2b2fa7ec8dcb6a64bb154a12b73949"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"0b42ea7a2bb730e7dfcc62de940624d0eebf384a","unresolved":false,"context_lines":[{"line_number":1101,"context_line":"                          cached value."},{"line_number":1102,"context_line":"        :param touched_port_ids - List of port_ids that nova didn\u0027t allocate"},{"line_number":1103,"context_line":"                                  and therefore shouldn\u0027t delete when an"},{"line_number":1104,"context_line":"                                  instance is deallocated."},{"line_number":1105,"context_line":"        \"\"\""},{"line_number":1106,"context_line":""},{"line_number":1107,"context_line":"        search_opts \u003d {\u0027tenant_id\u0027: instance[\u0027project_id\u0027],"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAWH%2F%2FIqw%3D","line":1104,"updated":"2014-03-20 01:08:42.000000000","message":"Heh, I hate to be a name-stickler... but how about \"external_port_ids\" or \"preallocated_port_ids\"? Seems a bit clearer than \"touched_port_ids\".","commit_id":"c3e86f60029b9418e50f9ea8ea1d19cce4c525aa"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"06fdb6c8acf5709f8f4fde30e17706a1f9b65a19","unresolved":false,"context_lines":[{"line_number":1101,"context_line":"                          cached value."},{"line_number":1102,"context_line":"        :param touched_port_ids - List of port_ids that nova didn\u0027t allocate"},{"line_number":1103,"context_line":"                                  and therefore shouldn\u0027t delete when an"},{"line_number":1104,"context_line":"                                  instance is deallocated."},{"line_number":1105,"context_line":"        \"\"\""},{"line_number":1106,"context_line":""},{"line_number":1107,"context_line":"        search_opts \u003d {\u0027tenant_id\u0027: instance[\u0027project_id\u0027],"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAWH%2F%2FIPk%3D","line":1104,"in_reply_to":"AAAAWH%2F%2FIqw%3D","updated":"2014-03-20 02:58:08.000000000","message":"Done","commit_id":"c3e86f60029b9418e50f9ea8ea1d19cce4c525aa"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"0f5fec7f495ed7f63f0b959faa45400617847bfe","unresolved":false,"context_lines":[{"line_number":512,"context_line":"                                                 port_ids,"},{"line_number":513,"context_line":"                                                 preallocated_port_ids)"},{"line_number":514,"context_line":"        return network_model.NetworkInfo.hydrate(nw_info)"},{"line_number":515,"context_line":""},{"line_number":516,"context_line":"    def _get_info_cache_ifaces(self, instance):"},{"line_number":517,"context_line":"        # Unfortunately, this is sometimes in unicode and sometimes not"},{"line_number":518,"context_line":"        if isinstance(instance[\u0027info_cache\u0027][\u0027network_info\u0027], six.text_type):"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAAWH%2F%2FG6Q%3D","line":515,"updated":"2014-03-20 07:28:50.000000000","message":"same thing exists in https://review.openstack.org/#/c/80760/6/nova/network/api.py","commit_id":"9c417e116981cfc75beebc0ff1dd625cbddf52ea"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"dc8326e78e42d2efb32825a3932bbb0334ab0c91","unresolved":false,"context_lines":[{"line_number":512,"context_line":"                                                 port_ids,"},{"line_number":513,"context_line":"                                                 preallocated_port_ids)"},{"line_number":514,"context_line":"        return network_model.NetworkInfo.hydrate(nw_info)"},{"line_number":515,"context_line":""},{"line_number":516,"context_line":"    def _get_info_cache_ifaces(self, instance):"},{"line_number":517,"context_line":"        # Unfortunately, this is sometimes in unicode and sometimes not"},{"line_number":518,"context_line":"        if isinstance(instance[\u0027info_cache\u0027][\u0027network_info\u0027], six.text_type):"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAAWH%2F%2FCdU%3D","line":515,"in_reply_to":"AAAAWH%2F%2FG6Q%3D","updated":"2014-03-20 18:29:21.000000000","message":"right but it\u0027s removed here: https://review.openstack.org/#/c/80760/6/nova/network/neutronv2/api.py the reason i moved this to there is because it\u0027s now called from compute/manager in that other path so it should be a public function and moved to the network/api.py code.","commit_id":"9c417e116981cfc75beebc0ff1dd625cbddf52ea"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"552de4a8dc072982d4f762d2c7cbb202714b8b50","unresolved":false,"context_lines":[{"line_number":289,"context_line":"            elif uuid_match:"},{"line_number":290,"context_line":"                security_group_ids.append(uuid_match)"},{"line_number":291,"context_line":""},{"line_number":292,"context_line":"        preallocated_port_ids \u003d []"},{"line_number":293,"context_line":"        created_port_ids \u003d []"},{"line_number":294,"context_line":"        ports_in_requested_order \u003d []"},{"line_number":295,"context_line":"        for network in nets:"}],"source_content_type":"text/x-python","patch_set":13,"id":"AAAAWH%2F9hfU%3D","line":292,"updated":"2014-04-03 22:49:28.000000000","message":"I feel like this is not as intuitive of a name for this list. I don\u0027t see that the function of this list has changed at all, yet it implies that the port was allocated by nova...","commit_id":"c149d6c7bd3a116373e9de9aa64d8871530f829d"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"f2cd7b1aeed54fd2c23b11e258feaac89f2a4364","unresolved":false,"context_lines":[{"line_number":289,"context_line":"            elif uuid_match:"},{"line_number":290,"context_line":"                security_group_ids.append(uuid_match)"},{"line_number":291,"context_line":""},{"line_number":292,"context_line":"        preallocated_port_ids \u003d []"},{"line_number":293,"context_line":"        created_port_ids \u003d []"},{"line_number":294,"context_line":"        ports_in_requested_order \u003d []"},{"line_number":295,"context_line":"        for network in nets:"}],"source_content_type":"text/x-python","patch_set":13,"id":"AAAAWn%2F%2F3p0%3D","line":292,"in_reply_to":"AAAAWH%2F9hSo%3D","updated":"2014-04-08 20:41:19.000000000","message":"renaming to preexisting_port_ids then :)","commit_id":"c149d6c7bd3a116373e9de9aa64d8871530f829d"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"81a461349d81ee04d4dccc5007e03c6b5145a390","unresolved":false,"context_lines":[{"line_number":289,"context_line":"            elif uuid_match:"},{"line_number":290,"context_line":"                security_group_ids.append(uuid_match)"},{"line_number":291,"context_line":""},{"line_number":292,"context_line":"        preallocated_port_ids \u003d []"},{"line_number":293,"context_line":"        created_port_ids \u003d []"},{"line_number":294,"context_line":"        ports_in_requested_order \u003d []"},{"line_number":295,"context_line":"        for network in nets:"}],"source_content_type":"text/x-python","patch_set":13,"id":"AAAAWH%2F9hSo%3D","line":292,"in_reply_to":"AAAAWH%2F9hVc%3D","updated":"2014-04-03 23:22:11.000000000","message":"Yep, I flipped that. preallocated \u003d\u003d owned by neutron. My disagreement with the name stands though :)\n\nMaybe \"preexisting_port_ids\" would be right, because if I\u0027m reading this properly, all the ports that existed ahead of time that we hit will end up in that list (which is why it was called touched_port_ids in the first place).","commit_id":"c149d6c7bd3a116373e9de9aa64d8871530f829d"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"26b6290e228046ced62834fb4e14325dc2d2c692","unresolved":false,"context_lines":[{"line_number":289,"context_line":"            elif uuid_match:"},{"line_number":290,"context_line":"                security_group_ids.append(uuid_match)"},{"line_number":291,"context_line":""},{"line_number":292,"context_line":"        preallocated_port_ids \u003d []"},{"line_number":293,"context_line":"        created_port_ids \u003d []"},{"line_number":294,"context_line":"        ports_in_requested_order \u003d []"},{"line_number":295,"context_line":"        for network in nets:"}],"source_content_type":"text/x-python","patch_set":13,"id":"AAAAWH%2F9hVc%3D","line":292,"in_reply_to":"AAAAWH%2F9hfU%3D","updated":"2014-04-03 23:11:24.000000000","message":"You have me to blame for that, Dan :) I recommended changing the variable name to this in order for it to better indicate that the port has already been allocated by *Neutron*, not Nova...","commit_id":"c149d6c7bd3a116373e9de9aa64d8871530f829d"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"552de4a8dc072982d4f762d2c7cbb202714b8b50","unresolved":false,"context_lines":[{"line_number":318,"context_line":"                               neutronv2.get_client(context, admin\u003dTrue))"},{"line_number":319,"context_line":"                if port:"},{"line_number":320,"context_line":"                    port_client.update_port(port[\u0027id\u0027], port_req_body)"},{"line_number":321,"context_line":"                    preallocated_port_ids.append(port[\u0027id\u0027])"},{"line_number":322,"context_line":"                    ports_in_requested_order.append(port[\u0027id\u0027])"},{"line_number":323,"context_line":"                else:"},{"line_number":324,"context_line":"                    created_port \u003d self._create_port("}],"source_content_type":"text/x-python","patch_set":13,"id":"AAAAWH%2F9hfA%3D","line":321,"updated":"2014-04-03 22:49:28.000000000","message":"But here, port wasn\u0027t allocated, right? If it always is, then I\u0027m really confused.\n\nI\u0027m starting to feel rage induced from a concern about how impossible-to-follow this allocate_for_instance() method is :(","commit_id":"c149d6c7bd3a116373e9de9aa64d8871530f829d"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"f2cd7b1aeed54fd2c23b11e258feaac89f2a4364","unresolved":false,"context_lines":[{"line_number":318,"context_line":"                               neutronv2.get_client(context, admin\u003dTrue))"},{"line_number":319,"context_line":"                if port:"},{"line_number":320,"context_line":"                    port_client.update_port(port[\u0027id\u0027], port_req_body)"},{"line_number":321,"context_line":"                    preallocated_port_ids.append(port[\u0027id\u0027])"},{"line_number":322,"context_line":"                    ports_in_requested_order.append(port[\u0027id\u0027])"},{"line_number":323,"context_line":"                else:"},{"line_number":324,"context_line":"                    created_port \u003d self._create_port("}],"source_content_type":"text/x-python","patch_set":13,"id":"AAAAWn%2F%2F3o0%3D","line":321,"in_reply_to":"AAAAWH%2F9hRI%3D","updated":"2014-04-08 20:41:19.000000000","message":"**outside of nova**","commit_id":"c149d6c7bd3a116373e9de9aa64d8871530f829d"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"3ebc940e1cd80c810b8fbb2db19faa1d337458e6","unresolved":false,"context_lines":[{"line_number":318,"context_line":"                               neutronv2.get_client(context, admin\u003dTrue))"},{"line_number":319,"context_line":"                if port:"},{"line_number":320,"context_line":"                    port_client.update_port(port[\u0027id\u0027], port_req_body)"},{"line_number":321,"context_line":"                    preallocated_port_ids.append(port[\u0027id\u0027])"},{"line_number":322,"context_line":"                    ports_in_requested_order.append(port[\u0027id\u0027])"},{"line_number":323,"context_line":"                else:"},{"line_number":324,"context_line":"                    created_port \u003d self._create_port("}],"source_content_type":"text/x-python","patch_set":13,"id":"AAAAWH%2F9hRI%3D","line":321,"in_reply_to":"AAAAWH%2F9hfA%3D","updated":"2014-04-03 23:25:43.000000000","message":"This port was already allocated out side of neutron. We update the port here and set the device_id on it and the port_binding params.","commit_id":"c149d6c7bd3a116373e9de9aa64d8871530f829d"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"552de4a8dc072982d4f762d2c7cbb202714b8b50","unresolved":false,"context_lines":[{"line_number":412,"context_line":"        for iface in ifaces:"},{"line_number":413,"context_line":"            if iface.get(\u0027preserve_on_delete\u0027):"},{"line_number":414,"context_line":"                non_nova_allocated_ports.append(iface[\u0027id\u0027])"},{"line_number":415,"context_line":"        ports \u003d set(ports) - set(ports_to_skip) - set(non_nova_allocated_ports)"},{"line_number":416,"context_line":""},{"line_number":417,"context_line":"        for port in ports:"},{"line_number":418,"context_line":"            try:"}],"source_content_type":"text/x-python","patch_set":13,"id":"AAAAWH%2F9hg8%3D","line":415,"updated":"2014-04-03 22:49:28.000000000","message":"This could be neatly broken out into a helper called \"get_ports_allocated_by_nova()\" which would make this easier to read.","commit_id":"c149d6c7bd3a116373e9de9aa64d8871530f829d"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"1ae6b349b2f72a5123cceef6051d57a3e7c3176a","unresolved":false,"context_lines":[{"line_number":412,"context_line":"        for iface in ifaces:"},{"line_number":413,"context_line":"            if iface.get(\u0027preserve_on_delete\u0027):"},{"line_number":414,"context_line":"                non_nova_allocated_ports.append(iface[\u0027id\u0027])"},{"line_number":415,"context_line":"        ports \u003d set(ports) - set(ports_to_skip) - set(non_nova_allocated_ports)"},{"line_number":416,"context_line":""},{"line_number":417,"context_line":"        for port in ports:"},{"line_number":418,"context_line":"            try:"}],"source_content_type":"text/x-python","patch_set":13,"id":"AAAAWH%2F9hUo%3D","line":415,"in_reply_to":"AAAAWH%2F9hg8%3D","updated":"2014-04-03 23:13:29.000000000","message":"But they aren\u0027t. They are ports that have been established by *Neutron* and this is telling Nova not to mess with these ports, as they are controlled by Neutron and managed separately from ports that are created automatically during the creation of a VM by Nova...","commit_id":"c149d6c7bd3a116373e9de9aa64d8871530f829d"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"552de4a8dc072982d4f762d2c7cbb202714b8b50","unresolved":false,"context_lines":[{"line_number":444,"context_line":"                    LOG.warning(_(\"Port %s does not exist\"), port)"},{"line_number":445,"context_line":"                else:"},{"line_number":446,"context_line":"                    LOG.error(_(\"Failed to update neutron port %s\"),"},{"line_number":447,"context_line":"                              port)"},{"line_number":448,"context_line":""},{"line_number":449,"context_line":"    def allocate_port_for_instance(self, context, instance, port_id,"},{"line_number":450,"context_line":"                                   network_id\u003dNone, requested_ip\u003dNone):"}],"source_content_type":"text/x-python","patch_set":13,"id":"AAAAWH%2F9hhM%3D","line":447,"updated":"2014-04-03 22:49:28.000000000","message":"I was reading this trying to figure out why you needed to do anything else at this point, since you already calculated the new set of ports to iterate in the delete loop above.\n\nI think this is a really good example of something that should be in a helper function called \"disassociate_instance_from_ports()\" or something. That makes this method smaller and would have immediately indicated to me what is going on here ;)","commit_id":"c149d6c7bd3a116373e9de9aa64d8871530f829d"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"b4b5967885c1dba15900e92dbaf0d4e512156cd5","unresolved":false,"context_lines":[{"line_number":398,"context_line":"        if self._has_port_binding_extension(context):"},{"line_number":399,"context_line":"            port_req_body[\u0027port\u0027][\u0027binding:host_id\u0027] \u003d instance.get(\u0027host\u0027)"},{"line_number":400,"context_line":""},{"line_number":401,"context_line":"    def _get_ports_not_allocate_by_nova(self, instance):"},{"line_number":402,"context_line":"        ifaces \u003d compute_utils.get_nw_info_for_instance(instance)"},{"line_number":403,"context_line":"        # NOTE(arosen) - these are ports nova did not allocate therefore"},{"line_number":404,"context_line":"        # nova should not delete them and instead clear their device_id"}],"source_content_type":"text/x-python","patch_set":19,"id":"5adbc538_dc5ae44f","line":401,"updated":"2014-05-25 19:55:44.000000000","message":"s/not_allocate_by/not_allocated_by/","commit_id":"969cfa7ef235cf851828efc5021cbc55312ac942"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"8bf3435bb8e56abc529c02898a8155aadfdcd534","unresolved":false,"context_lines":[{"line_number":398,"context_line":"        if self._has_port_binding_extension(context):"},{"line_number":399,"context_line":"            port_req_body[\u0027port\u0027][\u0027binding:host_id\u0027] \u003d instance.get(\u0027host\u0027)"},{"line_number":400,"context_line":""},{"line_number":401,"context_line":"    def _get_ports_not_allocate_by_nova(self, instance):"},{"line_number":402,"context_line":"        ifaces \u003d compute_utils.get_nw_info_for_instance(instance)"},{"line_number":403,"context_line":"        # NOTE(arosen) - these are ports nova did not allocate therefore"},{"line_number":404,"context_line":"        # nova should not delete them and instead clear their device_id"}],"source_content_type":"text/x-python","patch_set":19,"id":"3ae8d1ca_d4baa0e0","line":401,"in_reply_to":"5adbc538_dc5ae44f","updated":"2014-05-28 16:48:37.000000000","message":"Done","commit_id":"969cfa7ef235cf851828efc5021cbc55312ac942"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"b4b5967885c1dba15900e92dbaf0d4e512156cd5","unresolved":false,"context_lines":[{"line_number":406,"context_line":"        for iface in ifaces:"},{"line_number":407,"context_line":"            if iface.get(\u0027preserve_on_delete\u0027):"},{"line_number":408,"context_line":"                non_nova_allocated_ports.append(iface[\u0027id\u0027])"},{"line_number":409,"context_line":"        return non_nova_allocated_ports"},{"line_number":410,"context_line":""},{"line_number":411,"context_line":"    def deallocate_for_instance(self, context, instance, **kwargs):"},{"line_number":412,"context_line":"        \"\"\"Deallocate all network resources related to the instance.\"\"\""}],"source_content_type":"text/x-python","patch_set":19,"id":"5adbc538_5c36d404","line":409,"updated":"2014-05-25 19:55:44.000000000","message":"Above could be done in a list comprehension as well, like so:\n\n ifaces \u003d compute_utils.get_nw_info_for_instances(instance)\n return [iface[\u0027id\u0027] for iface in ifaces\n         if iface.get(\u0027preserve_on_delete\u0027)]","commit_id":"969cfa7ef235cf851828efc5021cbc55312ac942"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"8bf3435bb8e56abc529c02898a8155aadfdcd534","unresolved":false,"context_lines":[{"line_number":406,"context_line":"        for iface in ifaces:"},{"line_number":407,"context_line":"            if iface.get(\u0027preserve_on_delete\u0027):"},{"line_number":408,"context_line":"                non_nova_allocated_ports.append(iface[\u0027id\u0027])"},{"line_number":409,"context_line":"        return non_nova_allocated_ports"},{"line_number":410,"context_line":""},{"line_number":411,"context_line":"    def deallocate_for_instance(self, context, instance, **kwargs):"},{"line_number":412,"context_line":"        \"\"\"Deallocate all network resources related to the instance.\"\"\""}],"source_content_type":"text/x-python","patch_set":19,"id":"3ae8d1ca_e9afa5e1","line":409,"in_reply_to":"5adbc538_5c36d404","updated":"2014-05-28 16:48:37.000000000","message":"Done","commit_id":"969cfa7ef235cf851828efc5021cbc55312ac942"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"b4b5967885c1dba15900e92dbaf0d4e512156cd5","unresolved":false,"context_lines":[{"line_number":1150,"context_line":"        if not preexisting_port_ids:"},{"line_number":1151,"context_line":"            ifaces \u003d compute_utils.get_nw_info_for_instance(instance)"},{"line_number":1152,"context_line":"            preexisting_port_ids \u003d [iface[\u0027id\u0027] for iface in ifaces"},{"line_number":1153,"context_line":"                                     if iface.get(\u0027preserve_on_delete\u0027)]"},{"line_number":1154,"context_line":""},{"line_number":1155,"context_line":"        current_neutron_port_map \u003d {}"},{"line_number":1156,"context_line":"        for current_neutron_port in current_neutron_ports:"}],"source_content_type":"text/x-python","patch_set":19,"id":"5adbc538_3c182884","line":1153,"updated":"2014-05-25 19:55:44.000000000","message":"DRY this up by using your helper method above: _get_ports_not_allocate_by_nova()","commit_id":"969cfa7ef235cf851828efc5021cbc55312ac942"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"8bf3435bb8e56abc529c02898a8155aadfdcd534","unresolved":false,"context_lines":[{"line_number":1150,"context_line":"        if not preexisting_port_ids:"},{"line_number":1151,"context_line":"            ifaces \u003d compute_utils.get_nw_info_for_instance(instance)"},{"line_number":1152,"context_line":"            preexisting_port_ids \u003d [iface[\u0027id\u0027] for iface in ifaces"},{"line_number":1153,"context_line":"                                     if iface.get(\u0027preserve_on_delete\u0027)]"},{"line_number":1154,"context_line":""},{"line_number":1155,"context_line":"        current_neutron_port_map \u003d {}"},{"line_number":1156,"context_line":"        for current_neutron_port in current_neutron_ports:"}],"source_content_type":"text/x-python","patch_set":19,"id":"3ae8d1ca_09abf1d6","line":1153,"in_reply_to":"5adbc538_3c182884","updated":"2014-05-28 16:48:37.000000000","message":"Yay!","commit_id":"969cfa7ef235cf851828efc5021cbc55312ac942"},{"author":{"_account_id":1501,"name":"Phil Day","email":"philip.day@hp.com","username":"philip-day"},"change_message_id":"f74bb83800ce95a2ec712db93cced4d4f29cbcd5","unresolved":false,"context_lines":[{"line_number":365,"context_line":"        # method."},{"line_number":366,"context_line":"        return network_model.NetworkInfo("},{"line_number":367,"context_line":"            [port for port in nw_info"},{"line_number":368,"context_line":"             if port[\u0027id\u0027] in created_port_ids + preexisting_port_ids])"},{"line_number":369,"context_line":""},{"line_number":370,"context_line":"    def _refresh_neutron_extensions_cache(self, context):"},{"line_number":371,"context_line":"        \"\"\"Refresh the neutron extensions cache when necessary.\"\"\""}],"source_content_type":"text/x-python","patch_set":21,"id":"fa98f980_ba754e33","line":368,"updated":"2014-09-04 17:15:16.000000000","message":"This seems to contradict the text above about only returning ports created in this run - surely preexisting_port_ids aren\u0027t part of that set are they ?","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"bc7ad3f861d173a8d6ec65a20cee303691659b33","unresolved":false,"context_lines":[{"line_number":401,"context_line":"    def _get_ports_not_allocated_by_nova(self, instance):"},{"line_number":402,"context_line":"        # NOTE(arosen) - these are ports nova did not allocate therefore"},{"line_number":403,"context_line":"        # nova should not delete them and instead clear their device_id"},{"line_number":404,"context_line":"        ifaces \u003d compute_utils.get_nw_info_for_instance(instance)"},{"line_number":405,"context_line":"        return [iface[\u0027id\u0027] for iface in ifaces"},{"line_number":406,"context_line":"                if iface.get(\u0027preserve_on_delete\u0027)]"},{"line_number":407,"context_line":""}],"source_content_type":"text/x-python","patch_set":21,"id":"1ae5cdf2_7d374fe3","line":404,"updated":"2014-06-12 20:04:29.000000000","message":"Related to comment in the compute manager, maybe compute_utils.get_nw_info_for_instance needs a boolean arg that says I expect to get something back, not just an empty network info cache object and if the info cache was deleted before it\u0027s needed/expected, we fail - or at least log a warning of bad things that could possibly happen as a result.","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"7133d9ac267b3e988917d08620de6a6307ab9137","unresolved":false,"context_lines":[{"line_number":401,"context_line":"    def _get_ports_not_allocated_by_nova(self, instance):"},{"line_number":402,"context_line":"        # NOTE(arosen) - these are ports nova did not allocate therefore"},{"line_number":403,"context_line":"        # nova should not delete them and instead clear their device_id"},{"line_number":404,"context_line":"        ifaces \u003d compute_utils.get_nw_info_for_instance(instance)"},{"line_number":405,"context_line":"        return [iface[\u0027id\u0027] for iface in ifaces"},{"line_number":406,"context_line":"                if iface.get(\u0027preserve_on_delete\u0027)]"},{"line_number":407,"context_line":""}],"source_content_type":"text/x-python","patch_set":21,"id":"1ae5cdf2_9d47bbbb","line":404,"in_reply_to":"1ae5cdf2_7d374fe3","updated":"2014-06-12 20:33:30.000000000","message":"i agree it could be nice to have something like this. Do you think we can do this in another patch? I\u0027ll add the test for the comment in manger.py to check that the cache_delete is called in the right order.","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"dd0083a4dab8d838e10ed57b1814abb6f8a91eae","unresolved":false,"context_lines":[{"line_number":401,"context_line":"    def _get_ports_not_allocated_by_nova(self, instance):"},{"line_number":402,"context_line":"        # NOTE(arosen) - these are ports nova did not allocate therefore"},{"line_number":403,"context_line":"        # nova should not delete them and instead clear their device_id"},{"line_number":404,"context_line":"        ifaces \u003d compute_utils.get_nw_info_for_instance(instance)"},{"line_number":405,"context_line":"        return [iface[\u0027id\u0027] for iface in ifaces"},{"line_number":406,"context_line":"                if iface.get(\u0027preserve_on_delete\u0027)]"},{"line_number":407,"context_line":""}],"source_content_type":"text/x-python","patch_set":21,"id":"1ae5cdf2_f1d2a35a","line":404,"in_reply_to":"1ae5cdf2_9d47bbbb","updated":"2014-06-13 01:53:56.000000000","message":"It could be another patch, but if it\u0027s not hard we could do it in a dependent patch, I just don\u0027t like losing this kind of stuff.  Anyway, the unit test for now would be the clincher for me on this patch just to make sure we don\u0027t regress it in the meantime given how it\u0027s used here.","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"},{"author":{"_account_id":1501,"name":"Phil Day","email":"philip.day@hp.com","username":"philip-day"},"change_message_id":"f74bb83800ce95a2ec712db93cced4d4f29cbcd5","unresolved":false,"context_lines":[{"line_number":401,"context_line":"    def _get_ports_not_allocated_by_nova(self, instance):"},{"line_number":402,"context_line":"        # NOTE(arosen) - these are ports nova did not allocate therefore"},{"line_number":403,"context_line":"        # nova should not delete them and instead clear their device_id"},{"line_number":404,"context_line":"        ifaces \u003d compute_utils.get_nw_info_for_instance(instance)"},{"line_number":405,"context_line":"        return [iface[\u0027id\u0027] for iface in ifaces"},{"line_number":406,"context_line":"                if iface.get(\u0027preserve_on_delete\u0027)]"},{"line_number":407,"context_line":""}],"source_content_type":"text/x-python","patch_set":21,"id":"fa98f980_baac6e8d","line":404,"in_reply_to":"1ae5cdf2_f1d2a35a","updated":"2014-09-04 17:15:16.000000000","message":"Since the cache is meant to be a cache, can we not just rebuild it if anything tries to access it ?","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"bc7ad3f861d173a8d6ec65a20cee303691659b33","unresolved":false,"context_lines":[{"line_number":415,"context_line":"        ports \u003d [port[\u0027id\u0027] for port in data.get(\u0027ports\u0027, [])]"},{"line_number":416,"context_line":""},{"line_number":417,"context_line":"        requested_networks \u003d kwargs.get(\u0027requested_networks\u0027) or {}"},{"line_number":418,"context_line":"        ports_to_skip \u003d [port_id for nets, fips, port_id in requested_networks]"},{"line_number":419,"context_line":"        non_nova_allocated_ports \u003d self._get_ports_not_allocated_by_nova("},{"line_number":420,"context_line":"            instance)"},{"line_number":421,"context_line":"        ports \u003d set(ports) - set(ports_to_skip) - set(non_nova_allocated_ports)"}],"source_content_type":"text/x-python","patch_set":21,"id":"1ae5cdf2_92c24a32","line":418,"updated":"2014-06-12 20:04:29.000000000","message":"I\u0027m not really sure what this means, some documentation here would be nice...why are we skipping ports in requested_networks?  Why aren\u0027t these in non_nova_allocated_ports?","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"dd0083a4dab8d838e10ed57b1814abb6f8a91eae","unresolved":false,"context_lines":[{"line_number":415,"context_line":"        ports \u003d [port[\u0027id\u0027] for port in data.get(\u0027ports\u0027, [])]"},{"line_number":416,"context_line":""},{"line_number":417,"context_line":"        requested_networks \u003d kwargs.get(\u0027requested_networks\u0027) or {}"},{"line_number":418,"context_line":"        ports_to_skip \u003d [port_id for nets, fips, port_id in requested_networks]"},{"line_number":419,"context_line":"        non_nova_allocated_ports \u003d self._get_ports_not_allocated_by_nova("},{"line_number":420,"context_line":"            instance)"},{"line_number":421,"context_line":"        ports \u003d set(ports) - set(ports_to_skip) - set(non_nova_allocated_ports)"}],"source_content_type":"text/x-python","patch_set":21,"id":"1ae5cdf2_11d62f4f","line":418,"in_reply_to":"1ae5cdf2_1d82cbc7","updated":"2014-06-13 01:53:56.000000000","message":"Cool, thanks.","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"7133d9ac267b3e988917d08620de6a6307ab9137","unresolved":false,"context_lines":[{"line_number":415,"context_line":"        ports \u003d [port[\u0027id\u0027] for port in data.get(\u0027ports\u0027, [])]"},{"line_number":416,"context_line":""},{"line_number":417,"context_line":"        requested_networks \u003d kwargs.get(\u0027requested_networks\u0027) or {}"},{"line_number":418,"context_line":"        ports_to_skip \u003d [port_id for nets, fips, port_id in requested_networks]"},{"line_number":419,"context_line":"        non_nova_allocated_ports \u003d self._get_ports_not_allocated_by_nova("},{"line_number":420,"context_line":"            instance)"},{"line_number":421,"context_line":"        ports \u003d set(ports) - set(ports_to_skip) - set(non_nova_allocated_ports)"}],"source_content_type":"text/x-python","patch_set":21,"id":"1ae5cdf2_1d82cbc7","line":418,"in_reply_to":"1ae5cdf2_92c24a32","updated":"2014-06-12 20:33:30.000000000","message":"I agree. When looking at this code initially i had no idea what ports_to_skip are. I don\u0027t even think you get a requested_networks passed in here as a kwarg. I\u0027ll investigate more and see if we can just delete those lines above","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"bc7ad3f861d173a8d6ec65a20cee303691659b33","unresolved":false,"context_lines":[{"line_number":437,"context_line":"        # has already been deleted this call does nothing."},{"line_number":438,"context_line":"        base_api.update_instance_cache_with_nw_info(self, context, instance,"},{"line_number":439,"context_line":"                                            network_model.NetworkInfo([]))"},{"line_number":440,"context_line":"        port_req_body \u003d {\u0027port\u0027: {\u0027device_id\u0027: \u0027\u0027}}"},{"line_number":441,"context_line":"        # requires admin creds to set port bindings"},{"line_number":442,"context_line":"        if self._has_port_binding_extension(context):"},{"line_number":443,"context_line":"            port_req_body[\u0027port\u0027][\u0027binding:host_id\u0027] \u003d None"}],"source_content_type":"text/x-python","patch_set":21,"id":"1ae5cdf2_52fa8275","line":440,"updated":"2014-06-12 20:04:29.000000000","message":"Add some documentation about what you\u0027re doing here, i.e. disassociating the port from the instance.\n\nActually I think you should just move this entire block of code to a separate private method and call from here so we don\u0027t clutter this big method up more.","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"7133d9ac267b3e988917d08620de6a6307ab9137","unresolved":false,"context_lines":[{"line_number":437,"context_line":"        # has already been deleted this call does nothing."},{"line_number":438,"context_line":"        base_api.update_instance_cache_with_nw_info(self, context, instance,"},{"line_number":439,"context_line":"                                            network_model.NetworkInfo([]))"},{"line_number":440,"context_line":"        port_req_body \u003d {\u0027port\u0027: {\u0027device_id\u0027: \u0027\u0027}}"},{"line_number":441,"context_line":"        # requires admin creds to set port bindings"},{"line_number":442,"context_line":"        if self._has_port_binding_extension(context):"},{"line_number":443,"context_line":"            port_req_body[\u0027port\u0027][\u0027binding:host_id\u0027] \u003d None"}],"source_content_type":"text/x-python","patch_set":21,"id":"1ae5cdf2_3d5ce77c","line":440,"in_reply_to":"1ae5cdf2_52fa8275","updated":"2014-06-12 20:33:30.000000000","message":"Will do. This removes the device_id from a port.","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"bc7ad3f861d173a8d6ec65a20cee303691659b33","unresolved":false,"context_lines":[{"line_number":440,"context_line":"        port_req_body \u003d {\u0027port\u0027: {\u0027device_id\u0027: \u0027\u0027}}"},{"line_number":441,"context_line":"        # requires admin creds to set port bindings"},{"line_number":442,"context_line":"        if self._has_port_binding_extension(context):"},{"line_number":443,"context_line":"            port_req_body[\u0027port\u0027][\u0027binding:host_id\u0027] \u003d None"},{"line_number":444,"context_line":"            neutron \u003d neutronv2.get_client(context, admin\u003dTrue)"},{"line_number":445,"context_line":""},{"line_number":446,"context_line":"        for port in non_nova_allocated_ports:"}],"source_content_type":"text/x-python","patch_set":21,"id":"1ae5cdf2_f2654e45","line":443,"updated":"2014-06-12 20:04:29.000000000","message":"What is this doing?  Why is this needed?  Docs please.","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"dd0083a4dab8d838e10ed57b1814abb6f8a91eae","unresolved":false,"context_lines":[{"line_number":440,"context_line":"        port_req_body \u003d {\u0027port\u0027: {\u0027device_id\u0027: \u0027\u0027}}"},{"line_number":441,"context_line":"        # requires admin creds to set port bindings"},{"line_number":442,"context_line":"        if self._has_port_binding_extension(context):"},{"line_number":443,"context_line":"            port_req_body[\u0027port\u0027][\u0027binding:host_id\u0027] \u003d None"},{"line_number":444,"context_line":"            neutron \u003d neutronv2.get_client(context, admin\u003dTrue)"},{"line_number":445,"context_line":""},{"line_number":446,"context_line":"        for port in non_nova_allocated_ports:"}],"source_content_type":"text/x-python","patch_set":21,"id":"1ae5cdf2_515a77f2","line":443,"in_reply_to":"1ae5cdf2_ddf06369","updated":"2014-06-13 01:53:56.000000000","message":"OK, can we put something about that in here so we know what\u0027s going on?  Doesn\u0027t need to be super duper detailed, just something so when someone that\u0027s not so familiar with the internals of neutron comes across this later has some idea of what\u0027s going on.","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"7133d9ac267b3e988917d08620de6a6307ab9137","unresolved":false,"context_lines":[{"line_number":440,"context_line":"        port_req_body \u003d {\u0027port\u0027: {\u0027device_id\u0027: \u0027\u0027}}"},{"line_number":441,"context_line":"        # requires admin creds to set port bindings"},{"line_number":442,"context_line":"        if self._has_port_binding_extension(context):"},{"line_number":443,"context_line":"            port_req_body[\u0027port\u0027][\u0027binding:host_id\u0027] \u003d None"},{"line_number":444,"context_line":"            neutron \u003d neutronv2.get_client(context, admin\u003dTrue)"},{"line_number":445,"context_line":""},{"line_number":446,"context_line":"        for port in non_nova_allocated_ports:"}],"source_content_type":"text/x-python","patch_set":21,"id":"1ae5cdf2_ddf06369","line":443,"in_reply_to":"1ae5cdf2_f2654e45","updated":"2014-06-12 20:33:30.000000000","message":"if you\u0027re using a neutron plugin that supports the port_binding extension (which is currently every plugin in the tree) the port resource stores the host_name that the port is sitting on. This line just clears this attribute on the port as we\u0027re disconnecting it (but not deleting it), since this was a port that was allocated in neutron by the tenant directly and passed in (--nic port-id\u003d)","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"bc7ad3f861d173a8d6ec65a20cee303691659b33","unresolved":false,"context_lines":[{"line_number":447,"context_line":"            try:"},{"line_number":448,"context_line":"                neutron.update_port(port, port_req_body)"},{"line_number":449,"context_line":"            except neutronv2.exceptions.NeutronClientException as e:"},{"line_number":450,"context_line":"                if e.status_code \u003d\u003d 404:"},{"line_number":451,"context_line":"                    LOG.warning(_(\"Port %s does not exist\"), port)"},{"line_number":452,"context_line":"                else:"},{"line_number":453,"context_line":"                    LOG.warning(_(\"Failed to update neutron port %s\"),"}],"source_content_type":"text/x-python","patch_set":21,"id":"1ae5cdf2_326fb6fd","line":450,"updated":"2014-06-12 20:04:29.000000000","message":"Why not catch PortNotFoundClient here instead so it\u0027s explicit?\n\nhttps://github.com/openstack/python-neutronclient/blob/master/neutronclient/common/exceptions.py#L122","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"7133d9ac267b3e988917d08620de6a6307ab9137","unresolved":false,"context_lines":[{"line_number":447,"context_line":"            try:"},{"line_number":448,"context_line":"                neutron.update_port(port, port_req_body)"},{"line_number":449,"context_line":"            except neutronv2.exceptions.NeutronClientException as e:"},{"line_number":450,"context_line":"                if e.status_code \u003d\u003d 404:"},{"line_number":451,"context_line":"                    LOG.warning(_(\"Port %s does not exist\"), port)"},{"line_number":452,"context_line":"                else:"},{"line_number":453,"context_line":"                    LOG.warning(_(\"Failed to update neutron port %s\"),"}],"source_content_type":"text/x-python","patch_set":21,"id":"1ae5cdf2_1de72bad","line":450,"in_reply_to":"1ae5cdf2_326fb6fd","updated":"2014-06-12 20:33:30.000000000","message":"Done","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"bc7ad3f861d173a8d6ec65a20cee303691659b33","unresolved":false,"context_lines":[{"line_number":448,"context_line":"                neutron.update_port(port, port_req_body)"},{"line_number":449,"context_line":"            except neutronv2.exceptions.NeutronClientException as e:"},{"line_number":450,"context_line":"                if e.status_code \u003d\u003d 404:"},{"line_number":451,"context_line":"                    LOG.warning(_(\"Port %s does not exist\"), port)"},{"line_number":452,"context_line":"                else:"},{"line_number":453,"context_line":"                    LOG.warning(_(\"Failed to update neutron port %s\"),"},{"line_number":454,"context_line":"                                port)"}],"source_content_type":"text/x-python","patch_set":21,"id":"1ae5cdf2_12d0fac7","line":451,"updated":"2014-06-12 20:04:29.000000000","message":"Use the _LW from gettextutils, i.e. LOG.warning(_LW(...))\n\nAlso put the instance kwarg in the warning call.","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"7133d9ac267b3e988917d08620de6a6307ab9137","unresolved":false,"context_lines":[{"line_number":448,"context_line":"                neutron.update_port(port, port_req_body)"},{"line_number":449,"context_line":"            except neutronv2.exceptions.NeutronClientException as e:"},{"line_number":450,"context_line":"                if e.status_code \u003d\u003d 404:"},{"line_number":451,"context_line":"                    LOG.warning(_(\"Port %s does not exist\"), port)"},{"line_number":452,"context_line":"                else:"},{"line_number":453,"context_line":"                    LOG.warning(_(\"Failed to update neutron port %s\"),"},{"line_number":454,"context_line":"                                port)"}],"source_content_type":"text/x-python","patch_set":21,"id":"1ae5cdf2_3dea2774","line":451,"in_reply_to":"1ae5cdf2_12d0fac7","updated":"2014-06-12 20:33:30.000000000","message":"Done","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"bc7ad3f861d173a8d6ec65a20cee303691659b33","unresolved":false,"context_lines":[{"line_number":450,"context_line":"                if e.status_code \u003d\u003d 404:"},{"line_number":451,"context_line":"                    LOG.warning(_(\"Port %s does not exist\"), port)"},{"line_number":452,"context_line":"                else:"},{"line_number":453,"context_line":"                    LOG.warning(_(\"Failed to update neutron port %s\"),"},{"line_number":454,"context_line":"                                port)"},{"line_number":455,"context_line":""},{"line_number":456,"context_line":"    def allocate_port_for_instance(self, context, instance, port_id,"}],"source_content_type":"text/x-python","patch_set":21,"id":"1ae5cdf2_f2f38e70","line":453,"updated":"2014-06-12 20:04:29.000000000","message":"ditto - may also want to give some more context on what update was being performed here, i.e. disassociating the port from the instance.\n\nAlso, what happens when this fails?  Is the port in limbo, associated to an instance that is possibly deleted and therefore we have potential for over quota on ports later?  Should we fail the destroy in this case?  Just wondering about a case where maybe the request timed out in the socket to the neutron API server but a later attempt would work, but now the instance is deleted.  Or does neutron have a periodic task that cleans up orphaned ports?  I swear we\u0027ve talked about this before...","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"dd0083a4dab8d838e10ed57b1814abb6f8a91eae","unresolved":false,"context_lines":[{"line_number":450,"context_line":"                if e.status_code \u003d\u003d 404:"},{"line_number":451,"context_line":"                    LOG.warning(_(\"Port %s does not exist\"), port)"},{"line_number":452,"context_line":"                else:"},{"line_number":453,"context_line":"                    LOG.warning(_(\"Failed to update neutron port %s\"),"},{"line_number":454,"context_line":"                                port)"},{"line_number":455,"context_line":""},{"line_number":456,"context_line":"    def allocate_port_for_instance(self, context, instance, port_id,"}],"source_content_type":"text/x-python","patch_set":21,"id":"1ae5cdf2_911ddf11","line":453,"in_reply_to":"1ae5cdf2_380b1525","updated":"2014-06-13 01:53:56.000000000","message":"But how does someone recover from this?  If the instance with that device_id is deleted, how can we boot into that port again?  So the port is then basically corrupt, right?  Do we have to manually delete the port?  If so, that should probably be in the warning message as a workaround until we could have some periodic garbage collection task either in nova or neutron that scans ports and looks for associated instances that no longer exist and cleans those up.","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"22deaed9a1b9b57a54a3794222c07ef4502b0aa2","unresolved":false,"context_lines":[{"line_number":450,"context_line":"                if e.status_code \u003d\u003d 404:"},{"line_number":451,"context_line":"                    LOG.warning(_(\"Port %s does not exist\"), port)"},{"line_number":452,"context_line":"                else:"},{"line_number":453,"context_line":"                    LOG.warning(_(\"Failed to update neutron port %s\"),"},{"line_number":454,"context_line":"                                port)"},{"line_number":455,"context_line":""},{"line_number":456,"context_line":"    def allocate_port_for_instance(self, context, instance, port_id,"}],"source_content_type":"text/x-python","patch_set":21,"id":"baada198_1edcc244","line":453,"in_reply_to":"1ae5cdf2_911ddf11","updated":"2014-08-08 14:42:11.000000000","message":"Is it even worth littering the logs with these warnings? These are ports that nova didn\u0027t allocate, which means (AFAICT) if they\u0027re gone, someone else did something underneath us. We\u0027re deleting the instance anyway, so do we care? *maybe* a debug log in case someone is trying to track this situation down, but otherwise, I\u0027d say just ignore.","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"1c6ba36b2203a7a7bce1b4b7dcb670096cf1e8cb","unresolved":false,"context_lines":[{"line_number":450,"context_line":"                if e.status_code \u003d\u003d 404:"},{"line_number":451,"context_line":"                    LOG.warning(_(\"Port %s does not exist\"), port)"},{"line_number":452,"context_line":"                else:"},{"line_number":453,"context_line":"                    LOG.warning(_(\"Failed to update neutron port %s\"),"},{"line_number":454,"context_line":"                                port)"},{"line_number":455,"context_line":""},{"line_number":456,"context_line":"    def allocate_port_for_instance(self, context, instance, port_id,"}],"source_content_type":"text/x-python","patch_set":21,"id":"1ae5cdf2_fda6ffbf","line":453,"in_reply_to":"1ae5cdf2_f2f38e70","updated":"2014-06-12 20:11:21.000000000","message":"Is this related to what I\u0027m talking about for orphaned ports?\n\nhttps://review.openstack.org/#/c/64769/\n\nThat looks like it\u0027s only on allocate though, not deallocate.","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"7133d9ac267b3e988917d08620de6a6307ab9137","unresolved":false,"context_lines":[{"line_number":450,"context_line":"                if e.status_code \u003d\u003d 404:"},{"line_number":451,"context_line":"                    LOG.warning(_(\"Port %s does not exist\"), port)"},{"line_number":452,"context_line":"                else:"},{"line_number":453,"context_line":"                    LOG.warning(_(\"Failed to update neutron port %s\"),"},{"line_number":454,"context_line":"                                port)"},{"line_number":455,"context_line":""},{"line_number":456,"context_line":"    def allocate_port_for_instance(self, context, instance, port_id,"}],"source_content_type":"text/x-python","patch_set":21,"id":"1ae5cdf2_380b1525","line":453,"in_reply_to":"1ae5cdf2_fda6ffbf","updated":"2014-06-12 20:33:30.000000000","message":"actually this is a different case. If you create a port via: \n\nneutron port-create net1; \n\nthen do: nova boot --nic port-id\u003d\u003cport_uuid\u003e\n\nnova does not let you boot multiple instances on this port. It enforces this by checking the device_id on the port. So this code clears the device_id from the port so if this fails the tenant would have to retry themselves later the way it stands. If they passed in this same port to nova, nova-api would return PortInUse","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"ed2cecc84d5754af9dcc3d10c24eefc0ad5408bd","unresolved":false,"context_lines":[{"line_number":450,"context_line":"                if e.status_code \u003d\u003d 404:"},{"line_number":451,"context_line":"                    LOG.warning(_(\"Port %s does not exist\"), port)"},{"line_number":452,"context_line":"                else:"},{"line_number":453,"context_line":"                    LOG.warning(_(\"Failed to update neutron port %s\"),"},{"line_number":454,"context_line":"                                port)"},{"line_number":455,"context_line":""},{"line_number":456,"context_line":"    def allocate_port_for_instance(self, context, instance, port_id,"}],"source_content_type":"text/x-python","patch_set":21,"id":"baada198_3a434f6c","line":453,"in_reply_to":"baada198_1edcc244","updated":"2014-08-08 15:53:39.000000000","message":"Well there is a difference between the 404 case and something else, right?  In the 404 case the port is gone so yeah we probably don\u0027t need the warning, debug would be fine.\n\nBut the non-404 case concerns me for the reasons stated above, i.e. the instance is gone but the port is associated with that device_id (the instance.uuid) so is the port then unusable?","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"},{"author":{"_account_id":1501,"name":"Phil Day","email":"philip.day@hp.com","username":"philip-day"},"change_message_id":"f74bb83800ce95a2ec712db93cced4d4f29cbcd5","unresolved":false,"context_lines":[{"line_number":450,"context_line":"                if e.status_code \u003d\u003d 404:"},{"line_number":451,"context_line":"                    LOG.warning(_(\"Port %s does not exist\"), port)"},{"line_number":452,"context_line":"                else:"},{"line_number":453,"context_line":"                    LOG.warning(_(\"Failed to update neutron port %s\"),"},{"line_number":454,"context_line":"                                port)"},{"line_number":455,"context_line":""},{"line_number":456,"context_line":"    def allocate_port_for_instance(self, context, instance, port_id,"}],"source_content_type":"text/x-python","patch_set":21,"id":"fa98f980_3a35de45","line":453,"in_reply_to":"baada198_3a434f6c","updated":"2014-09-04 17:15:16.000000000","message":"I think in the non-404 case you do have to at least warn that the update didn\u0027t work,","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"},{"author":{"_account_id":12175,"name":"Eli Qiao","email":"qiaoliyong@gmail.com","username":"Eli"},"change_message_id":"f6a56827ca2ac16830cc01c3aeaaf2136873c83a","unresolved":false,"context_lines":[{"line_number":459,"context_line":"        return self.allocate_for_instance(context, instance,"},{"line_number":460,"context_line":"                requested_networks\u003d[(network_id, requested_ip, port_id)])"},{"line_number":461,"context_line":""},{"line_number":462,"context_line":"    def deallocate_port_for_instance(self, context, instance, port_id):"},{"line_number":463,"context_line":"        \"\"\"Remove a specified port from the instance."},{"line_number":464,"context_line":""},{"line_number":465,"context_line":"        Return network information for the instance"}],"source_content_type":"text/x-python","patch_set":21,"id":"baada198_6817ddef","line":462,"updated":"2014-08-08 01:28:14.000000000","message":"hi Aaron,\nI think we also need to cover this.\nwhen deallocate_port_for_instance, we shouldn\u0027t deallocate the port if it is pre-created in neutron side.\n\njust remove the device_id like you did in deallocate_for_instance.\n\nmaybe it is better to create an private function to release the port. something like:\n\ndef _release_port(self, context, port_id):\n    port_req_body \u003d {\u0027port\u0027: {\u0027device_id\u0027: \u0027\u0027}}\n    ...\n   if self._has_port_binding_extension(context):\n            port_req_body[\u0027port\u0027][\u0027binding:host_id\u0027] \u003d None\n\n\n   ...\n\nthen you can call it in function deallocate_for_instance and \ndeallocate_port_for_instance\n\nex:\nfor port in non_nova_allocated_ports:\n    self._release_port(context, port)","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"bc7ad3f861d173a8d6ec65a20cee303691659b33","unresolved":false,"context_lines":[{"line_number":1180,"context_line":"                context, instance, networks, port_ids)"},{"line_number":1181,"context_line":"        nw_info \u003d network_model.NetworkInfo()"},{"line_number":1182,"context_line":""},{"line_number":1183,"context_line":"        if not preexisting_port_ids:"},{"line_number":1184,"context_line":"            preexisting_port_ids \u003d self._get_ports_not_allocated_by_nova("},{"line_number":1185,"context_line":"                instance)"},{"line_number":1186,"context_line":""}],"source_content_type":"text/x-python","patch_set":21,"id":"1ae5cdf2_72f69ed8","line":1183,"updated":"2014-06-12 20:04:29.000000000","message":"Are we sure that we want to equate None and empty sequence checking here?\n\nhttp://lists.openstack.org/pipermail/openstack-dev/2014-March/028718.html\n\nmdbooth was talking about this in the nova channel the other day about some sneaky bug he hit related to not checking None explicitly.","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"7133d9ac267b3e988917d08620de6a6307ab9137","unresolved":false,"context_lines":[{"line_number":1180,"context_line":"                context, instance, networks, port_ids)"},{"line_number":1181,"context_line":"        nw_info \u003d network_model.NetworkInfo()"},{"line_number":1182,"context_line":""},{"line_number":1183,"context_line":"        if not preexisting_port_ids:"},{"line_number":1184,"context_line":"            preexisting_port_ids \u003d self._get_ports_not_allocated_by_nova("},{"line_number":1185,"context_line":"                instance)"},{"line_number":1186,"context_line":""}],"source_content_type":"text/x-python","patch_set":21,"id":"1ae5cdf2_58438141","line":1183,"in_reply_to":"1ae5cdf2_72f69ed8","updated":"2014-06-12 20:33:30.000000000","message":"I think we do. In this case this value can either be None in the case when the info_cache is being updated periodically (perhaps triggered by an event) or a list when there is a port being added to an instance.","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"}],"nova/tests/network/test_neutronv2.py":[{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"b4b5967885c1dba15900e92dbaf0d4e512156cd5","unresolved":false,"context_lines":[{"line_number":1039,"context_line":"                {\u0027ports\u0027: port_data})"},{"line_number":1040,"context_line":""},{"line_number":1041,"context_line":"        port_req_body \u003d {\u0027port\u0027: {\u0027device_id\u0027: \u0027\u0027}}"},{"line_number":1042,"context_line":"        NeutronNotFound \u003d neutronv2.exceptions.NeutronClientException("},{"line_number":1043,"context_line":"            status_code\u003d404)"},{"line_number":1044,"context_line":"        self.moxed_client.update_port(port_data[0][\u0027id\u0027], port_req_body"},{"line_number":1045,"context_line":"            ).AndRaise(NeutronNotFound)"}],"source_content_type":"text/x-python","patch_set":19,"id":"5adbc538_9c177c51","line":1042,"updated":"2014-05-25 19:55:44.000000000","message":"nit, here and below... generally, variables are in lower_underscore form...","commit_id":"969cfa7ef235cf851828efc5021cbc55312ac942"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"86bce5e4811a309cf646d57c4b656972e6f969c2","unresolved":false,"context_lines":[{"line_number":1039,"context_line":"                {\u0027ports\u0027: port_data})"},{"line_number":1040,"context_line":""},{"line_number":1041,"context_line":"        port_req_body \u003d {\u0027port\u0027: {\u0027device_id\u0027: \u0027\u0027}}"},{"line_number":1042,"context_line":"        NeutronNotFound \u003d neutronv2.exceptions.NeutronClientException("},{"line_number":1043,"context_line":"            status_code\u003d404)"},{"line_number":1044,"context_line":"        self.moxed_client.update_port(port_data[0][\u0027id\u0027], port_req_body"},{"line_number":1045,"context_line":"            ).AndRaise(NeutronNotFound)"}],"source_content_type":"text/x-python","patch_set":19,"id":"3ae8d1ca_de245ab1","line":1042,"in_reply_to":"3ae8d1ca_0992119f","updated":"2014-05-28 17:41:46.000000000","message":"OK, no worries.","commit_id":"969cfa7ef235cf851828efc5021cbc55312ac942"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"8bf3435bb8e56abc529c02898a8155aadfdcd534","unresolved":false,"context_lines":[{"line_number":1039,"context_line":"                {\u0027ports\u0027: port_data})"},{"line_number":1040,"context_line":""},{"line_number":1041,"context_line":"        port_req_body \u003d {\u0027port\u0027: {\u0027device_id\u0027: \u0027\u0027}}"},{"line_number":1042,"context_line":"        NeutronNotFound \u003d neutronv2.exceptions.NeutronClientException("},{"line_number":1043,"context_line":"            status_code\u003d404)"},{"line_number":1044,"context_line":"        self.moxed_client.update_port(port_data[0][\u0027id\u0027], port_req_body"},{"line_number":1045,"context_line":"            ).AndRaise(NeutronNotFound)"}],"source_content_type":"text/x-python","patch_set":19,"id":"3ae8d1ca_0992119f","line":1042,"in_reply_to":"5adbc538_9c177c51","updated":"2014-05-28 16:48:37.000000000","message":"I only did this because this was done in a number of other places here as it\u0027s an exception see line 1062.","commit_id":"969cfa7ef235cf851828efc5021cbc55312ac942"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"bc7ad3f861d173a8d6ec65a20cee303691659b33","unresolved":false,"context_lines":[{"line_number":1079,"context_line":"        # Test to deallocate in two ports env."},{"line_number":1080,"context_line":"        self._deallocate_for_instance(2, preserve_on_delete\u003dTrue)"},{"line_number":1081,"context_line":""},{"line_number":1082,"context_line":"    def test_deallocate_for_instance_update_404_and_error(self):"},{"line_number":1083,"context_line":"        port_data \u003d self.port_data2"},{"line_number":1084,"context_line":"        instance \u003d copy.copy(self.instance)"},{"line_number":1085,"context_line":"        for port in port_data:"}],"source_content_type":"text/x-python","patch_set":21,"id":"1ae5cdf2_1d6d6bcc","line":1082,"updated":"2014-06-12 20:04:29.000000000","message":"Add a comment about what you\u0027re testing (the 404 port not found case and the non-404 neutron client exception case that doesn\u0027t re-raise an error).  Could probably be two separate tests, or a loop with the mocked exceptions.","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"7133d9ac267b3e988917d08620de6a6307ab9137","unresolved":false,"context_lines":[{"line_number":1079,"context_line":"        # Test to deallocate in two ports env."},{"line_number":1080,"context_line":"        self._deallocate_for_instance(2, preserve_on_delete\u003dTrue)"},{"line_number":1081,"context_line":""},{"line_number":1082,"context_line":"    def test_deallocate_for_instance_update_404_and_error(self):"},{"line_number":1083,"context_line":"        port_data \u003d self.port_data2"},{"line_number":1084,"context_line":"        instance \u003d copy.copy(self.instance)"},{"line_number":1085,"context_line":"        for port in port_data:"}],"source_content_type":"text/x-python","patch_set":21,"id":"1ae5cdf2_98498962","line":1082,"in_reply_to":"1ae5cdf2_1d6d6bcc","updated":"2014-06-12 20:33:30.000000000","message":"Done","commit_id":"561d4aa40e7a03680d5666f08f63cc66e4721277"}]}
