)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"6bc931145489d0953b2973938abd456bd5ad87cc","unresolved":false,"context_lines":[{"line_number":13,"context_line":"children."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"This is intended for those cases when there\u0027s no specific cleanup and"},{"line_number":16,"context_line":"serves as a fallback method"},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"Change-Id: I4195f633ef4a1788496d1293846f19eef89416aa"},{"line_number":19,"context_line":"Partial-Bug: #1403455"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":16,"id":"1a6eadb0_52807af7","line":16,"updated":"2016-12-14 21:09:39.000000000","message":"super-nit: missing trailing period, please don\u0027t update for this.","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"3774e1ff7b181d99019242f0371d3e5597b81809","unresolved":false,"context_lines":[{"line_number":13,"context_line":"children."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"This is intended for those cases when there\u0027s no specific cleanup and"},{"line_number":16,"context_line":"serves as a fallback method"},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"Change-Id: I4195f633ef4a1788496d1293846f19eef89416aa"},{"line_number":19,"context_line":"Partial-Bug: #1403455"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":16,"id":"1a6eadb0_47d0a2f6","line":16,"in_reply_to":"1a6eadb0_52807af7","updated":"2016-12-15 10:54:59.000000000","message":"Done","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"}],"etc/neutron/rootwrap.d/netns-cleanup.filters":[{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"586fe0b1eac360c413e02cdbfddada105e233889","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"[Filters]"},{"line_number":10,"context_line":""},{"line_number":11,"context_line":"# netns-cleanup "},{"line_number":12,"context_line":"netstat: CommandFilter, netstat, root"}],"source_content_type":"application/octet-stream","patch_set":1,"id":"5a74a57a_6469588b","line":11,"range":{"start_line":11,"start_character":15,"end_line":11,"end_character":16},"updated":"2016-11-24 17:11:19.000000000","message":"Oh my god! A trailing white space","commit_id":"43771f5d2fc08d323508dca2bfe1b8d18d03af87"}],"neutron/agent/linux/utils.py":[{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"bad0dc12036c5bccda933376b4b183f97ab271b8","unresolved":false,"context_lines":[{"line_number":196,"context_line":"        stale_pid \u003d (isinstance(ex, RuntimeError) and"},{"line_number":197,"context_line":"                     \u0027No such process\u0027 in str(ex))"},{"line_number":198,"context_line":"        if not stale_pid:"},{"line_number":199,"context_line":"            return False"},{"line_number":200,"context_line":"    return True"},{"line_number":201,"context_line":""},{"line_number":202,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"5a74a57a_7e58f332","line":199,"updated":"2016-11-25 09:33:55.000000000","message":"Can you move the warning message here inside too?, otherwise in your case now (netns cleanup, there\u0027ll be no warning if you can\u0027t kill it for some odd reason)","commit_id":"dc9127c8d41a57dc9288780f3519fe993ce4976d"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"c625a3f5740d544b9b37e31352f84214abe3b939","unresolved":false,"context_lines":[{"line_number":196,"context_line":"        stale_pid \u003d (isinstance(ex, RuntimeError) and"},{"line_number":197,"context_line":"                     \u0027No such process\u0027 in str(ex))"},{"line_number":198,"context_line":"        if not stale_pid:"},{"line_number":199,"context_line":"            return False"},{"line_number":200,"context_line":"    return True"},{"line_number":201,"context_line":""},{"line_number":202,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"5a74a57a_c5d1eb58","line":199,"in_reply_to":"5a74a57a_7e58f332","updated":"2016-11-28 14:07:53.000000000","message":"i have left the warning on the caller since if i\u0027d moved it here, then i\u0027d modify the current trace which included the \"self.cmd\" in the log entry. If you still think this is the place, then I can try to always include the command line of the failing pid and move it to here","commit_id":"dc9127c8d41a57dc9288780f3519fe993ce4976d"},{"author":{"_account_id":5756,"name":"Terry Wilson","email":"twilson@redhat.com","username":"otherwiseguy"},"change_message_id":"54c13a0fc2bcfaa3a0424362db7aa22da5de82d8","unresolved":false,"context_lines":[{"line_number":223,"context_line":"    \"\"\"Kill the process with the given pid using the given signal.\"\"\""},{"line_number":224,"context_line":"    try:"},{"line_number":225,"context_line":"        execute([\u0027kill\u0027, \u0027-%d\u0027 % signal, pid], run_as_root\u003drun_as_root)"},{"line_number":226,"context_line":"    except Exception as ex:"},{"line_number":227,"context_line":"        stale_pid \u003d (isinstance(ex, RuntimeError) and"},{"line_number":228,"context_line":"                     \u0027No such process\u0027 in str(ex))"},{"line_number":229,"context_line":"        if not stale_pid:"}],"source_content_type":"text/x-python","patch_set":3,"id":"5a74a57a_4f716c43","line":226,"updated":"2016-11-28 18:22:34.000000000","message":"To avoid the isinstance, I think this could be:\n\n except RuntimeError as ex:\n     # Yuck, but kill doesn\u0027t have unique exit codes\n     if \u0027No such process\u0027 not in str(ex):\n         return False\n except Exception:\n     return False\n return True\n\nthough I\u0027m not really a fan of hiding exceptions from callers. Any reason why we can\u0027t just do no return value and:\n\n try:\n     execute(...)\n except RuntimeError as ex:\n     if \u0027No such process\u0027 not in str(ex):\n         raise\n\nand let the caller deal with any exceptions (since there shouldn\u0027t be any unless something is broken)?\n\nIt also looks like all of the uses of kill_process do:\n\n if not kill_process():\n     LOG.exception()\n\nbut it looks like execute already defaults to log_fail_as_errror\u003dTrue so we\u0027ll already be getting a log message if the kill command exits non-zero. If we don\u0027t eat the exception, presumably the calling code is already handling/logging the exceptions that the old code would have thrown.\n\nAlso, re: RuntimeError, it looks like the execute() code will actually raise a subclass of it, ProcessExecutionError. It\u0027ll still work of course, just wondering why not except ProcessExecutionError.","commit_id":"bbc98b9957be36ae098452fbb08479ea602e2a9c"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"553be7118cb876f9c7e6fbc8f8c03bebf3f3f58f","unresolved":false,"context_lines":[{"line_number":223,"context_line":"    \"\"\"Kill the process with the given pid using the given signal.\"\"\""},{"line_number":224,"context_line":"    try:"},{"line_number":225,"context_line":"        execute([\u0027kill\u0027, \u0027-%d\u0027 % signal, pid], run_as_root\u003drun_as_root)"},{"line_number":226,"context_line":"    except Exception as ex:"},{"line_number":227,"context_line":"        stale_pid \u003d (isinstance(ex, RuntimeError) and"},{"line_number":228,"context_line":"                     \u0027No such process\u0027 in str(ex))"},{"line_number":229,"context_line":"        if not stale_pid:"}],"source_content_type":"text/x-python","patch_set":3,"id":"5a74a57a_ffd80655","line":226,"in_reply_to":"5a74a57a_4f716c43","updated":"2016-11-29 11:03:18.000000000","message":"thanks for the suggestion :) I have excepted ProcessExecutionError now in Patch Set 4","commit_id":"bbc98b9957be36ae098452fbb08479ea602e2a9c"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"46393a377c93dfd6e4b1554003a64d773a41a813","unresolved":false,"context_lines":[{"line_number":183,"context_line":"            no_parent_found \u003d e.returncode \u003d\u003d 1"},{"line_number":184,"context_line":"            if no_parent_found:"},{"line_number":185,"context_line":"                ctxt.reraise \u003d False"},{"line_number":186,"context_line":"                return None"},{"line_number":187,"context_line":"    return ppid.strip()"},{"line_number":188,"context_line":""},{"line_number":189,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"5a74a57a_68c8b955","line":186,"range":{"start_line":186,"start_character":23,"end_line":186,"end_character":27},"updated":"2016-11-29 12:19:34.000000000","message":"This is implicit","commit_id":"b9f3a1e12345bcd34be880a3c9448fdfecadcf00"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"d09753ca483bfe6963e89536959ada3faef05ada","unresolved":false,"context_lines":[{"line_number":183,"context_line":"            no_parent_found \u003d e.returncode \u003d\u003d 1"},{"line_number":184,"context_line":"            if no_parent_found:"},{"line_number":185,"context_line":"                ctxt.reraise \u003d False"},{"line_number":186,"context_line":"                return None"},{"line_number":187,"context_line":"    return ppid.strip()"},{"line_number":188,"context_line":""},{"line_number":189,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"5a74a57a_fc42c60d","line":186,"range":{"start_line":186,"start_character":23,"end_line":186,"end_character":27},"in_reply_to":"5a74a57a_54c8f854","updated":"2016-11-29 14:52:36.000000000","message":"Done","commit_id":"b9f3a1e12345bcd34be880a3c9448fdfecadcf00"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"ae1152cbb5831266d3918dfe38b7268947dd4838","unresolved":false,"context_lines":[{"line_number":183,"context_line":"            no_parent_found \u003d e.returncode \u003d\u003d 1"},{"line_number":184,"context_line":"            if no_parent_found:"},{"line_number":185,"context_line":"                ctxt.reraise \u003d False"},{"line_number":186,"context_line":"                return None"},{"line_number":187,"context_line":"    return ppid.strip()"},{"line_number":188,"context_line":""},{"line_number":189,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"5a74a57a_54c8f854","line":186,"range":{"start_line":186,"start_character":23,"end_line":186,"end_character":27},"in_reply_to":"5a74a57a_68c8b955","updated":"2016-11-29 13:36:06.000000000","message":"Oh right, you can just \"return\"","commit_id":"b9f3a1e12345bcd34be880a3c9448fdfecadcf00"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"46393a377c93dfd6e4b1554003a64d773a41a813","unresolved":false,"context_lines":[{"line_number":226,"context_line":"    except ProcessExecutionError as ex:"},{"line_number":227,"context_line":"        if \u0027No such process\u0027 not in str(ex):"},{"line_number":228,"context_line":"            raise"},{"line_number":229,"context_line":"    return True"},{"line_number":230,"context_line":""},{"line_number":231,"context_line":""},{"line_number":232,"context_line":"def _get_conf_base(cfg_root, uuid, ensure_conf_dir):"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a74a57a_85050015","line":229,"range":{"start_line":229,"start_character":0,"end_line":229,"end_character":15},"updated":"2016-11-29 12:19:34.000000000","message":"This is unused","commit_id":"b9f3a1e12345bcd34be880a3c9448fdfecadcf00"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"3293510a696b64c1d9ea16d2ced2ee4a07824d55","unresolved":false,"context_lines":[{"line_number":174,"context_line":"def find_parent_pid(pid):"},{"line_number":175,"context_line":"    \"\"\"Retrieve the pid of the parent process of the given pid.\"\"\""},{"line_number":176,"context_line":"    try:"},{"line_number":177,"context_line":"        ppid \u003d execute([\u0027ps\u0027, \u0027-o\u0027, \u0027ppid\u003d\u0027, pid],"},{"line_number":178,"context_line":"                       log_fail_as_error\u003dFalse)"},{"line_number":179,"context_line":"    except ProcessExecutionError as e:"},{"line_number":180,"context_line":"        # Unexpected errors are the responsibility of the caller"},{"line_number":181,"context_line":"        with excutils.save_and_reraise_exception() as ctxt:"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a74a57a_f242ef0d","line":178,"range":{"start_line":177,"start_character":0,"end_line":178,"end_character":47},"updated":"2016-11-29 15:24:03.000000000","message":"We should type it to int here and catch ValueError on L187","commit_id":"33903813eb9c8ebe04853138c5daaceb3c6e7612"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"52304bf988c295e1808ba4cae60be61f5a75c3ce","unresolved":false,"context_lines":[{"line_number":174,"context_line":"def find_parent_pid(pid):"},{"line_number":175,"context_line":"    \"\"\"Retrieve the pid of the parent process of the given pid.\"\"\""},{"line_number":176,"context_line":"    try:"},{"line_number":177,"context_line":"        ppid \u003d execute([\u0027ps\u0027, \u0027-o\u0027, \u0027ppid\u003d\u0027, pid],"},{"line_number":178,"context_line":"                       log_fail_as_error\u003dFalse)"},{"line_number":179,"context_line":"    except ProcessExecutionError as e:"},{"line_number":180,"context_line":"        # Unexpected errors are the responsibility of the caller"},{"line_number":181,"context_line":"        with excutils.save_and_reraise_exception() as ctxt:"}],"source_content_type":"text/x-python","patch_set":5,"id":"3a71b18c_96fec436","line":178,"range":{"start_line":177,"start_character":0,"end_line":178,"end_character":47},"in_reply_to":"5a74a57a_f242ef0d","updated":"2016-12-02 09:25:24.000000000","message":"since I\u0027ve modified L187 there\u0027s no need for the casting anymore but good catch anyways, thanks :)","commit_id":"33903813eb9c8ebe04853138c5daaceb3c6e7612"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"3293510a696b64c1d9ea16d2ced2ee4a07824d55","unresolved":false,"context_lines":[{"line_number":195,"context_line":"    \"\"\""},{"line_number":196,"context_line":"    while True:"},{"line_number":197,"context_line":"        ppid \u003d find_parent_pid(pid)"},{"line_number":198,"context_line":"        if ppid \u003e 1 and pid_invoked_with_cmdline(ppid,"},{"line_number":199,"context_line":"                                                 get_cmdline_from_pid(pid)):"},{"line_number":200,"context_line":"            pid \u003d ppid"},{"line_number":201,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a74a57a_92d29b5a","line":198,"range":{"start_line":198,"start_character":11,"end_line":198,"end_character":19},"updated":"2016-11-29 15:24:03.000000000","message":"You\u0027re comparing string with int here","commit_id":"33903813eb9c8ebe04853138c5daaceb3c6e7612"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"52304bf988c295e1808ba4cae60be61f5a75c3ce","unresolved":false,"context_lines":[{"line_number":195,"context_line":"    \"\"\""},{"line_number":196,"context_line":"    while True:"},{"line_number":197,"context_line":"        ppid \u003d find_parent_pid(pid)"},{"line_number":198,"context_line":"        if ppid \u003e 1 and pid_invoked_with_cmdline(ppid,"},{"line_number":199,"context_line":"                                                 get_cmdline_from_pid(pid)):"},{"line_number":200,"context_line":"            pid \u003d ppid"},{"line_number":201,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":5,"id":"3a71b18c_d6459cb3","line":198,"range":{"start_line":198,"start_character":11,"end_line":198,"end_character":19},"in_reply_to":"5a74a57a_92d29b5a","updated":"2016-12-02 09:25:24.000000000","message":"I removed this comparison in PS6, it wasn\u0027t really necessary since we\u0027re comparing against parent\u0027s cmdline","commit_id":"33903813eb9c8ebe04853138c5daaceb3c6e7612"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"6e859ab615ecf0af566ce5e2b1c34cf57be0f4ac","unresolved":false,"context_lines":[{"line_number":226,"context_line":"    except ProcessExecutionError as ex:"},{"line_number":227,"context_line":"        if \u0027No such process\u0027 not in str(ex):"},{"line_number":228,"context_line":"            raise"},{"line_number":229,"context_line":"    return True"},{"line_number":230,"context_line":""},{"line_number":231,"context_line":""},{"line_number":232,"context_line":"def _get_conf_base(cfg_root, uuid, ensure_conf_dir):"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a74a57a_37945989","line":229,"updated":"2016-11-29 15:07:43.000000000","message":"you forgot about the return True, see PS4 comments","commit_id":"33903813eb9c8ebe04853138c5daaceb3c6e7612"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"19e9f659e92e32bda41d0328ed40a5182a42a5e0","unresolved":false,"context_lines":[{"line_number":226,"context_line":"    except ProcessExecutionError as ex:"},{"line_number":227,"context_line":"        if \u0027No such process\u0027 not in str(ex):"},{"line_number":228,"context_line":"            raise"},{"line_number":229,"context_line":"    return True"},{"line_number":230,"context_line":""},{"line_number":231,"context_line":""},{"line_number":232,"context_line":"def _get_conf_base(cfg_root, uuid, ensure_conf_dir):"}],"source_content_type":"text/x-python","patch_set":5,"id":"3a71b18c_164e3496","line":229,"in_reply_to":"5a74a57a_37945989","updated":"2016-12-02 09:28:13.000000000","message":"Done","commit_id":"33903813eb9c8ebe04853138c5daaceb3c6e7612"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"476c1b19f146f63c891f5dc7b75afd0858d07d14","unresolved":false,"context_lines":[{"line_number":188,"context_line":"                ctxt.reraise \u003d False"},{"line_number":189,"context_line":"                return []"},{"line_number":190,"context_line":"    child_pids \u003d [x.strip() for x in raw_pids.split(\u0027\\n\u0027) if x.strip()]"},{"line_number":191,"context_line":"    if child_pids and recursive:"},{"line_number":192,"context_line":"        for child in child_pids:"},{"line_number":193,"context_line":"            child_pids \u003d child_pids + find_child_pids(child, True)"},{"line_number":194,"context_line":"    return child_pids"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_717852c5","line":191,"range":{"start_line":191,"start_character":7,"end_line":191,"end_character":21},"updated":"2016-12-02 10:12:23.000000000","message":"Nit: This is redundant with L192","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"3a031d9a8b2f97e0a57f6071619139c8400b6faa","unresolved":false,"context_lines":[{"line_number":188,"context_line":"                ctxt.reraise \u003d False"},{"line_number":189,"context_line":"                return []"},{"line_number":190,"context_line":"    child_pids \u003d [x.strip() for x in raw_pids.split(\u0027\\n\u0027) if x.strip()]"},{"line_number":191,"context_line":"    if child_pids and recursive:"},{"line_number":192,"context_line":"        for child in child_pids:"},{"line_number":193,"context_line":"            child_pids \u003d child_pids + find_child_pids(child, True)"},{"line_number":194,"context_line":"    return child_pids"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_63421312","line":191,"range":{"start_line":191,"start_character":7,"end_line":191,"end_character":21},"in_reply_to":"3a71b18c_717852c5","updated":"2016-12-04 19:51:17.000000000","message":"Done","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"476c1b19f146f63c891f5dc7b75afd0858d07d14","unresolved":false,"context_lines":[{"line_number":190,"context_line":"    child_pids \u003d [x.strip() for x in raw_pids.split(\u0027\\n\u0027) if x.strip()]"},{"line_number":191,"context_line":"    if child_pids and recursive:"},{"line_number":192,"context_line":"        for child in child_pids:"},{"line_number":193,"context_line":"            child_pids \u003d child_pids + find_child_pids(child, True)"},{"line_number":194,"context_line":"    return child_pids"},{"line_number":195,"context_line":""},{"line_number":196,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_f1bc626e","line":193,"range":{"start_line":193,"start_character":12,"end_line":193,"end_character":66},"updated":"2016-12-02 10:12:23.000000000","message":"Nit: child_pids +\u003d find_child_pids","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"3a031d9a8b2f97e0a57f6071619139c8400b6faa","unresolved":false,"context_lines":[{"line_number":190,"context_line":"    child_pids \u003d [x.strip() for x in raw_pids.split(\u0027\\n\u0027) if x.strip()]"},{"line_number":191,"context_line":"    if child_pids and recursive:"},{"line_number":192,"context_line":"        for child in child_pids:"},{"line_number":193,"context_line":"            child_pids \u003d child_pids + find_child_pids(child, True)"},{"line_number":194,"context_line":"    return child_pids"},{"line_number":195,"context_line":""},{"line_number":196,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_83456f18","line":193,"range":{"start_line":193,"start_character":12,"end_line":193,"end_character":66},"in_reply_to":"3a71b18c_f1bc626e","updated":"2016-12-04 19:51:17.000000000","message":"if i do \"+\u003d\" then I would be modifying the actual object over which I\u0027m iterating and therefore performing more iterations than expected. If it\u0027s not clear enough then i can rewrite it differently","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"a746350a3ee3cd9f1cdb1130b41f44f9e0c92c92","unresolved":false,"context_lines":[{"line_number":196,"context_line":""},{"line_number":197,"context_line":"def find_parent_pid(pid):"},{"line_number":198,"context_line":"    \"\"\"Retrieve the pid of the parent process of the given pid.\"\"\""},{"line_number":199,"context_line":"    try:"},{"line_number":200,"context_line":"        ppid \u003d execute([\u0027ps\u0027, \u0027-o\u0027, \u0027ppid\u003d\u0027, pid],"},{"line_number":201,"context_line":"                       log_fail_as_error\u003dFalse)"},{"line_number":202,"context_line":"    except ProcessExecutionError as e:"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_996ef494","line":199,"updated":"2016-12-02 10:31:32.000000000","message":"you may need to ppid\u003d\"\" here  (see L210)","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"3a031d9a8b2f97e0a57f6071619139c8400b6faa","unresolved":false,"context_lines":[{"line_number":196,"context_line":""},{"line_number":197,"context_line":"def find_parent_pid(pid):"},{"line_number":198,"context_line":"    \"\"\"Retrieve the pid of the parent process of the given pid.\"\"\""},{"line_number":199,"context_line":"    try:"},{"line_number":200,"context_line":"        ppid \u003d execute([\u0027ps\u0027, \u0027-o\u0027, \u0027ppid\u003d\u0027, pid],"},{"line_number":201,"context_line":"                       log_fail_as_error\u003dFalse)"},{"line_number":202,"context_line":"    except ProcessExecutionError as e:"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_c3504761","line":199,"in_reply_to":"3a71b18c_996ef494","updated":"2016-12-04 19:51:17.000000000","message":"Done","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"476c1b19f146f63c891f5dc7b75afd0858d07d14","unresolved":false,"context_lines":[{"line_number":203,"context_line":"        # Unexpected errors are the responsibility of the caller"},{"line_number":204,"context_line":"        with excutils.save_and_reraise_exception() as ctxt:"},{"line_number":205,"context_line":"            # Exception has already been logged by execute"},{"line_number":206,"context_line":"            no_parent_found \u003d e.returncode \u003d\u003d 1"},{"line_number":207,"context_line":"            if no_parent_found:"},{"line_number":208,"context_line":"                ctxt.reraise \u003d False"},{"line_number":209,"context_line":"                return"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_66ced7b5","line":206,"range":{"start_line":206,"start_character":12,"end_line":206,"end_character":47},"updated":"2016-12-02 10:12:23.000000000","message":"Do we want to handle this case? I would raise an exception always as this likely means the input pid is wrong:\n\nhttp://paste.openstack.org/show/591226/","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"a746350a3ee3cd9f1cdb1130b41f44f9e0c92c92","unresolved":false,"context_lines":[{"line_number":203,"context_line":"        # Unexpected errors are the responsibility of the caller"},{"line_number":204,"context_line":"        with excutils.save_and_reraise_exception() as ctxt:"},{"line_number":205,"context_line":"            # Exception has already been logged by execute"},{"line_number":206,"context_line":"            no_parent_found \u003d e.returncode \u003d\u003d 1"},{"line_number":207,"context_line":"            if no_parent_found:"},{"line_number":208,"context_line":"                ctxt.reraise \u003d False"},{"line_number":209,"context_line":"                return"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_d9b5cc31","line":206,"range":{"start_line":206,"start_character":12,"end_line":206,"end_character":47},"in_reply_to":"3a71b18c_66ced7b5","updated":"2016-12-02 10:31:32.000000000","message":"There can be the cases where there are no parent\u0027s and that\u0027s normal.\n\nWe should handle that case I think.","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"b77954ce72d1af2b7403189d49d0099db13604a3","unresolved":false,"context_lines":[{"line_number":203,"context_line":"        # Unexpected errors are the responsibility of the caller"},{"line_number":204,"context_line":"        with excutils.save_and_reraise_exception() as ctxt:"},{"line_number":205,"context_line":"            # Exception has already been logged by execute"},{"line_number":206,"context_line":"            no_parent_found \u003d e.returncode \u003d\u003d 1"},{"line_number":207,"context_line":"            if no_parent_found:"},{"line_number":208,"context_line":"                ctxt.reraise \u003d False"},{"line_number":209,"context_line":"                return"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_dcba1a0a","line":206,"range":{"start_line":206,"start_character":12,"end_line":206,"end_character":47},"in_reply_to":"3a71b18c_7c42e63f","updated":"2016-12-02 10:42:42.000000000","message":"lol, sorry, I thought here it was already filtered by cmdline.\n\nOnly the system init process won\u0027t have parent, and we certainly don\u0027t want to fiddle with it.","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"0219940d9af7071de4c10307633b1c713d0f20ee","unresolved":false,"context_lines":[{"line_number":203,"context_line":"        # Unexpected errors are the responsibility of the caller"},{"line_number":204,"context_line":"        with excutils.save_and_reraise_exception() as ctxt:"},{"line_number":205,"context_line":"            # Exception has already been logged by execute"},{"line_number":206,"context_line":"            no_parent_found \u003d e.returncode \u003d\u003d 1"},{"line_number":207,"context_line":"            if no_parent_found:"},{"line_number":208,"context_line":"                ctxt.reraise \u003d False"},{"line_number":209,"context_line":"                return"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_7c42e63f","line":206,"range":{"start_line":206,"start_character":12,"end_line":206,"end_character":47},"in_reply_to":"3a71b18c_d9b5cc31","updated":"2016-12-02 10:38:16.000000000","message":"Can you give an example of a process that doesn\u0027t have a parent?","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"3a031d9a8b2f97e0a57f6071619139c8400b6faa","unresolved":false,"context_lines":[{"line_number":203,"context_line":"        # Unexpected errors are the responsibility of the caller"},{"line_number":204,"context_line":"        with excutils.save_and_reraise_exception() as ctxt:"},{"line_number":205,"context_line":"            # Exception has already been logged by execute"},{"line_number":206,"context_line":"            no_parent_found \u003d e.returncode \u003d\u003d 1"},{"line_number":207,"context_line":"            if no_parent_found:"},{"line_number":208,"context_line":"                ctxt.reraise \u003d False"},{"line_number":209,"context_line":"                return"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_a3550b51","line":206,"range":{"start_line":206,"start_character":12,"end_line":206,"end_character":47},"in_reply_to":"3a71b18c_dcba1a0a","updated":"2016-12-04 19:51:17.000000000","message":"maybe the name \u0027no_parent_found\u0027 is not accurate. That case happens when the pid we\u0027re trying to find its parent no longer exists and, since it technically doesn\u0027t have a parent, i\u0027d rather not raise the exception. I\u0027ll update the function doc","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"476c1b19f146f63c891f5dc7b75afd0858d07d14","unresolved":false,"context_lines":[{"line_number":207,"context_line":"            if no_parent_found:"},{"line_number":208,"context_line":"                ctxt.reraise \u003d False"},{"line_number":209,"context_line":"                return"},{"line_number":210,"context_line":"    if ppid:"},{"line_number":211,"context_line":"        return ppid.strip()"},{"line_number":212,"context_line":""},{"line_number":213,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_51399640","line":210,"updated":"2016-12-02 10:12:23.000000000","message":"This is not even needed. We can return pid.strip() always, even when pid is empty string.","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"3a031d9a8b2f97e0a57f6071619139c8400b6faa","unresolved":false,"context_lines":[{"line_number":207,"context_line":"            if no_parent_found:"},{"line_number":208,"context_line":"                ctxt.reraise \u003d False"},{"line_number":209,"context_line":"                return"},{"line_number":210,"context_line":"    if ppid:"},{"line_number":211,"context_line":"        return ppid.strip()"},{"line_number":212,"context_line":""},{"line_number":213,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_83d56fba","line":210,"in_reply_to":"3a71b18c_51399640","updated":"2016-12-04 19:51:17.000000000","message":"Done","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"a746350a3ee3cd9f1cdb1130b41f44f9e0c92c92","unresolved":false,"context_lines":[{"line_number":207,"context_line":"            if no_parent_found:"},{"line_number":208,"context_line":"                ctxt.reraise \u003d False"},{"line_number":209,"context_line":"                return"},{"line_number":210,"context_line":"    if ppid:"},{"line_number":211,"context_line":"        return ppid.strip()"},{"line_number":212,"context_line":""},{"line_number":213,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_59453c15","line":210,"in_reply_to":"3a71b18c_51399640","updated":"2016-12-02 10:31:32.000000000","message":"Hmm, if there was an exception, won\u0027t be ppid be undefined? (and hence, this line would fail?)\n\n\u003e\u003e\u003e def raiser(): raise Exception()\n...\n\u003e\u003e\u003e try:\n...     ppid\u003draiser()\n... except Exception:\n...     pass\n...\n\u003e\u003e\u003e print ppid\nTraceback (most recent call last):\n  File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\nNameError: name \u0027ppid\u0027 is not defined","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"3a031d9a8b2f97e0a57f6071619139c8400b6faa","unresolved":false,"context_lines":[{"line_number":207,"context_line":"            if no_parent_found:"},{"line_number":208,"context_line":"                ctxt.reraise \u003d False"},{"line_number":209,"context_line":"                return"},{"line_number":210,"context_line":"    if ppid:"},{"line_number":211,"context_line":"        return ppid.strip()"},{"line_number":212,"context_line":""},{"line_number":213,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_63d213d4","line":210,"in_reply_to":"3a71b18c_59453c15","updated":"2016-12-04 19:51:17.000000000","message":"if there\u0027s an exception, this line won\u0027t be reached so if this is reached, ppid is defined (I guess :)","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"81d2700c2a54ed4476850b28f71abb86d760bc44","unresolved":false,"context_lines":[{"line_number":199,"context_line":""},{"line_number":200,"context_line":"    If the pid doesn\u0027t exist in the system, this function will return"},{"line_number":201,"context_line":"    an empty string"},{"line_number":202,"context_line":"    \"\"\""},{"line_number":203,"context_line":"    try:"},{"line_number":204,"context_line":"        ppid \u003d execute([\u0027ps\u0027, \u0027-o\u0027, \u0027ppid\u003d\u0027, pid],"},{"line_number":205,"context_line":"                       log_fail_as_error\u003dFalse)"}],"source_content_type":"text/x-python","patch_set":7,"id":"3a71b18c_1d2522c0","line":202,"updated":"2016-12-05 14:00:46.000000000","message":"ppid \u003d \"\"","commit_id":"f3e3d4c6e2783fad7b9b1d0228efcf26393c5229"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"bcdcc5569ea455b919c19fcf7a94943d7ca3639f","unresolved":false,"context_lines":[{"line_number":199,"context_line":""},{"line_number":200,"context_line":"    If the pid doesn\u0027t exist in the system, this function will return"},{"line_number":201,"context_line":"    an empty string"},{"line_number":202,"context_line":"    \"\"\""},{"line_number":203,"context_line":"    try:"},{"line_number":204,"context_line":"        ppid \u003d execute([\u0027ps\u0027, \u0027-o\u0027, \u0027ppid\u003d\u0027, pid],"},{"line_number":205,"context_line":"                       log_fail_as_error\u003dFalse)"}],"source_content_type":"text/x-python","patch_set":7,"id":"3a71b18c_f3fa5574","line":202,"in_reply_to":"3a71b18c_1d2522c0","updated":"2016-12-05 14:23:22.000000000","message":"Oh sorry, this is handled by the exception capture.","commit_id":"f3e3d4c6e2783fad7b9b1d0228efcf26393c5229"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"d7580fdbedaf008c550c86f27d1b1924acfdffc7","unresolved":false,"context_lines":[{"line_number":199,"context_line":""},{"line_number":200,"context_line":"    If the pid doesn\u0027t exist in the system, this function will return"},{"line_number":201,"context_line":"    an empty string"},{"line_number":202,"context_line":"    \"\"\""},{"line_number":203,"context_line":"    try:"},{"line_number":204,"context_line":"        ppid \u003d execute([\u0027ps\u0027, \u0027-o\u0027, \u0027ppid\u003d\u0027, pid],"},{"line_number":205,"context_line":"                       log_fail_as_error\u003dFalse)"}],"source_content_type":"text/x-python","patch_set":7,"id":"3a71b18c_b30d3dea","line":202,"in_reply_to":"3a71b18c_1d2522c0","updated":"2016-12-05 14:24:19.000000000","message":"if i\u0027m not wrong, this is not necessary.\nIf an exception is raised, then either no_such_pid and return None or, if it\u0027s a different exception, then it\u0027ll be reraised and #L214 is not hit.","commit_id":"f3e3d4c6e2783fad7b9b1d0228efcf26393c5229"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"d120739a779c265a9ebf16ccf5a72608325a9f89","unresolved":false,"context_lines":[{"line_number":197,"context_line":"def find_parent_pid(pid):"},{"line_number":198,"context_line":"    \"\"\"Retrieve the pid of the parent process of the given pid."},{"line_number":199,"context_line":""},{"line_number":200,"context_line":"    If the pid doesn\u0027t exist in the system, this function will return"},{"line_number":201,"context_line":"    an empty string"},{"line_number":202,"context_line":"    \"\"\""},{"line_number":203,"context_line":"    try:"},{"line_number":204,"context_line":"        ppid \u003d execute([\u0027ps\u0027, \u0027-o\u0027, \u0027ppid\u003d\u0027, pid],"}],"source_content_type":"text/x-python","patch_set":13,"id":"1a6eadb0_6399896e","line":201,"range":{"start_line":200,"start_character":44,"end_line":201,"end_character":19},"updated":"2016-12-13 10:47:16.000000000","message":"This is not true. The function returns None if pid doesn\u0027t exist or if invalid input has been passed: http://paste.openstack.org/show/592191/\n\nI still think it\u0027s better to fail and raise an exception in such cases.","commit_id":"7057de2d829dbfef7c74aea617724d068a8ba7ae"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"10b8c9436a23cfc617439a346457dcaf8f1be9ac","unresolved":false,"context_lines":[{"line_number":197,"context_line":"def find_parent_pid(pid):"},{"line_number":198,"context_line":"    \"\"\"Retrieve the pid of the parent process of the given pid."},{"line_number":199,"context_line":""},{"line_number":200,"context_line":"    If the pid doesn\u0027t exist in the system, this function will return"},{"line_number":201,"context_line":"    an empty string"},{"line_number":202,"context_line":"    \"\"\""},{"line_number":203,"context_line":"    try:"},{"line_number":204,"context_line":"        ppid \u003d execute([\u0027ps\u0027, \u0027-o\u0027, \u0027ppid\u003d\u0027, pid],"}],"source_content_type":"text/x-python","patch_set":13,"id":"1a6eadb0_d4513164","line":201,"range":{"start_line":200,"start_character":44,"end_line":201,"end_character":19},"in_reply_to":"1a6eadb0_6399896e","updated":"2016-12-13 11:50:29.000000000","message":"You\u0027re right, i forgot to update the docstring after my last changes. \nAbout the fail\u0026raise, if the others also think like that then I\u0027ll change it and rewrite tests but isn\u0027t returning None enough to let the caller know that this PID is not valid?\nOtherwise, I guess the best thing is to raise two different exceptions like custom NoSuchPIDException and RunTime.Invalid :? What do the others think?","commit_id":"7057de2d829dbfef7c74aea617724d068a8ba7ae"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"d120739a779c265a9ebf16ccf5a72608325a9f89","unresolved":false,"context_lines":[{"line_number":222,"context_line":"    \"\"\""},{"line_number":223,"context_line":"    while True:"},{"line_number":224,"context_line":"        ppid \u003d find_parent_pid(pid)"},{"line_number":225,"context_line":"        if ppid and pid_invoked_with_cmdline(ppid, get_cmdline_from_pid(pid)):"},{"line_number":226,"context_line":"            pid \u003d ppid"},{"line_number":227,"context_line":"        else:"},{"line_number":228,"context_line":"            return pid"}],"source_content_type":"text/x-python","patch_set":13,"id":"1a6eadb0_831145af","line":225,"updated":"2016-12-13 10:47:16.000000000","message":"Nit: Do you think it would make sense to make this algorithm more defensive and compare that ppid !\u003d pid? If find_parent_pid(pid) returns the same pid (bug) we would end in endless loop here.","commit_id":"7057de2d829dbfef7c74aea617724d068a8ba7ae"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"10b8c9436a23cfc617439a346457dcaf8f1be9ac","unresolved":false,"context_lines":[{"line_number":222,"context_line":"    \"\"\""},{"line_number":223,"context_line":"    while True:"},{"line_number":224,"context_line":"        ppid \u003d find_parent_pid(pid)"},{"line_number":225,"context_line":"        if ppid and pid_invoked_with_cmdline(ppid, get_cmdline_from_pid(pid)):"},{"line_number":226,"context_line":"            pid \u003d ppid"},{"line_number":227,"context_line":"        else:"},{"line_number":228,"context_line":"            return pid"}],"source_content_type":"text/x-python","patch_set":13,"id":"1a6eadb0_14a8091f","line":225,"in_reply_to":"1a6eadb0_831145af","updated":"2016-12-13 11:50:29.000000000","message":"I can include that condition (paranoid mode :p)","commit_id":"7057de2d829dbfef7c74aea617724d068a8ba7ae"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"6fa7b78a7bcb15d1216b37aa02576ba527507c54","unresolved":false,"context_lines":[{"line_number":207,"context_line":"        # Unexpected errors are the responsibility of the caller"},{"line_number":208,"context_line":"        with excutils.save_and_reraise_exception() as ctxt:"},{"line_number":209,"context_line":"            # Exception has already been logged by execute"},{"line_number":210,"context_line":"            no_such_pid \u003d e.returncode \u003d\u003d 1"},{"line_number":211,"context_line":"            if no_such_pid:"},{"line_number":212,"context_line":"                ctxt.reraise \u003d False"},{"line_number":213,"context_line":"                return"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_ca667750","line":210,"range":{"start_line":210,"start_character":26,"end_line":210,"end_character":43},"updated":"2016-12-15 11:21:08.000000000","message":"No need for \"no_such_pid\", as you\u0027re not using it later on. A simple comment is enough.","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"5e608efd0c68c16fa412c24ede4a9804ee3f3475","unresolved":false,"context_lines":[{"line_number":207,"context_line":"        # Unexpected errors are the responsibility of the caller"},{"line_number":208,"context_line":"        with excutils.save_and_reraise_exception() as ctxt:"},{"line_number":209,"context_line":"            # Exception has already been logged by execute"},{"line_number":210,"context_line":"            no_such_pid \u003d e.returncode \u003d\u003d 1"},{"line_number":211,"context_line":"            if no_such_pid:"},{"line_number":212,"context_line":"                ctxt.reraise \u003d False"},{"line_number":213,"context_line":"                return"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_70c2b235","line":210,"range":{"start_line":210,"start_character":26,"end_line":210,"end_character":43},"in_reply_to":"1a6eadb0_ca667750","updated":"2016-12-15 12:09:12.000000000","message":"The additional variable kinda improves readability","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"6fa7b78a7bcb15d1216b37aa02576ba527507c54","unresolved":false,"context_lines":[{"line_number":220,"context_line":"    This function will search the top parent with its same cmdline. If the"},{"line_number":221,"context_line":"    given pid has no parent, its own pid will be returned"},{"line_number":222,"context_line":"    \"\"\""},{"line_number":223,"context_line":"    while True:"},{"line_number":224,"context_line":"        ppid \u003d find_parent_pid(pid)"},{"line_number":225,"context_line":"        if (ppid and ppid !\u003d pid and"},{"line_number":226,"context_line":"                pid_invoked_with_cmdline(ppid, get_cmdline_from_pid(pid))):"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_2a8b6bc4","line":223,"range":{"start_line":223,"start_character":4,"end_line":223,"end_character":15},"updated":"2016-12-15 11:21:08.000000000","message":"This kinda screams recursion:\n\n ppid \u003d find_parent_pid(pid)\n if not ppid or ppid \u003d\u003d pid or pid_invoked...(...):\n     return pid\n return find_fork_top_parent(ppid)\n\n(or something like this - didn\u0027t think this through and didn\u0027t run it :))","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"b2b37ff40013fb79b3a60ee5f3a045ceaad75a42","unresolved":false,"context_lines":[{"line_number":220,"context_line":"    This function will search the top parent with its same cmdline. If the"},{"line_number":221,"context_line":"    given pid has no parent, its own pid will be returned"},{"line_number":222,"context_line":"    \"\"\""},{"line_number":223,"context_line":"    while True:"},{"line_number":224,"context_line":"        ppid \u003d find_parent_pid(pid)"},{"line_number":225,"context_line":"        if (ppid and ppid !\u003d pid and"},{"line_number":226,"context_line":"                pid_invoked_with_cmdline(ppid, get_cmdline_from_pid(pid))):"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_d00b86d4","line":223,"range":{"start_line":223,"start_character":4,"end_line":223,"end_character":15},"in_reply_to":"1a6eadb0_2a8b6bc4","updated":"2016-12-15 11:55:32.000000000","message":"i tried to avoid recursion to avoid the extra overhead of it since i thought this was clear enough as it is. Writing it recursively would only be worth for clarity reasons... if you still think this is not clear enough i\u0027ll go change it :)","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"5e608efd0c68c16fa412c24ede4a9804ee3f3475","unresolved":false,"context_lines":[{"line_number":220,"context_line":"    This function will search the top parent with its same cmdline. If the"},{"line_number":221,"context_line":"    given pid has no parent, its own pid will be returned"},{"line_number":222,"context_line":"    \"\"\""},{"line_number":223,"context_line":"    while True:"},{"line_number":224,"context_line":"        ppid \u003d find_parent_pid(pid)"},{"line_number":225,"context_line":"        if (ppid and ppid !\u003d pid and"},{"line_number":226,"context_line":"                pid_invoked_with_cmdline(ppid, get_cmdline_from_pid(pid))):"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_d0bc66bd","line":223,"range":{"start_line":223,"start_character":4,"end_line":223,"end_character":15},"in_reply_to":"1a6eadb0_d00b86d4","updated":"2016-12-15 12:09:12.000000000","message":"+1 for avoiding recursion","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"6bc931145489d0953b2973938abd456bd5ad87cc","unresolved":false,"context_lines":[{"line_number":234,"context_line":"    try:"},{"line_number":235,"context_line":"        execute([\u0027kill\u0027, \u0027-%d\u0027 % signal, pid], run_as_root\u003drun_as_root)"},{"line_number":236,"context_line":"    except ProcessExecutionError as ex:"},{"line_number":237,"context_line":"        if \u0027No such process\u0027 not in str(ex):"},{"line_number":238,"context_line":"            raise"},{"line_number":239,"context_line":""},{"line_number":240,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_72a2d64c","line":237,"updated":"2016-12-14 21:09:39.000000000","message":"Will this have issues with i18n ?","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"3774e1ff7b181d99019242f0371d3e5597b81809","unresolved":false,"context_lines":[{"line_number":234,"context_line":"    try:"},{"line_number":235,"context_line":"        execute([\u0027kill\u0027, \u0027-%d\u0027 % signal, pid], run_as_root\u003drun_as_root)"},{"line_number":236,"context_line":"    except ProcessExecutionError as ex:"},{"line_number":237,"context_line":"        if \u0027No such process\u0027 not in str(ex):"},{"line_number":238,"context_line":"            raise"},{"line_number":239,"context_line":""},{"line_number":240,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_67475ebc","line":237,"in_reply_to":"1a6eadb0_2de46aaa","updated":"2016-12-15 10:54:59.000000000","message":"As discussed, this code was only moved in this patch. I have added a TODO comment in PS17 so that it can be addressed later on","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"6fa7b78a7bcb15d1216b37aa02576ba527507c54","unresolved":false,"context_lines":[{"line_number":234,"context_line":"    try:"},{"line_number":235,"context_line":"        execute([\u0027kill\u0027, \u0027-%d\u0027 % signal, pid], run_as_root\u003drun_as_root)"},{"line_number":236,"context_line":"    except ProcessExecutionError as ex:"},{"line_number":237,"context_line":"        if \u0027No such process\u0027 not in str(ex):"},{"line_number":238,"context_line":"            raise"},{"line_number":239,"context_line":""},{"line_number":240,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_6aa80321","line":237,"in_reply_to":"1a6eadb0_67475ebc","updated":"2016-12-15 11:21:08.000000000","message":"+1 haleyb","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"b60e63db511ff7b031ade818656a0cabcdcf8301","unresolved":false,"context_lines":[{"line_number":234,"context_line":"    try:"},{"line_number":235,"context_line":"        execute([\u0027kill\u0027, \u0027-%d\u0027 % signal, pid], run_as_root\u003drun_as_root)"},{"line_number":236,"context_line":"    except ProcessExecutionError as ex:"},{"line_number":237,"context_line":"        if \u0027No such process\u0027 not in str(ex):"},{"line_number":238,"context_line":"            raise"},{"line_number":239,"context_line":""},{"line_number":240,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_2de46aaa","line":237,"in_reply_to":"1a6eadb0_6debc213","updated":"2016-12-15 09:59:46.000000000","message":"You could check ex.return_code \u003d\u003d 1\n\nkill 123456 ; echo $?\n-bash: kill: (123456) - No such process\n1","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"18dbf64e92d9d08ac352d4b6e60dac8941447f0c","unresolved":false,"context_lines":[{"line_number":234,"context_line":"    try:"},{"line_number":235,"context_line":"        execute([\u0027kill\u0027, \u0027-%d\u0027 % signal, pid], run_as_root\u003drun_as_root)"},{"line_number":236,"context_line":"    except ProcessExecutionError as ex:"},{"line_number":237,"context_line":"        if \u0027No such process\u0027 not in str(ex):"},{"line_number":238,"context_line":"            raise"},{"line_number":239,"context_line":""},{"line_number":240,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_6debc213","line":237,"in_reply_to":"1a6eadb0_72a2d64c","updated":"2016-12-15 09:50:52.000000000","message":"Hmmm good catch, I think we need to find a better way to detect the issue (and differenciate between a bad rootwrap filter and a non existing process)","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"8c22c87405ce8359bc8714165a64c0d84a0be302","unresolved":false,"context_lines":[{"line_number":237,"context_line":"        # TODO(dalvarez): this check has i18n issues. Maybe we can use"},{"line_number":238,"context_line":"        # use gettext module setting a global locale or just pay attention"},{"line_number":239,"context_line":"        # to returncode instead of checking the ex message."},{"line_number":240,"context_line":"        if \u0027No such process\u0027 not in str(ex):"},{"line_number":241,"context_line":"            raise"},{"line_number":242,"context_line":""},{"line_number":243,"context_line":""}],"source_content_type":"text/x-python","patch_set":19,"id":"1a6eadb0_e224d861","line":240,"range":{"start_line":240,"start_character":11,"end_line":240,"end_character":43},"updated":"2016-12-18 07:52:39.000000000","message":"Have a look at [1]. Specifically, ProcessExecutionError was added (by me) to allow one to use \"ex.returncode\" to check for failures. That\u0027s the correct solution here.\n\n[1]: https://review.openstack.org/#/c/392137/","commit_id":"5f3419013466d534ed2f5f37c528d4fc46d7e0fc"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"12eeccd5bf1ef9327d5ee4e77be403465e606beb","unresolved":false,"context_lines":[{"line_number":237,"context_line":"        # TODO(dalvarez): this check has i18n issues. Maybe we can use"},{"line_number":238,"context_line":"        # use gettext module setting a global locale or just pay attention"},{"line_number":239,"context_line":"        # to returncode instead of checking the ex message."},{"line_number":240,"context_line":"        if \u0027No such process\u0027 not in str(ex):"},{"line_number":241,"context_line":"            raise"},{"line_number":242,"context_line":""},{"line_number":243,"context_line":""}],"source_content_type":"text/x-python","patch_set":19,"id":"1a6eadb0_c4c35537","line":240,"range":{"start_line":240,"start_character":11,"end_line":240,"end_character":43},"in_reply_to":"1a6eadb0_e224d861","updated":"2016-12-19 13:42:53.000000000","message":"yes, we\u0027ve already discussed this. The thing is that returncode will be 1 for several cases (permission denied, no such process,...). Also this code is not specifically related to this patch and I only moved it. I\u0027m not against checking only returncode but we kind of agreed that this should be addressed later on in a different patch","commit_id":"5f3419013466d534ed2f5f37c528d4fc46d7e0fc"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"e008037e0d442194cabb9ffe70d7df7e38f8a2fb","unresolved":false,"context_lines":[{"line_number":190,"context_line":"    child_pids \u003d [x.strip() for x in raw_pids.split(\u0027\\n\u0027) if x.strip()]"},{"line_number":191,"context_line":"    if recursive:"},{"line_number":192,"context_line":"        for child in child_pids:"},{"line_number":193,"context_line":"            child_pids \u003d child_pids + find_child_pids(child, True)"},{"line_number":194,"context_line":"    return child_pids"},{"line_number":195,"context_line":""},{"line_number":196,"context_line":""}],"source_content_type":"text/x-python","patch_set":20,"id":"1a6eadb0_4a2ada7f","line":193,"range":{"start_line":193,"start_character":12,"end_line":193,"end_character":66},"updated":"2016-12-19 16:11:15.000000000","message":"nit: child_pids.append(find_child_pids(child, True))","commit_id":"ed1b50991ebb8211610382bea4af76cdd0f06665"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"1995e055d1af45f2d9d304d2e080df7613f7b794","unresolved":false,"context_lines":[{"line_number":190,"context_line":"    child_pids \u003d [x.strip() for x in raw_pids.split(\u0027\\n\u0027) if x.strip()]"},{"line_number":191,"context_line":"    if recursive:"},{"line_number":192,"context_line":"        for child in child_pids:"},{"line_number":193,"context_line":"            child_pids \u003d child_pids + find_child_pids(child, True)"},{"line_number":194,"context_line":"    return child_pids"},{"line_number":195,"context_line":""},{"line_number":196,"context_line":""}],"source_content_type":"text/x-python","patch_set":20,"id":"1a6eadb0_29104b4e","line":193,"range":{"start_line":193,"start_character":12,"end_line":193,"end_character":66},"in_reply_to":"1a6eadb0_45864d66","updated":"2016-12-19 16:40:14.000000000","message":"We can\u0027t do that or we would be changing the actual variable over which we\u0027re iterating","commit_id":"ed1b50991ebb8211610382bea4af76cdd0f06665"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"9792debd95d9841f461fb233af0bc449928303b2","unresolved":false,"context_lines":[{"line_number":190,"context_line":"    child_pids \u003d [x.strip() for x in raw_pids.split(\u0027\\n\u0027) if x.strip()]"},{"line_number":191,"context_line":"    if recursive:"},{"line_number":192,"context_line":"        for child in child_pids:"},{"line_number":193,"context_line":"            child_pids \u003d child_pids + find_child_pids(child, True)"},{"line_number":194,"context_line":"    return child_pids"},{"line_number":195,"context_line":""},{"line_number":196,"context_line":""}],"source_content_type":"text/x-python","patch_set":20,"id":"1a6eadb0_45864d66","line":193,"range":{"start_line":193,"start_character":12,"end_line":193,"end_character":66},"in_reply_to":"1a6eadb0_4a2ada7f","updated":"2016-12-19 16:19:35.000000000","message":"extend() is the function :)","commit_id":"ed1b50991ebb8211610382bea4af76cdd0f06665"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"31dd4feb16ff9bda49d0d107998a96b375cadef2","unresolved":false,"context_lines":[{"line_number":237,"context_line":"        # TODO(dalvarez): this check has i18n issues. Maybe we can use"},{"line_number":238,"context_line":"        # use gettext module setting a global locale or just pay attention"},{"line_number":239,"context_line":"        # to returncode instead of checking the ex message."},{"line_number":240,"context_line":"        if \u0027No such process\u0027 not in str(ex):"},{"line_number":241,"context_line":"            raise"},{"line_number":242,"context_line":""},{"line_number":243,"context_line":""}],"source_content_type":"text/x-python","patch_set":24,"id":"1a6eadb0_63033c10","line":240,"updated":"2016-12-19 18:48:44.000000000","message":"This makes me nervous for systems that might have translations for the kill error message. Translating the string ourselves doesn\u0027t help much because we don\u0027t know what the translations might be on different distros.\n\nInstead of parsing the message, can you just run a \u0027ps\u0027 right here to see if the process still exists? Then if it does, reraise.","commit_id":"eb5cb29fc0038005dee6a202cc48587cda1d11f5"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"225354f3e469abf2016547316e78248467ec7b02","unresolved":false,"context_lines":[{"line_number":237,"context_line":"        # TODO(dalvarez): this check has i18n issues. Maybe we can use"},{"line_number":238,"context_line":"        # use gettext module setting a global locale or just pay attention"},{"line_number":239,"context_line":"        # to returncode instead of checking the ex message."},{"line_number":240,"context_line":"        if \u0027No such process\u0027 not in str(ex):"},{"line_number":241,"context_line":"            raise"},{"line_number":242,"context_line":""},{"line_number":243,"context_line":""}],"source_content_type":"text/x-python","patch_set":24,"id":"1a6eadb0_ea4c589f","line":240,"in_reply_to":"1a6eadb0_62f156cd","updated":"2016-12-20 12:12:55.000000000","message":"Isn\u0027t this entire method of killing a process by pid subject to that race?i.e. a target process exits for some reason and then another starts with the same PID before we even issue the kill command on L235\n\nIf we have to worry about processes disappearing and others stealing their PID in short windows, we have to revamp our whole process killing method.","commit_id":"eb5cb29fc0038005dee6a202cc48587cda1d11f5"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"965cdda83ab73fc4a912c67ac0f5b2dc30216b3d","unresolved":false,"context_lines":[{"line_number":237,"context_line":"        # TODO(dalvarez): this check has i18n issues. Maybe we can use"},{"line_number":238,"context_line":"        # use gettext module setting a global locale or just pay attention"},{"line_number":239,"context_line":"        # to returncode instead of checking the ex message."},{"line_number":240,"context_line":"        if \u0027No such process\u0027 not in str(ex):"},{"line_number":241,"context_line":"            raise"},{"line_number":242,"context_line":""},{"line_number":243,"context_line":""}],"source_content_type":"text/x-python","patch_set":24,"id":"1a6eadb0_62f156cd","line":240,"in_reply_to":"1a6eadb0_63033c10","updated":"2016-12-20 10:29:21.000000000","message":"Hmm, what if another process spawned in the middle taking the specific pid again?\nI\u0027m suggesting daniel to move this discussion to a follow up patch now if that sounds right :)","commit_id":"eb5cb29fc0038005dee6a202cc48587cda1d11f5"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"47eca8f1ac323082d443d5a3da208aa2ddfc9433","unresolved":false,"context_lines":[{"line_number":237,"context_line":"        # TODO(dalvarez): this check has i18n issues. Maybe we can use"},{"line_number":238,"context_line":"        # use gettext module setting a global locale or just pay attention"},{"line_number":239,"context_line":"        # to returncode instead of checking the ex message."},{"line_number":240,"context_line":"        if \u0027No such process\u0027 not in str(ex):"},{"line_number":241,"context_line":"            raise"},{"line_number":242,"context_line":""},{"line_number":243,"context_line":""}],"source_content_type":"text/x-python","patch_set":24,"id":"1a6eadb0_61587857","line":240,"in_reply_to":"1a6eadb0_63033c10","updated":"2016-12-20 09:57:07.000000000","message":"Yes, he\u0027s just moving the implementation that we had here:\nhttps://review.openstack.org/#/c/402140/24/neutron/agent/linux/async_process.py@182\n\nI asked him to add a TODO and fix in a follow up, even as it was specifically unrelated to this patch.","commit_id":"eb5cb29fc0038005dee6a202cc48587cda1d11f5"}],"neutron/cmd/netns_cleanup.py":[{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"586fe0b1eac360c413e02cdbfddada105e233889","unresolved":false,"context_lines":[{"line_number":136,"context_line":"    If force is True, then dhcp (if it exists) will be disabled and all"},{"line_number":137,"context_line":"    devices will be forcibly removed."},{"line_number":138,"context_line":"    \"\"\""},{"line_number":139,"context_line":""},{"line_number":140,"context_line":"    try:"},{"line_number":141,"context_line":"        ip \u003d ip_lib.IPWrapper(namespace\u003dnamespace)"},{"line_number":142,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"5a74a57a_64d8781e","side":"PARENT","line":139,"updated":"2016-11-24 17:11:19.000000000","message":"Some people don\u0027t like this :)","commit_id":"0c706d9eb6dd937c7d2f797e707868d4f464bb09"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"36d9409622b263a38c7bc94a7b2cfbc113d28942","unresolved":false,"context_lines":[{"line_number":136,"context_line":"    If force is True, then dhcp (if it exists) will be disabled and all"},{"line_number":137,"context_line":"    devices will be forcibly removed."},{"line_number":138,"context_line":"    \"\"\""},{"line_number":139,"context_line":""},{"line_number":140,"context_line":"    try:"},{"line_number":141,"context_line":"        ip \u003d ip_lib.IPWrapper(namespace\u003dnamespace)"},{"line_number":142,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"5a74a57a_95906045","side":"PARENT","line":139,"in_reply_to":"5a74a57a_64d8781e","updated":"2016-11-24 21:51:54.000000000","message":"maybe we can raise some discussion and i can take it? or maybe another patch...","commit_id":"0c706d9eb6dd937c7d2f797e707868d4f464bb09"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"cf1bcbe5077962d05d57be46b05a86ced9e1b5cf","unresolved":false,"context_lines":[{"line_number":136,"context_line":"    If force is True, then dhcp (if it exists) will be disabled and all"},{"line_number":137,"context_line":"    devices will be forcibly removed."},{"line_number":138,"context_line":"    \"\"\""},{"line_number":139,"context_line":""},{"line_number":140,"context_line":"    try:"},{"line_number":141,"context_line":"        ip \u003d ip_lib.IPWrapper(namespace\u003dnamespace)"},{"line_number":142,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"5a74a57a_a37194e2","side":"PARENT","line":139,"in_reply_to":"5a74a57a_95906045","updated":"2016-11-25 09:26:01.000000000","message":"I think jakub means that we should not remove/modify lines if not needed, or if unrelated to the specific patch :)","commit_id":"0c706d9eb6dd937c7d2f797e707868d4f464bb09"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"4dfb5e83a8e87489ef1bcf6f2ede860ecc018b53","unresolved":false,"context_lines":[{"line_number":136,"context_line":"    If force is True, then dhcp (if it exists) will be disabled and all"},{"line_number":137,"context_line":"    devices will be forcibly removed."},{"line_number":138,"context_line":"    \"\"\""},{"line_number":139,"context_line":""},{"line_number":140,"context_line":"    try:"},{"line_number":141,"context_line":"        ip \u003d ip_lib.IPWrapper(namespace\u003dnamespace)"},{"line_number":142,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"5a74a57a_fe1ec361","side":"PARENT","line":139,"in_reply_to":"5a74a57a_a37194e2","updated":"2016-11-25 09:33:20.000000000","message":"Ups, didn\u0027t realize. I was reviewing the flake8 output and removed this line without noticing. I\u0027ll leave it as it was in my next PS, sry :)","commit_id":"0c706d9eb6dd937c7d2f797e707868d4f464bb09"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"811166bd3b844ffae6d2758f3f9c53206cb59dda","unresolved":false,"context_lines":[{"line_number":136,"context_line":"    If force is True, then dhcp (if it exists) will be disabled and all"},{"line_number":137,"context_line":"    devices will be forcibly removed."},{"line_number":138,"context_line":"    \"\"\""},{"line_number":139,"context_line":""},{"line_number":140,"context_line":"    try:"},{"line_number":141,"context_line":"        ip \u003d ip_lib.IPWrapper(namespace\u003dnamespace)"},{"line_number":142,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"5a74a57a_29ef23b1","side":"PARENT","line":139,"in_reply_to":"5a74a57a_fe1ec361","updated":"2016-11-25 10:09:02.000000000","message":"Yeah, sorry I wasn\u0027t clear enough on my first comment :) These unrelated changes cause unnecessary conflicts when backporting changes - not a big deal though :)","commit_id":"0c706d9eb6dd937c7d2f797e707868d4f464bb09"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"586fe0b1eac360c413e02cdbfddada105e233889","unresolved":false,"context_lines":[{"line_number":23,"context_line":"from oslo_log import log as logging"},{"line_number":24,"context_line":"from oslo_utils import importutils"},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"from neutron._i18n import _LE"},{"line_number":27,"context_line":"from neutron._i18n import _LW"},{"line_number":28,"context_line":"from neutron.agent.common import config as agent_config"},{"line_number":29,"context_line":"from neutron.agent.common import ovs_lib"},{"line_number":30,"context_line":"from neutron.agent.l3 import agent as l3_agent"}],"source_content_type":"text/x-python","patch_set":1,"id":"5a74a57a_44f45c85","line":27,"range":{"start_line":26,"start_character":0,"end_line":27,"end_character":29},"updated":"2016-11-24 17:11:19.000000000","message":"from neutron._i18n import _LE, _LW\n\nWe set the rules for importing objects from modules and then we break those rules :)","commit_id":"43771f5d2fc08d323508dca2bfe1b8d18d03af87"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"36d9409622b263a38c7bc94a7b2cfbc113d28942","unresolved":false,"context_lines":[{"line_number":23,"context_line":"from oslo_log import log as logging"},{"line_number":24,"context_line":"from oslo_utils import importutils"},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"from neutron._i18n import _LE"},{"line_number":27,"context_line":"from neutron._i18n import _LW"},{"line_number":28,"context_line":"from neutron.agent.common import config as agent_config"},{"line_number":29,"context_line":"from neutron.agent.common import ovs_lib"},{"line_number":30,"context_line":"from neutron.agent.l3 import agent as l3_agent"}],"source_content_type":"text/x-python","patch_set":1,"id":"5a74a57a_15229052","line":27,"range":{"start_line":26,"start_character":0,"end_line":27,"end_character":29},"in_reply_to":"5a74a57a_44f45c85","updated":"2016-11-24 21:51:54.000000000","message":"Done","commit_id":"43771f5d2fc08d323508dca2bfe1b8d18d03af87"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"586fe0b1eac360c413e02cdbfddada105e233889","unresolved":false,"context_lines":[{"line_number":141,"context_line":""},{"line_number":142,"context_line":"    ip \u003d ip_lib.IPWrapper(namespace\u003dnamespace)"},{"line_number":143,"context_line":"    pids \u003d set()"},{"line_number":144,"context_line":"    cmd \u003d [\u0027netstat\u0027, \u0027-nlp\u0027]"},{"line_number":145,"context_line":"    output \u003d ip.netns.execute(cmd, run_as_root\u003dTrue)"},{"line_number":146,"context_line":"    for line in output.splitlines()[2:]:"},{"line_number":147,"context_line":"        R \u003d re.search(r\u0027.* (?P\u003cpid\u003e\\d{2,6})/.*\u0027, line)"}],"source_content_type":"text/x-python","patch_set":1,"id":"5a74a57a_44c61c49","line":144,"range":{"start_line":144,"start_character":23,"end_line":144,"end_character":27},"updated":"2016-11-24 17:11:19.000000000","message":"Missing -u for UDP processes?","commit_id":"43771f5d2fc08d323508dca2bfe1b8d18d03af87"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"36d9409622b263a38c7bc94a7b2cfbc113d28942","unresolved":false,"context_lines":[{"line_number":141,"context_line":""},{"line_number":142,"context_line":"    ip \u003d ip_lib.IPWrapper(namespace\u003dnamespace)"},{"line_number":143,"context_line":"    pids \u003d set()"},{"line_number":144,"context_line":"    cmd \u003d [\u0027netstat\u0027, \u0027-nlp\u0027]"},{"line_number":145,"context_line":"    output \u003d ip.netns.execute(cmd, run_as_root\u003dTrue)"},{"line_number":146,"context_line":"    for line in output.splitlines()[2:]:"},{"line_number":147,"context_line":"        R \u003d re.search(r\u0027.* (?P\u003cpid\u003e\\d{2,6})/.*\u0027, line)"}],"source_content_type":"text/x-python","patch_set":1,"id":"5a74a57a_d5ac98a2","line":144,"range":{"start_line":144,"start_character":23,"end_line":144,"end_character":27},"in_reply_to":"5a74a57a_44c61c49","updated":"2016-11-24 21:51:54.000000000","message":"With -nlp I get tcp(6),udp(6) and raw(6). -u would only show udp sockets","commit_id":"43771f5d2fc08d323508dca2bfe1b8d18d03af87"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"586fe0b1eac360c413e02cdbfddada105e233889","unresolved":false,"context_lines":[{"line_number":144,"context_line":"    cmd \u003d [\u0027netstat\u0027, \u0027-nlp\u0027]"},{"line_number":145,"context_line":"    output \u003d ip.netns.execute(cmd, run_as_root\u003dTrue)"},{"line_number":146,"context_line":"    for line in output.splitlines()[2:]:"},{"line_number":147,"context_line":"        R \u003d re.search(r\u0027.* (?P\u003cpid\u003e\\d{2,6})/.*\u0027, line)"},{"line_number":148,"context_line":"        if R:"},{"line_number":149,"context_line":"            pids.add(R.group(\u0027pid\u0027))"},{"line_number":150,"context_line":"    return pids"}],"source_content_type":"text/x-python","patch_set":1,"id":"5a74a57a_649cf869","line":147,"range":{"start_line":147,"start_character":22,"end_line":147,"end_character":47},"updated":"2016-11-24 17:11:19.000000000","message":"We had some discussion in the past that expressions are past but then it turned out pre-compiled are faster. So unless you don\u0027t want to parameterise your regexp, I think it\u0027s better to use \u0027pattern \u003d re.compile()\u0027 on module level and use the patter here.","commit_id":"43771f5d2fc08d323508dca2bfe1b8d18d03af87"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"586fe0b1eac360c413e02cdbfddada105e233889","unresolved":false,"context_lines":[{"line_number":144,"context_line":"    cmd \u003d [\u0027netstat\u0027, \u0027-nlp\u0027]"},{"line_number":145,"context_line":"    output \u003d ip.netns.execute(cmd, run_as_root\u003dTrue)"},{"line_number":146,"context_line":"    for line in output.splitlines()[2:]:"},{"line_number":147,"context_line":"        R \u003d re.search(r\u0027.* (?P\u003cpid\u003e\\d{2,6})/.*\u0027, line)"},{"line_number":148,"context_line":"        if R:"},{"line_number":149,"context_line":"            pids.add(R.group(\u0027pid\u0027))"},{"line_number":150,"context_line":"    return pids"}],"source_content_type":"text/x-python","patch_set":1,"id":"5a74a57a_047ee418","line":147,"range":{"start_line":147,"start_character":8,"end_line":147,"end_character":9},"updated":"2016-11-24 17:11:19.000000000","message":"match var is usually used","commit_id":"43771f5d2fc08d323508dca2bfe1b8d18d03af87"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"586fe0b1eac360c413e02cdbfddada105e233889","unresolved":false,"context_lines":[{"line_number":150,"context_line":"    return pids"},{"line_number":151,"context_line":""},{"line_number":152,"context_line":""},{"line_number":153,"context_line":"def kill_process(pid, signal):"},{"line_number":154,"context_line":"    try:"},{"line_number":155,"context_line":"        utils.execute([\u0027kill\u0027, \u0027-%d\u0027 % signal, pid], run_as_root\u003dTrue)"},{"line_number":156,"context_line":"    except Exception as ex:"}],"source_content_type":"text/x-python","patch_set":1,"id":"5a74a57a_84b754d7","line":153,"range":{"start_line":153,"start_character":0,"end_line":153,"end_character":16},"updated":"2016-11-24 17:11:19.000000000","message":"It looks very similar to https://github.com/openstack/neutron/blob/master/neutron/agent/linux/async_process.py#L175 , maybe it will be worth to put this function to some common place and re-use it in async_process?","commit_id":"43771f5d2fc08d323508dca2bfe1b8d18d03af87"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"36d9409622b263a38c7bc94a7b2cfbc113d28942","unresolved":false,"context_lines":[{"line_number":150,"context_line":"    return pids"},{"line_number":151,"context_line":""},{"line_number":152,"context_line":""},{"line_number":153,"context_line":"def kill_process(pid, signal):"},{"line_number":154,"context_line":"    try:"},{"line_number":155,"context_line":"        utils.execute([\u0027kill\u0027, \u0027-%d\u0027 % signal, pid], run_as_root\u003dTrue)"},{"line_number":156,"context_line":"    except Exception as ex:"}],"source_content_type":"text/x-python","patch_set":1,"id":"5a74a57a_aa2172a1","line":153,"range":{"start_line":153,"start_character":0,"end_line":153,"end_character":16},"in_reply_to":"5a74a57a_84b754d7","updated":"2016-11-24 21:51:54.000000000","message":"i\u0027ve moved it to agent/linux/utils.py as you suggest","commit_id":"43771f5d2fc08d323508dca2bfe1b8d18d03af87"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"586fe0b1eac360c413e02cdbfddada105e233889","unresolved":false,"context_lines":[{"line_number":200,"context_line":"            if ip.netns.exists(namespace):"},{"line_number":201,"context_line":"                for device in ip.get_devices(exclude_loopback\u003dTrue):"},{"line_number":202,"context_line":"                    unplug_device(conf, device)"},{"line_number":203,"context_line":"                kill_listen_processes(namespace)"},{"line_number":204,"context_line":""},{"line_number":205,"context_line":"        ip.garbage_collect_namespace()"},{"line_number":206,"context_line":"    except Exception:"}],"source_content_type":"text/x-python","patch_set":1,"id":"5a74a57a_c4ff8c65","line":203,"updated":"2016-11-24 17:11:19.000000000","message":"Maybe first kill the processes and then uplug interfaces? You can steal an interface from a process that uses it.","commit_id":"43771f5d2fc08d323508dca2bfe1b8d18d03af87"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"36d9409622b263a38c7bc94a7b2cfbc113d28942","unresolved":false,"context_lines":[{"line_number":200,"context_line":"            if ip.netns.exists(namespace):"},{"line_number":201,"context_line":"                for device in ip.get_devices(exclude_loopback\u003dTrue):"},{"line_number":202,"context_line":"                    unplug_device(conf, device)"},{"line_number":203,"context_line":"                kill_listen_processes(namespace)"},{"line_number":204,"context_line":""},{"line_number":205,"context_line":"        ip.garbage_collect_namespace()"},{"line_number":206,"context_line":"    except Exception:"}],"source_content_type":"text/x-python","patch_set":1,"id":"5a74a57a_751d84bc","line":203,"in_reply_to":"5a74a57a_c4ff8c65","updated":"2016-11-24 21:51:54.000000000","message":"Done","commit_id":"43771f5d2fc08d323508dca2bfe1b8d18d03af87"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"bad0dc12036c5bccda933376b4b183f97ab271b8","unresolved":false,"context_lines":[{"line_number":136,"context_line":"    If force is True, then dhcp (if it exists) will be disabled and all"},{"line_number":137,"context_line":"    devices will be forcibly removed."},{"line_number":138,"context_line":"    \"\"\""},{"line_number":139,"context_line":""},{"line_number":140,"context_line":"    try:"},{"line_number":141,"context_line":"        ip \u003d ip_lib.IPWrapper(namespace\u003dnamespace)"},{"line_number":142,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"5a74a57a_1e1a9f6e","side":"PARENT","line":139,"updated":"2016-11-25 09:33:55.000000000","message":"Add this line back please, the change is unrelated to this specific patch :).\n\nWe avoid that for two reasons:\n\n1) You can introduce a conflict in another patch people is working on\n2) nit picking","commit_id":"0c706d9eb6dd937c7d2f797e707868d4f464bb09"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"c625a3f5740d544b9b37e31352f84214abe3b939","unresolved":false,"context_lines":[{"line_number":136,"context_line":"    If force is True, then dhcp (if it exists) will be disabled and all"},{"line_number":137,"context_line":"    devices will be forcibly removed."},{"line_number":138,"context_line":"    \"\"\""},{"line_number":139,"context_line":""},{"line_number":140,"context_line":"    try:"},{"line_number":141,"context_line":"        ip \u003d ip_lib.IPWrapper(namespace\u003dnamespace)"},{"line_number":142,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"5a74a57a_2a3eecd9","side":"PARENT","line":139,"in_reply_to":"5a74a57a_1e1a9f6e","updated":"2016-11-28 14:07:53.000000000","message":"done","commit_id":"0c706d9eb6dd937c7d2f797e707868d4f464bb09"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"bad0dc12036c5bccda933376b4b183f97ab271b8","unresolved":false,"context_lines":[{"line_number":142,"context_line":"    pids \u003d set()"},{"line_number":143,"context_line":"    cmd \u003d [\u0027netstat\u0027, \u0027-nlp\u0027]"},{"line_number":144,"context_line":"    output \u003d ip.netns.execute(cmd, run_as_root\u003dTrue)"},{"line_number":145,"context_line":"    pattern \u003d re.compile(r\u0027.* (?P\u003cpid\u003e\\d{2,6})/.*\u0027)"},{"line_number":146,"context_line":"    for line in output.splitlines()[2:]:"},{"line_number":147,"context_line":"        m \u003d pattern.match(line)"},{"line_number":148,"context_line":"        if m:"}],"source_content_type":"text/x-python","patch_set":2,"id":"5a74a57a_9ea94fe2","line":145,"updated":"2016-11-25 09:33:55.000000000","message":"this is mostly nitpick, but, we generally (specially if this function was invoked lots of times, which is not the case) put the compiled patterns at top level of the module with constants\n\nNETSTAT_PIDS_REGEX \u003d re.compile( .....) \n\nSo we don\u0027t compile it several times.\n\nHere it\u0027s really not important, but you just keep it as an example for those who won\u0027t think about cpu cycles and speed on places where it\u0027ll be important.\n\n(some history: we had some very ugly bugs of very slow processes because people was compiling and compiling regexes in a busy inner loop)","commit_id":"dc9127c8d41a57dc9288780f3519fe993ce4976d"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"c625a3f5740d544b9b37e31352f84214abe3b939","unresolved":false,"context_lines":[{"line_number":142,"context_line":"    pids \u003d set()"},{"line_number":143,"context_line":"    cmd \u003d [\u0027netstat\u0027, \u0027-nlp\u0027]"},{"line_number":144,"context_line":"    output \u003d ip.netns.execute(cmd, run_as_root\u003dTrue)"},{"line_number":145,"context_line":"    pattern \u003d re.compile(r\u0027.* (?P\u003cpid\u003e\\d{2,6})/.*\u0027)"},{"line_number":146,"context_line":"    for line in output.splitlines()[2:]:"},{"line_number":147,"context_line":"        m \u003d pattern.match(line)"},{"line_number":148,"context_line":"        if m:"}],"source_content_type":"text/x-python","patch_set":2,"id":"5a74a57a_c5380ba3","line":145,"in_reply_to":"5a74a57a_9ea94fe2","updated":"2016-11-28 14:07:53.000000000","message":"understood, thanks! :)","commit_id":"dc9127c8d41a57dc9288780f3519fe993ce4976d"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"bad0dc12036c5bccda933376b4b183f97ab271b8","unresolved":false,"context_lines":[{"line_number":157,"context_line":"                   {\u0027signal\u0027: signal,"},{"line_number":158,"context_line":"                    \u0027pid\u0027: pid,"},{"line_number":159,"context_line":"                    \u0027cmdline\u0027: \u0027 \u0027.join(utils.get_cmdline_from_pid(pid))[:80]})"},{"line_number":160,"context_line":"        utils.kill_process(pid, signal, run_as_root\u003dTrue)"},{"line_number":161,"context_line":"    return bool(pids)"},{"line_number":162,"context_line":""},{"line_number":163,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"5a74a57a_1eb61f3d","line":160,"updated":"2016-11-25 09:33:55.000000000","message":"I repeat myself as a proper garlic: Can we put the warning message that you had in previous PS inside the utils.kill_process ?  :)","commit_id":"dc9127c8d41a57dc9288780f3519fe993ce4976d"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"c625a3f5740d544b9b37e31352f84214abe3b939","unresolved":false,"context_lines":[{"line_number":157,"context_line":"                   {\u0027signal\u0027: signal,"},{"line_number":158,"context_line":"                    \u0027pid\u0027: pid,"},{"line_number":159,"context_line":"                    \u0027cmdline\u0027: \u0027 \u0027.join(utils.get_cmdline_from_pid(pid))[:80]})"},{"line_number":160,"context_line":"        utils.kill_process(pid, signal, run_as_root\u003dTrue)"},{"line_number":161,"context_line":"    return bool(pids)"},{"line_number":162,"context_line":""},{"line_number":163,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"5a74a57a_6539f7d6","line":160,"in_reply_to":"5a74a57a_1eb61f3d","updated":"2016-11-28 14:07:53.000000000","message":"done","commit_id":"dc9127c8d41a57dc9288780f3519fe993ce4976d"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"cf9406e8337510e5c9c0490b05ed2eaca0584783","unresolved":false,"context_lines":[{"line_number":165,"context_line":"        pids_to_kill \u003d parents"},{"line_number":166,"context_line":"        s \u003d signal.SIGTERM"},{"line_number":167,"context_line":"    for pid in pids_to_kill:"},{"line_number":168,"context_line":"        LOG.warning(_LW(\"Killing (%(signal)d) [%(pid)s] %(cmdline)s\"),"},{"line_number":169,"context_line":"                   {\u0027signal\u0027: s,"},{"line_number":170,"context_line":"                    \u0027pid\u0027: pid,"},{"line_number":171,"context_line":"                    \u0027cmdline\u0027: \u0027 \u0027.join(utils.get_cmdline_from_pid(pid))[:80]})"}],"source_content_type":"text/x-python","patch_set":3,"id":"5a74a57a_3b58f255","line":168,"updated":"2016-11-28 20:09:54.000000000","message":"Why warning level?","commit_id":"bbc98b9957be36ae098452fbb08479ea602e2a9c"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"553be7118cb876f9c7e6fbc8f8c03bebf3f3f58f","unresolved":false,"context_lines":[{"line_number":165,"context_line":"        pids_to_kill \u003d parents"},{"line_number":166,"context_line":"        s \u003d signal.SIGTERM"},{"line_number":167,"context_line":"    for pid in pids_to_kill:"},{"line_number":168,"context_line":"        LOG.warning(_LW(\"Killing (%(signal)d) [%(pid)s] %(cmdline)s\"),"},{"line_number":169,"context_line":"                   {\u0027signal\u0027: s,"},{"line_number":170,"context_line":"                    \u0027pid\u0027: pid,"},{"line_number":171,"context_line":"                    \u0027cmdline\u0027: \u0027 \u0027.join(utils.get_cmdline_from_pid(pid))[:80]})"}],"source_content_type":"text/x-python","patch_set":3,"id":"5a74a57a_7f7a3625","line":168,"in_reply_to":"5a74a57a_3b58f255","updated":"2016-11-29 11:03:18.000000000","message":"This is because processes being killed here should have their specific cleanup somewhere else and this log would alert of it.","commit_id":"bbc98b9957be36ae098452fbb08479ea602e2a9c"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"cf9406e8337510e5c9c0490b05ed2eaca0584783","unresolved":false,"context_lines":[{"line_number":180,"context_line":"    First it tries to kill them using SIGTERM, wait for a while and then kills"},{"line_number":181,"context_line":"    remaining processes with SIGKILL"},{"line_number":182,"context_line":"    \"\"\""},{"line_number":183,"context_line":"    if _kill_listen_processes(namespace, force\u003dFalse):"},{"line_number":184,"context_line":"        time.sleep(SIGTERM_WAITTIME)"},{"line_number":185,"context_line":"        _kill_listen_processes(namespace, force\u003dTrue)"},{"line_number":186,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"5a74a57a_1b50950a","line":183,"updated":"2016-11-28 20:09:54.000000000","message":"Why are you not just trying KILL if there was an exception thrown?  Or is the assumption that something could have ignored the signal and it\u0027s still running?","commit_id":"bbc98b9957be36ae098452fbb08479ea602e2a9c"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"553be7118cb876f9c7e6fbc8f8c03bebf3f3f58f","unresolved":false,"context_lines":[{"line_number":180,"context_line":"    First it tries to kill them using SIGTERM, wait for a while and then kills"},{"line_number":181,"context_line":"    remaining processes with SIGKILL"},{"line_number":182,"context_line":"    \"\"\""},{"line_number":183,"context_line":"    if _kill_listen_processes(namespace, force\u003dFalse):"},{"line_number":184,"context_line":"        time.sleep(SIGTERM_WAITTIME)"},{"line_number":185,"context_line":"        _kill_listen_processes(namespace, force\u003dTrue)"},{"line_number":186,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"5a74a57a_df06ea84","line":183,"in_reply_to":"5a74a57a_1b50950a","updated":"2016-11-29 11:03:18.000000000","message":"the current approach would send a SIGTERM to listening processes (or to their parents if they were forked) expecting that they die properly, closing files, etc. and also killing their children. If after a few seconds, they\u0027re still alive (e.g. because they ignored the SIGTERM signal), then I\u0027ll issue a SIGKILL","commit_id":"bbc98b9957be36ae098452fbb08479ea602e2a9c"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"46393a377c93dfd6e4b1554003a64d773a41a813","unresolved":false,"context_lines":[{"line_number":157,"context_line":"    # SIGKILL will be issued to all parents and all their children"},{"line_number":158,"context_line":"    pids \u003d find_listen_pids_namespace(namespace)"},{"line_number":159,"context_line":"    parents \u003d [utils.find_fork_top_parent(pid) for pid in pids]"},{"line_number":160,"context_line":"    if force is True:"},{"line_number":161,"context_line":"        children \u003d [utils.find_child_pids(pid) for pid in parents]"},{"line_number":162,"context_line":"        pids_to_kill \u003d parents + list(itertools.chain.from_iterable(children))"},{"line_number":163,"context_line":"        s \u003d signal.SIGKILL"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a74a57a_a8b3b14b","line":160,"range":{"start_line":160,"start_character":4,"end_line":160,"end_character":20},"updated":"2016-11-29 12:19:34.000000000","message":"if force:","commit_id":"b9f3a1e12345bcd34be880a3c9448fdfecadcf00"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"d09753ca483bfe6963e89536959ada3faef05ada","unresolved":false,"context_lines":[{"line_number":157,"context_line":"    # SIGKILL will be issued to all parents and all their children"},{"line_number":158,"context_line":"    pids \u003d find_listen_pids_namespace(namespace)"},{"line_number":159,"context_line":"    parents \u003d [utils.find_fork_top_parent(pid) for pid in pids]"},{"line_number":160,"context_line":"    if force is True:"},{"line_number":161,"context_line":"        children \u003d [utils.find_child_pids(pid) for pid in parents]"},{"line_number":162,"context_line":"        pids_to_kill \u003d parents + list(itertools.chain.from_iterable(children))"},{"line_number":163,"context_line":"        s \u003d signal.SIGKILL"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a74a57a_2157b758","line":160,"range":{"start_line":160,"start_character":4,"end_line":160,"end_character":20},"in_reply_to":"5a74a57a_a8b3b14b","updated":"2016-11-29 14:52:36.000000000","message":"Done","commit_id":"b9f3a1e12345bcd34be880a3c9448fdfecadcf00"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"46393a377c93dfd6e4b1554003a64d773a41a813","unresolved":false,"context_lines":[{"line_number":159,"context_line":"    parents \u003d [utils.find_fork_top_parent(pid) for pid in pids]"},{"line_number":160,"context_line":"    if force is True:"},{"line_number":161,"context_line":"        children \u003d [utils.find_child_pids(pid) for pid in parents]"},{"line_number":162,"context_line":"        pids_to_kill \u003d parents + list(itertools.chain.from_iterable(children))"},{"line_number":163,"context_line":"        s \u003d signal.SIGKILL"},{"line_number":164,"context_line":"    else:"},{"line_number":165,"context_line":"        pids_to_kill \u003d parents"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a74a57a_08aae584","line":162,"range":{"start_line":162,"start_character":33,"end_line":162,"end_character":78},"updated":"2016-11-29 12:19:34.000000000","message":"Why not just \u0027children\u0027 ?","commit_id":"b9f3a1e12345bcd34be880a3c9448fdfecadcf00"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"d09753ca483bfe6963e89536959ada3faef05ada","unresolved":false,"context_lines":[{"line_number":159,"context_line":"    parents \u003d [utils.find_fork_top_parent(pid) for pid in pids]"},{"line_number":160,"context_line":"    if force is True:"},{"line_number":161,"context_line":"        children \u003d [utils.find_child_pids(pid) for pid in parents]"},{"line_number":162,"context_line":"        pids_to_kill \u003d parents + list(itertools.chain.from_iterable(children))"},{"line_number":163,"context_line":"        s \u003d signal.SIGKILL"},{"line_number":164,"context_line":"    else:"},{"line_number":165,"context_line":"        pids_to_kill \u003d parents"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a74a57a_81524b33","line":162,"range":{"start_line":162,"start_character":33,"end_line":162,"end_character":78},"in_reply_to":"5a74a57a_08aae584","updated":"2016-11-29 14:52:36.000000000","message":"children is a list of lists. Each list includes all the pids that are children of each parent process","commit_id":"b9f3a1e12345bcd34be880a3c9448fdfecadcf00"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"e38d951110b7e40d4a70a0fa23cdd8dbbf842ce7","unresolved":false,"context_lines":[{"line_number":160,"context_line":"    if force is True:"},{"line_number":161,"context_line":"        children \u003d [utils.find_child_pids(pid) for pid in parents]"},{"line_number":162,"context_line":"        pids_to_kill \u003d parents + list(itertools.chain.from_iterable(children))"},{"line_number":163,"context_line":"        s \u003d signal.SIGKILL"},{"line_number":164,"context_line":"    else:"},{"line_number":165,"context_line":"        pids_to_kill \u003d parents"},{"line_number":166,"context_line":"        s \u003d signal.SIGTERM"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a74a57a_1f594135","line":163,"updated":"2016-11-29 11:08:55.000000000","message":"some reviewers kill kittens when people use single var variables ( I guess you did it to avoid clash with signal module). \n\nI won\u0027t kill a cat, but may be using _signal or something like that is more welcomed, I won\u0027t -1 for this, just nitpicking suggestion","commit_id":"b9f3a1e12345bcd34be880a3c9448fdfecadcf00"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"5ad80c1af5ed720b807536522f38c0c522f4556f","unresolved":false,"context_lines":[{"line_number":160,"context_line":"    if force is True:"},{"line_number":161,"context_line":"        children \u003d [utils.find_child_pids(pid) for pid in parents]"},{"line_number":162,"context_line":"        pids_to_kill \u003d parents + list(itertools.chain.from_iterable(children))"},{"line_number":163,"context_line":"        s \u003d signal.SIGKILL"},{"line_number":164,"context_line":"    else:"},{"line_number":165,"context_line":"        pids_to_kill \u003d parents"},{"line_number":166,"context_line":"        s \u003d signal.SIGTERM"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a74a57a_bf604da6","line":163,"in_reply_to":"5a74a57a_1f594135","updated":"2016-11-29 11:11:27.000000000","message":"sure! thanks for that :) i\u0027ll change it in my next PS","commit_id":"b9f3a1e12345bcd34be880a3c9448fdfecadcf00"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"d09753ca483bfe6963e89536959ada3faef05ada","unresolved":false,"context_lines":[{"line_number":160,"context_line":"    if force is True:"},{"line_number":161,"context_line":"        children \u003d [utils.find_child_pids(pid) for pid in parents]"},{"line_number":162,"context_line":"        pids_to_kill \u003d parents + list(itertools.chain.from_iterable(children))"},{"line_number":163,"context_line":"        s \u003d signal.SIGKILL"},{"line_number":164,"context_line":"    else:"},{"line_number":165,"context_line":"        pids_to_kill \u003d parents"},{"line_number":166,"context_line":"        s \u003d signal.SIGTERM"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a74a57a_e1393ff3","line":163,"in_reply_to":"5a74a57a_450f6836","updated":"2016-11-29 14:52:36.000000000","message":"Done","commit_id":"b9f3a1e12345bcd34be880a3c9448fdfecadcf00"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"46393a377c93dfd6e4b1554003a64d773a41a813","unresolved":false,"context_lines":[{"line_number":160,"context_line":"    if force is True:"},{"line_number":161,"context_line":"        children \u003d [utils.find_child_pids(pid) for pid in parents]"},{"line_number":162,"context_line":"        pids_to_kill \u003d parents + list(itertools.chain.from_iterable(children))"},{"line_number":163,"context_line":"        s \u003d signal.SIGKILL"},{"line_number":164,"context_line":"    else:"},{"line_number":165,"context_line":"        pids_to_kill \u003d parents"},{"line_number":166,"context_line":"        s \u003d signal.SIGTERM"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a74a57a_450f6836","line":163,"in_reply_to":"5a74a57a_bf604da6","updated":"2016-11-29 12:19:34.000000000","message":"+1, I\u0027d kill a kitten :) you can use kill_signal as in previous code.","commit_id":"b9f3a1e12345bcd34be880a3c9448fdfecadcf00"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"46393a377c93dfd6e4b1554003a64d773a41a813","unresolved":false,"context_lines":[{"line_number":166,"context_line":"        s \u003d signal.SIGTERM"},{"line_number":167,"context_line":"    for pid in pids_to_kill:"},{"line_number":168,"context_line":"        LOG.warning(_LW(\"Killing (%(signal)d) [%(pid)s] %(cmdline)s\"),"},{"line_number":169,"context_line":"                   {\u0027signal\u0027: s,"},{"line_number":170,"context_line":"                    \u0027pid\u0027: pid,"},{"line_number":171,"context_line":"                    \u0027cmdline\u0027: \u0027 \u0027.join(utils.get_cmdline_from_pid(pid))[:80]})"},{"line_number":172,"context_line":"        utils.kill_process(pid, s, run_as_root\u003dTrue)"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a74a57a_a8e1f12b","line":169,"updated":"2016-11-29 12:19:34.000000000","message":"Indentation, I\u0027m surprised pep8 job doesn\u0027t complain","commit_id":"b9f3a1e12345bcd34be880a3c9448fdfecadcf00"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"d09753ca483bfe6963e89536959ada3faef05ada","unresolved":false,"context_lines":[{"line_number":166,"context_line":"        s \u003d signal.SIGTERM"},{"line_number":167,"context_line":"    for pid in pids_to_kill:"},{"line_number":168,"context_line":"        LOG.warning(_LW(\"Killing (%(signal)d) [%(pid)s] %(cmdline)s\"),"},{"line_number":169,"context_line":"                   {\u0027signal\u0027: s,"},{"line_number":170,"context_line":"                    \u0027pid\u0027: pid,"},{"line_number":171,"context_line":"                    \u0027cmdline\u0027: \u0027 \u0027.join(utils.get_cmdline_from_pid(pid))[:80]})"},{"line_number":172,"context_line":"        utils.kill_process(pid, s, run_as_root\u003dTrue)"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a74a57a_21289799","line":169,"in_reply_to":"5a74a57a_a8e1f12b","updated":"2016-11-29 14:52:36.000000000","message":"Done","commit_id":"b9f3a1e12345bcd34be880a3c9448fdfecadcf00"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"7d20ab098a93eb97acfd5a6b9a3a43dd3e0aa1d4","unresolved":false,"context_lines":[{"line_number":169,"context_line":"                   {\u0027signal\u0027: s,"},{"line_number":170,"context_line":"                    \u0027pid\u0027: pid,"},{"line_number":171,"context_line":"                    \u0027cmdline\u0027: \u0027 \u0027.join(utils.get_cmdline_from_pid(pid))[:80]})"},{"line_number":172,"context_line":"        utils.kill_process(pid, s, run_as_root\u003dTrue)"},{"line_number":173,"context_line":"    return bool(pids)"},{"line_number":174,"context_line":""},{"line_number":175,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"5a74a57a_88b8b012","line":172,"range":{"start_line":172,"start_character":8,"end_line":172,"end_character":52},"updated":"2016-11-29 13:47:36.000000000","message":"We should catch and exception here in case we get a failure, so it won\u0027t break other processes from being killed.","commit_id":"b9f3a1e12345bcd34be880a3c9448fdfecadcf00"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"46393a377c93dfd6e4b1554003a64d773a41a813","unresolved":false,"context_lines":[{"line_number":176,"context_line":"def kill_listen_processes(namespace):"},{"line_number":177,"context_line":"    \"\"\"Kill all processes listening within the given namespace."},{"line_number":178,"context_line":""},{"line_number":179,"context_line":"    First it tries to kill them using SIGTERM, wait for a while and then kills"},{"line_number":180,"context_line":"    remaining processes with SIGKILL"},{"line_number":181,"context_line":"    \"\"\""},{"line_number":182,"context_line":"    if _kill_listen_processes(namespace, force\u003dFalse):"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a74a57a_48fcddb7","line":179,"range":{"start_line":179,"start_character":56,"end_line":179,"end_character":63},"updated":"2016-11-29 12:19:34.000000000","message":"5 seconds","commit_id":"b9f3a1e12345bcd34be880a3c9448fdfecadcf00"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"d09753ca483bfe6963e89536959ada3faef05ada","unresolved":false,"context_lines":[{"line_number":176,"context_line":"def kill_listen_processes(namespace):"},{"line_number":177,"context_line":"    \"\"\"Kill all processes listening within the given namespace."},{"line_number":178,"context_line":""},{"line_number":179,"context_line":"    First it tries to kill them using SIGTERM, wait for a while and then kills"},{"line_number":180,"context_line":"    remaining processes with SIGKILL"},{"line_number":181,"context_line":"    \"\"\""},{"line_number":182,"context_line":"    if _kill_listen_processes(namespace, force\u003dFalse):"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a74a57a_4123d3bc","line":179,"range":{"start_line":179,"start_character":56,"end_line":179,"end_character":63},"in_reply_to":"5a74a57a_48fcddb7","updated":"2016-11-29 14:52:36.000000000","message":"Done","commit_id":"b9f3a1e12345bcd34be880a3c9448fdfecadcf00"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"46393a377c93dfd6e4b1554003a64d773a41a813","unresolved":false,"context_lines":[{"line_number":179,"context_line":"    First it tries to kill them using SIGTERM, wait for a while and then kills"},{"line_number":180,"context_line":"    remaining processes with SIGKILL"},{"line_number":181,"context_line":"    \"\"\""},{"line_number":182,"context_line":"    if _kill_listen_processes(namespace, force\u003dFalse):"},{"line_number":183,"context_line":"        time.sleep(SIGTERM_WAITTIME)"},{"line_number":184,"context_line":"        _kill_listen_processes(namespace, force\u003dTrue)"},{"line_number":185,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"5a74a57a_68e51907","line":182,"range":{"start_line":182,"start_character":0,"end_line":182,"end_character":54},"updated":"2016-11-29 12:19:34.000000000","message":"This has a side-effect, if there is no running process in namespace, then it attempts to kill nothing with force.","commit_id":"b9f3a1e12345bcd34be880a3c9448fdfecadcf00"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"ae1152cbb5831266d3918dfe38b7268947dd4838","unresolved":false,"context_lines":[{"line_number":179,"context_line":"    First it tries to kill them using SIGTERM, wait for a while and then kills"},{"line_number":180,"context_line":"    remaining processes with SIGKILL"},{"line_number":181,"context_line":"    \"\"\""},{"line_number":182,"context_line":"    if _kill_listen_processes(namespace, force\u003dFalse):"},{"line_number":183,"context_line":"        time.sleep(SIGTERM_WAITTIME)"},{"line_number":184,"context_line":"        _kill_listen_processes(namespace, force\u003dTrue)"},{"line_number":185,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"5a74a57a_744894cc","line":182,"range":{"start_line":182,"start_character":0,"end_line":182,"end_character":54},"in_reply_to":"5a74a57a_68e51907","updated":"2016-11-29 13:36:06.000000000","message":"But if there\u0027s no pid to kill, why would you want to force kill anything? :?","commit_id":"b9f3a1e12345bcd34be880a3c9448fdfecadcf00"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"7d20ab098a93eb97acfd5a6b9a3a43dd3e0aa1d4","unresolved":false,"context_lines":[{"line_number":179,"context_line":"    First it tries to kill them using SIGTERM, wait for a while and then kills"},{"line_number":180,"context_line":"    remaining processes with SIGKILL"},{"line_number":181,"context_line":"    \"\"\""},{"line_number":182,"context_line":"    if _kill_listen_processes(namespace, force\u003dFalse):"},{"line_number":183,"context_line":"        time.sleep(SIGTERM_WAITTIME)"},{"line_number":184,"context_line":"        _kill_listen_processes(namespace, force\u003dTrue)"},{"line_number":185,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"5a74a57a_68b8b42a","line":182,"range":{"start_line":182,"start_character":0,"end_line":182,"end_character":54},"in_reply_to":"5a74a57a_68e51907","updated":"2016-11-29 13:47:36.000000000","message":"I think I was wrong, sorry. So it attempts to sigkill only when there were some processes in the namespace, right?","commit_id":"b9f3a1e12345bcd34be880a3c9448fdfecadcf00"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"d09753ca483bfe6963e89536959ada3faef05ada","unresolved":false,"context_lines":[{"line_number":179,"context_line":"    First it tries to kill them using SIGTERM, wait for a while and then kills"},{"line_number":180,"context_line":"    remaining processes with SIGKILL"},{"line_number":181,"context_line":"    \"\"\""},{"line_number":182,"context_line":"    if _kill_listen_processes(namespace, force\u003dFalse):"},{"line_number":183,"context_line":"        time.sleep(SIGTERM_WAITTIME)"},{"line_number":184,"context_line":"        _kill_listen_processes(namespace, force\u003dTrue)"},{"line_number":185,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"5a74a57a_9c4f126a","line":182,"range":{"start_line":182,"start_character":0,"end_line":182,"end_character":54},"in_reply_to":"5a74a57a_68e51907","updated":"2016-11-29 14:52:36.000000000","message":"I took that side-effect into account by returning bool(pids) in the _kill_listen_processes. If there were no processes to kill, then it neither won\u0027t wait nor attempt to perform the second call to it.","commit_id":"b9f3a1e12345bcd34be880a3c9448fdfecadcf00"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"476c1b19f146f63c891f5dc7b75afd0858d07d14","unresolved":false,"context_lines":[{"line_number":158,"context_line":"    pids \u003d find_listen_pids_namespace(namespace)"},{"line_number":159,"context_line":"    parents \u003d [utils.find_fork_top_parent(pid) for pid in pids]"},{"line_number":160,"context_line":"    if force:"},{"line_number":161,"context_line":"        children \u003d [utils.find_child_pids(pid, True) for pid in parents]"},{"line_number":162,"context_line":"        pids_to_kill \u003d parents + list(itertools.chain.from_iterable(children))"},{"line_number":163,"context_line":"        kill_signal \u003d signal.SIGKILL"},{"line_number":164,"context_line":"    else:"},{"line_number":165,"context_line":"        pids_to_kill \u003d parents"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_a391c154","line":162,"range":{"start_line":161,"start_character":0,"end_line":162,"end_character":78},"updated":"2016-12-02 10:12:23.000000000","message":"Since we don\u0027t actually need the children, would following be more readable?\n\n pids_to_kill \u003d []\n for pid in parents:\n     pids_to_kill +\u003d utils.find_child_pids(pid, recursive\u003dTrue)\n\nsimilar to https://review.openstack.org/#/c/402140/6/neutron/agent/linux/utils.py@192","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"3a031d9a8b2f97e0a57f6071619139c8400b6faa","unresolved":false,"context_lines":[{"line_number":158,"context_line":"    pids \u003d find_listen_pids_namespace(namespace)"},{"line_number":159,"context_line":"    parents \u003d [utils.find_fork_top_parent(pid) for pid in pids]"},{"line_number":160,"context_line":"    if force:"},{"line_number":161,"context_line":"        children \u003d [utils.find_child_pids(pid, True) for pid in parents]"},{"line_number":162,"context_line":"        pids_to_kill \u003d parents + list(itertools.chain.from_iterable(children))"},{"line_number":163,"context_line":"        kill_signal \u003d signal.SIGKILL"},{"line_number":164,"context_line":"    else:"},{"line_number":165,"context_line":"        pids_to_kill \u003d parents"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_feb5d830","line":162,"range":{"start_line":161,"start_character":0,"end_line":162,"end_character":78},"in_reply_to":"3a71b18c_a391c154","updated":"2016-12-04 19:51:17.000000000","message":"children is a list of lists, that\u0027s why we need to \u0027unpack\u0027 it with the itertools call. e.g.\n(Pdb) children\n[[\u00274\u0027], [\u00275\u0027], [\u00276\u0027, \u00278\u0027, \u00277\u0027]]\n(Pdb) parents\n[\u00271\u0027, \u00272\u0027, \u00273\u0027]\n(Pdb) parents + children\n[\u00271\u0027, \u00272\u0027, \u00273\u0027, [\u00274\u0027], [\u00275\u0027], [\u00276\u0027, \u00278\u0027, \u00277\u0027]]\n(Pdb) parents + list(itertools.chain.from_iterable(children))\n[\u00271\u0027, \u00272\u0027, \u00273\u0027, \u00274\u0027, \u00275\u0027, \u00276\u0027, \u00278\u0027, \u00277\u0027]\n\nThe resulting list contains all the pids we need to try to kill next","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"a746350a3ee3cd9f1cdb1130b41f44f9e0c92c92","unresolved":false,"context_lines":[{"line_number":158,"context_line":"    pids \u003d find_listen_pids_namespace(namespace)"},{"line_number":159,"context_line":"    parents \u003d [utils.find_fork_top_parent(pid) for pid in pids]"},{"line_number":160,"context_line":"    if force:"},{"line_number":161,"context_line":"        children \u003d [utils.find_child_pids(pid, True) for pid in parents]"},{"line_number":162,"context_line":"        pids_to_kill \u003d parents + list(itertools.chain.from_iterable(children))"},{"line_number":163,"context_line":"        kill_signal \u003d signal.SIGKILL"},{"line_number":164,"context_line":"    else:"},{"line_number":165,"context_line":"        pids_to_kill \u003d parents"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_f9b608db","line":162,"range":{"start_line":161,"start_character":0,"end_line":162,"end_character":78},"in_reply_to":"3a71b18c_a391c154","updated":"2016-12-02 10:31:32.000000000","message":"wouldn\u0027t there we neeed to start with pids_to_kill \u003d parents\n\ndon\u0027t we need both in the force case? :?\n\nso:\n\npids_to_kill \u003d parents\nfor pid in parents:\n    pids_to_kill +\u003d utils.find_child_pids(pid, recursive\u003dTrue)","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"3a031d9a8b2f97e0a57f6071619139c8400b6faa","unresolved":false,"context_lines":[{"line_number":158,"context_line":"    pids \u003d find_listen_pids_namespace(namespace)"},{"line_number":159,"context_line":"    parents \u003d [utils.find_fork_top_parent(pid) for pid in pids]"},{"line_number":160,"context_line":"    if force:"},{"line_number":161,"context_line":"        children \u003d [utils.find_child_pids(pid, True) for pid in parents]"},{"line_number":162,"context_line":"        pids_to_kill \u003d parents + list(itertools.chain.from_iterable(children))"},{"line_number":163,"context_line":"        kill_signal \u003d signal.SIGKILL"},{"line_number":164,"context_line":"    else:"},{"line_number":165,"context_line":"        pids_to_kill \u003d parents"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_5e7dec6c","line":162,"range":{"start_line":161,"start_character":0,"end_line":162,"end_character":78},"in_reply_to":"3a71b18c_f9b608db","updated":"2016-12-04 19:51:17.000000000","message":"see my reply to jakub but otherwise you\u0027re right i guess. thanks :)","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"476c1b19f146f63c891f5dc7b75afd0858d07d14","unresolved":false,"context_lines":[{"line_number":174,"context_line":"        try:"},{"line_number":175,"context_line":"            utils.kill_process(pid, kill_signal, run_as_root\u003dTrue)"},{"line_number":176,"context_line":"        except Exception:"},{"line_number":177,"context_line":"            LOG.exception(_LE(\u0027An error occurred while killing [%s].\u0027), pid)"},{"line_number":178,"context_line":"    return bool(pids)"},{"line_number":179,"context_line":""},{"line_number":180,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_8355a551","line":177,"range":{"start_line":177,"start_character":16,"end_line":177,"end_character":25},"updated":"2016-12-02 10:12:23.000000000","message":"Opinion: Do we need the trace? Maybe error with exception message will be sufficient.","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"3a031d9a8b2f97e0a57f6071619139c8400b6faa","unresolved":false,"context_lines":[{"line_number":174,"context_line":"        try:"},{"line_number":175,"context_line":"            utils.kill_process(pid, kill_signal, run_as_root\u003dTrue)"},{"line_number":176,"context_line":"        except Exception:"},{"line_number":177,"context_line":"            LOG.exception(_LE(\u0027An error occurred while killing [%s].\u0027), pid)"},{"line_number":178,"context_line":"    return bool(pids)"},{"line_number":179,"context_line":""},{"line_number":180,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_6345b36e","line":177,"range":{"start_line":177,"start_character":16,"end_line":177,"end_character":25},"in_reply_to":"3a71b18c_8355a551","updated":"2016-12-04 19:51:17.000000000","message":"Done","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"d120739a779c265a9ebf16ccf5a72608325a9f89","unresolved":false,"context_lines":[{"line_number":144,"context_line":"    cmd \u003d [\u0027netstat\u0027, \u0027-nlp\u0027]"},{"line_number":145,"context_line":"    output \u003d ip.netns.execute(cmd, run_as_root\u003dTrue)"},{"line_number":146,"context_line":"    for line in output.splitlines()[2:]:"},{"line_number":147,"context_line":"        m \u003d re.match(NETSTAT_PIDS_REGEX, line)"},{"line_number":148,"context_line":"        if m:"},{"line_number":149,"context_line":"            pids.add(m.group(\u0027pid\u0027))"},{"line_number":150,"context_line":"    return pids"}],"source_content_type":"text/x-python","patch_set":13,"id":"1a6eadb0_43656d43","line":147,"range":{"start_line":147,"start_character":12,"end_line":147,"end_character":46},"updated":"2016-12-13 10:47:16.000000000","message":"NETSTAT_PIDS_REGEX.match(line)","commit_id":"7057de2d829dbfef7c74aea617724d068a8ba7ae"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"10b8c9436a23cfc617439a346457dcaf8f1be9ac","unresolved":false,"context_lines":[{"line_number":144,"context_line":"    cmd \u003d [\u0027netstat\u0027, \u0027-nlp\u0027]"},{"line_number":145,"context_line":"    output \u003d ip.netns.execute(cmd, run_as_root\u003dTrue)"},{"line_number":146,"context_line":"    for line in output.splitlines()[2:]:"},{"line_number":147,"context_line":"        m \u003d re.match(NETSTAT_PIDS_REGEX, line)"},{"line_number":148,"context_line":"        if m:"},{"line_number":149,"context_line":"            pids.add(m.group(\u0027pid\u0027))"},{"line_number":150,"context_line":"    return pids"}],"source_content_type":"text/x-python","patch_set":13,"id":"1a6eadb0_af68e0bb","line":147,"range":{"start_line":147,"start_character":12,"end_line":147,"end_character":46},"in_reply_to":"1a6eadb0_43656d43","updated":"2016-12-13 11:50:29.000000000","message":"Done","commit_id":"7057de2d829dbfef7c74aea617724d068a8ba7ae"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"d120739a779c265a9ebf16ccf5a72608325a9f89","unresolved":false,"context_lines":[{"line_number":156,"context_line":"    # forked) and issue a SIGTERM to all of them. If force is True, then a"},{"line_number":157,"context_line":"    # SIGKILL will be issued to all parents and all their children"},{"line_number":158,"context_line":"    pids \u003d find_listen_pids_namespace(namespace)"},{"line_number":159,"context_line":"    parents \u003d list(set([utils.find_fork_top_parent(pid) for pid in pids]))"},{"line_number":160,"context_line":"    if force:"},{"line_number":161,"context_line":"        children \u003d [utils.find_child_pids(pid, True) for pid in parents]"},{"line_number":162,"context_line":"        pids_to_kill \u003d parents + list(itertools.chain.from_iterable(children))"}],"source_content_type":"text/x-python","patch_set":13,"id":"1a6eadb0_b65bdd53","line":159,"range":{"start_line":159,"start_character":14,"end_line":159,"end_character":74},"updated":"2016-12-13 10:47:16.000000000","message":"Nit: Instead of using list comprehension, re-type it to set and retype it to list, you can use set-comprehension\n\n list({utils.find_fork_top_parent(pid) for pid in pids})","commit_id":"7057de2d829dbfef7c74aea617724d068a8ba7ae"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"10b8c9436a23cfc617439a346457dcaf8f1be9ac","unresolved":false,"context_lines":[{"line_number":156,"context_line":"    # forked) and issue a SIGTERM to all of them. If force is True, then a"},{"line_number":157,"context_line":"    # SIGKILL will be issued to all parents and all their children"},{"line_number":158,"context_line":"    pids \u003d find_listen_pids_namespace(namespace)"},{"line_number":159,"context_line":"    parents \u003d list(set([utils.find_fork_top_parent(pid) for pid in pids]))"},{"line_number":160,"context_line":"    if force:"},{"line_number":161,"context_line":"        children \u003d [utils.find_child_pids(pid, True) for pid in parents]"},{"line_number":162,"context_line":"        pids_to_kill \u003d parents + list(itertools.chain.from_iterable(children))"}],"source_content_type":"text/x-python","patch_set":13,"id":"1a6eadb0_147f29ab","line":159,"range":{"start_line":159,"start_character":14,"end_line":159,"end_character":74},"in_reply_to":"1a6eadb0_b65bdd53","updated":"2016-12-13 11:50:29.000000000","message":"Done","commit_id":"7057de2d829dbfef7c74aea617724d068a8ba7ae"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"d120739a779c265a9ebf16ccf5a72608325a9f89","unresolved":false,"context_lines":[{"line_number":159,"context_line":"    parents \u003d list(set([utils.find_fork_top_parent(pid) for pid in pids]))"},{"line_number":160,"context_line":"    if force:"},{"line_number":161,"context_line":"        children \u003d [utils.find_child_pids(pid, True) for pid in parents]"},{"line_number":162,"context_line":"        pids_to_kill \u003d parents + list(itertools.chain.from_iterable(children))"},{"line_number":163,"context_line":"        kill_signal \u003d signal.SIGKILL"},{"line_number":164,"context_line":"    else:"},{"line_number":165,"context_line":"        pids_to_kill \u003d parents"}],"source_content_type":"text/x-python","patch_set":13,"id":"1a6eadb0_b622fdb7","line":162,"range":{"start_line":162,"start_character":33,"end_line":162,"end_character":38},"updated":"2016-12-13 10:47:16.000000000","message":"As we remove duplicates on 159 - is it guaranteed there won\u0027t be any duplicates here?","commit_id":"7057de2d829dbfef7c74aea617724d068a8ba7ae"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"10b8c9436a23cfc617439a346457dcaf8f1be9ac","unresolved":false,"context_lines":[{"line_number":159,"context_line":"    parents \u003d list(set([utils.find_fork_top_parent(pid) for pid in pids]))"},{"line_number":160,"context_line":"    if force:"},{"line_number":161,"context_line":"        children \u003d [utils.find_child_pids(pid, True) for pid in parents]"},{"line_number":162,"context_line":"        pids_to_kill \u003d parents + list(itertools.chain.from_iterable(children))"},{"line_number":163,"context_line":"        kill_signal \u003d signal.SIGKILL"},{"line_number":164,"context_line":"    else:"},{"line_number":165,"context_line":"        pids_to_kill \u003d parents"}],"source_content_type":"text/x-python","patch_set":13,"id":"1a6eadb0_8f7324b1","line":162,"range":{"start_line":162,"start_character":33,"end_line":162,"end_character":38},"in_reply_to":"1a6eadb0_b622fdb7","updated":"2016-12-13 11:50:29.000000000","message":"Duplicates here would mean that a process has two parents which is not possible. That\u0027s indeed guaranteed because of 159 as you point out. It\u0027s been good to re-think though :)","commit_id":"7057de2d829dbfef7c74aea617724d068a8ba7ae"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"6fa7b78a7bcb15d1216b37aa02576ba527507c54","unresolved":false,"context_lines":[{"line_number":46,"context_line":"    \u0027l3\u0027: [l3_agent.NS_PREFIX, dvr.SNAT_NS_PREFIX, dvr_fip_ns.FIP_NS_PREFIX],"},{"line_number":47,"context_line":"    \u0027lbaas\u0027: [LB_NS_PREFIX],"},{"line_number":48,"context_line":"}"},{"line_number":49,"context_line":"SIGTERM_WAITTIME \u003d 5"},{"line_number":50,"context_line":"NETSTAT_PIDS_REGEX \u003d re.compile(r\u0027.* (?P\u003cpid\u003e\\d{2,6})/.*\u0027)"},{"line_number":51,"context_line":""},{"line_number":52,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_eafb3379","line":49,"range":{"start_line":49,"start_character":19,"end_line":49,"end_character":20},"updated":"2016-12-15 11:21:08.000000000","message":"Why 5? In busy machines (like the gate, right before the third milestone), trivial things can take a lot longer, so this might fail. I suggest 10/15, especially since it\u0027s a user-ran code and it\u0027s ok to print something like \"waiting %d seconds until the processes die\".","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"667c4c9f346d785288055f8cc706cd0feafdae7d","unresolved":false,"context_lines":[{"line_number":46,"context_line":"    \u0027l3\u0027: [l3_agent.NS_PREFIX, dvr.SNAT_NS_PREFIX, dvr_fip_ns.FIP_NS_PREFIX],"},{"line_number":47,"context_line":"    \u0027lbaas\u0027: [LB_NS_PREFIX],"},{"line_number":48,"context_line":"}"},{"line_number":49,"context_line":"SIGTERM_WAITTIME \u003d 5"},{"line_number":50,"context_line":"NETSTAT_PIDS_REGEX \u003d re.compile(r\u0027.* (?P\u003cpid\u003e\\d{2,6})/.*\u0027)"},{"line_number":51,"context_line":""},{"line_number":52,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_bf316e5c","line":49,"range":{"start_line":49,"start_character":19,"end_line":49,"end_character":20},"in_reply_to":"1a6eadb0_eafb3379","updated":"2016-12-15 18:09:55.000000000","message":"Done. Increased it to 10","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"6fa7b78a7bcb15d1216b37aa02576ba527507c54","unresolved":false,"context_lines":[{"line_number":143,"context_line":"    pids \u003d set()"},{"line_number":144,"context_line":"    cmd \u003d [\u0027netstat\u0027, \u0027-nlp\u0027]"},{"line_number":145,"context_line":"    output \u003d ip.netns.execute(cmd, run_as_root\u003dTrue)"},{"line_number":146,"context_line":"    for line in output.splitlines()[2:]:"},{"line_number":147,"context_line":"        m \u003d NETSTAT_PIDS_REGEX.match(line)"},{"line_number":148,"context_line":"        if m:"},{"line_number":149,"context_line":"            pids.add(m.group(\u0027pid\u0027))"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_0aea2fac","line":146,"range":{"start_line":146,"start_character":35,"end_line":146,"end_character":40},"updated":"2016-12-15 11:21:08.000000000","message":"No need to explicitly filter the header, as it won\u0027t hit the regex anyway.","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"b2b37ff40013fb79b3a60ee5f3a045ceaad75a42","unresolved":false,"context_lines":[{"line_number":143,"context_line":"    pids \u003d set()"},{"line_number":144,"context_line":"    cmd \u003d [\u0027netstat\u0027, \u0027-nlp\u0027]"},{"line_number":145,"context_line":"    output \u003d ip.netns.execute(cmd, run_as_root\u003dTrue)"},{"line_number":146,"context_line":"    for line in output.splitlines()[2:]:"},{"line_number":147,"context_line":"        m \u003d NETSTAT_PIDS_REGEX.match(line)"},{"line_number":148,"context_line":"        if m:"},{"line_number":149,"context_line":"            pids.add(m.group(\u0027pid\u0027))"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_6dd9fd21","line":146,"range":{"start_line":146,"start_character":35,"end_line":146,"end_character":40},"in_reply_to":"1a6eadb0_0aea2fac","updated":"2016-12-15 11:55:32.000000000","message":"Is it better to try to match the regex and do extra iterations instead of just skipping and avoiding that extra work?","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"6ab1bdf7bceee67651c66ee4154ce8e464ff6224","unresolved":false,"context_lines":[{"line_number":143,"context_line":"    pids \u003d set()"},{"line_number":144,"context_line":"    cmd \u003d [\u0027netstat\u0027, \u0027-nlp\u0027]"},{"line_number":145,"context_line":"    output \u003d ip.netns.execute(cmd, run_as_root\u003dTrue)"},{"line_number":146,"context_line":"    for line in output.splitlines()[2:]:"},{"line_number":147,"context_line":"        m \u003d NETSTAT_PIDS_REGEX.match(line)"},{"line_number":148,"context_line":"        if m:"},{"line_number":149,"context_line":"            pids.add(m.group(\u0027pid\u0027))"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_f0e5e2a3","line":146,"range":{"start_line":146,"start_character":35,"end_line":146,"end_character":40},"in_reply_to":"1a6eadb0_6dd9fd21","updated":"2016-12-15 12:21:53.000000000","message":"This is Python, so run-time discussions are pretty much out of the window, but the real question you probably want to ask is \"does iterating over all the rows, including the first one, cost less than copying the entire output into a different list (since that\u0027s what splicing does)?\"\n\nEither way I\u0027m good with what you choose.","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"667c4c9f346d785288055f8cc706cd0feafdae7d","unresolved":false,"context_lines":[{"line_number":143,"context_line":"    pids \u003d set()"},{"line_number":144,"context_line":"    cmd \u003d [\u0027netstat\u0027, \u0027-nlp\u0027]"},{"line_number":145,"context_line":"    output \u003d ip.netns.execute(cmd, run_as_root\u003dTrue)"},{"line_number":146,"context_line":"    for line in output.splitlines()[2:]:"},{"line_number":147,"context_line":"        m \u003d NETSTAT_PIDS_REGEX.match(line)"},{"line_number":148,"context_line":"        if m:"},{"line_number":149,"context_line":"            pids.add(m.group(\u0027pid\u0027))"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_3f3e3e28","line":146,"range":{"start_line":146,"start_character":35,"end_line":146,"end_character":40},"in_reply_to":"1a6eadb0_f0e5e2a3","updated":"2016-12-15 18:09:55.000000000","message":"Done","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"6fa7b78a7bcb15d1216b37aa02576ba527507c54","unresolved":false,"context_lines":[{"line_number":151,"context_line":""},{"line_number":152,"context_line":""},{"line_number":153,"context_line":"def _kill_listen_processes(namespace, force\u003dFalse):"},{"line_number":154,"context_line":"    # Identify all listening processes within the given namespace, then for"},{"line_number":155,"context_line":"    # each one, find its top parent with same cmdline (in case this process was"},{"line_number":156,"context_line":"    # forked) and issue a SIGTERM to all of them. If force is True, then a"},{"line_number":157,"context_line":"    # SIGKILL will be issued to all parents and all their children"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_6aaba375","line":154,"range":{"start_line":154,"start_character":4,"end_line":154,"end_character":5},"updated":"2016-12-15 11:21:08.000000000","message":"This should be a docstring.","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"667c4c9f346d785288055f8cc706cd0feafdae7d","unresolved":false,"context_lines":[{"line_number":151,"context_line":""},{"line_number":152,"context_line":""},{"line_number":153,"context_line":"def _kill_listen_processes(namespace, force\u003dFalse):"},{"line_number":154,"context_line":"    # Identify all listening processes within the given namespace, then for"},{"line_number":155,"context_line":"    # each one, find its top parent with same cmdline (in case this process was"},{"line_number":156,"context_line":"    # forked) and issue a SIGTERM to all of them. If force is True, then a"},{"line_number":157,"context_line":"    # SIGKILL will be issued to all parents and all their children"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_bf188ed4","line":154,"range":{"start_line":154,"start_character":4,"end_line":154,"end_character":5},"in_reply_to":"1a6eadb0_6aaba375","updated":"2016-12-15 18:09:55.000000000","message":"Done","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"6fa7b78a7bcb15d1216b37aa02576ba527507c54","unresolved":false,"context_lines":[{"line_number":156,"context_line":"    # forked) and issue a SIGTERM to all of them. If force is True, then a"},{"line_number":157,"context_line":"    # SIGKILL will be issued to all parents and all their children"},{"line_number":158,"context_line":"    pids \u003d find_listen_pids_namespace(namespace)"},{"line_number":159,"context_line":"    parents \u003d list({utils.find_fork_top_parent(pid) for pid in pids})"},{"line_number":160,"context_line":"    if force:"},{"line_number":161,"context_line":"        children \u003d [utils.find_child_pids(pid, True) for pid in parents]"},{"line_number":162,"context_line":"        pids_to_kill \u003d parents + list(itertools.chain.from_iterable(children))"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_4a126758","line":159,"range":{"start_line":159,"start_character":14,"end_line":159,"end_character":18},"updated":"2016-12-15 11:21:08.000000000","message":"This is not needed as a set is also iterable.","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"667c4c9f346d785288055f8cc706cd0feafdae7d","unresolved":false,"context_lines":[{"line_number":156,"context_line":"    # forked) and issue a SIGTERM to all of them. If force is True, then a"},{"line_number":157,"context_line":"    # SIGKILL will be issued to all parents and all their children"},{"line_number":158,"context_line":"    pids \u003d find_listen_pids_namespace(namespace)"},{"line_number":159,"context_line":"    parents \u003d list({utils.find_fork_top_parent(pid) for pid in pids})"},{"line_number":160,"context_line":"    if force:"},{"line_number":161,"context_line":"        children \u003d [utils.find_child_pids(pid, True) for pid in parents]"},{"line_number":162,"context_line":"        pids_to_kill \u003d parents + list(itertools.chain.from_iterable(children))"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_8204564a","line":159,"range":{"start_line":159,"start_character":14,"end_line":159,"end_character":18},"in_reply_to":"1a6eadb0_3bdf3b6a","updated":"2016-12-15 18:09:55.000000000","message":"Done","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"b2b37ff40013fb79b3a60ee5f3a045ceaad75a42","unresolved":false,"context_lines":[{"line_number":156,"context_line":"    # forked) and issue a SIGTERM to all of them. If force is True, then a"},{"line_number":157,"context_line":"    # SIGKILL will be issued to all parents and all their children"},{"line_number":158,"context_line":"    pids \u003d find_listen_pids_namespace(namespace)"},{"line_number":159,"context_line":"    parents \u003d list({utils.find_fork_top_parent(pid) for pid in pids})"},{"line_number":160,"context_line":"    if force:"},{"line_number":161,"context_line":"        children \u003d [utils.find_child_pids(pid, True) for pid in parents]"},{"line_number":162,"context_line":"        pids_to_kill \u003d parents + list(itertools.chain.from_iterable(children))"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_4d3e0129","line":159,"range":{"start_line":159,"start_character":14,"end_line":159,"end_character":18},"in_reply_to":"1a6eadb0_4a126758","updated":"2016-12-15 11:55:32.000000000","message":"since i\u0027m adding lists in L162 i need this to be a list","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"5e608efd0c68c16fa412c24ede4a9804ee3f3475","unresolved":false,"context_lines":[{"line_number":156,"context_line":"    # forked) and issue a SIGTERM to all of them. If force is True, then a"},{"line_number":157,"context_line":"    # SIGKILL will be issued to all parents and all their children"},{"line_number":158,"context_line":"    pids \u003d find_listen_pids_namespace(namespace)"},{"line_number":159,"context_line":"    parents \u003d list({utils.find_fork_top_parent(pid) for pid in pids})"},{"line_number":160,"context_line":"    if force:"},{"line_number":161,"context_line":"        children \u003d [utils.find_child_pids(pid, True) for pid in parents]"},{"line_number":162,"context_line":"        pids_to_kill \u003d parents + list(itertools.chain.from_iterable(children))"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_7091d2f0","line":159,"range":{"start_line":159,"start_character":14,"end_line":159,"end_character":18},"in_reply_to":"1a6eadb0_4d3e0129","updated":"2016-12-15 12:09:12.000000000","message":"John is right, it\u0027s always used only as iterable. set should be fine.","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"6ab1bdf7bceee67651c66ee4154ce8e464ff6224","unresolved":false,"context_lines":[{"line_number":156,"context_line":"    # forked) and issue a SIGTERM to all of them. If force is True, then a"},{"line_number":157,"context_line":"    # SIGKILL will be issued to all parents and all their children"},{"line_number":158,"context_line":"    pids \u003d find_listen_pids_namespace(namespace)"},{"line_number":159,"context_line":"    parents \u003d list({utils.find_fork_top_parent(pid) for pid in pids})"},{"line_number":160,"context_line":"    if force:"},{"line_number":161,"context_line":"        children \u003d [utils.find_child_pids(pid, True) for pid in parents]"},{"line_number":162,"context_line":"        pids_to_kill \u003d parents + list(itertools.chain.from_iterable(children))"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_3bdf3b6a","line":159,"range":{"start_line":159,"start_character":14,"end_line":159,"end_character":18},"in_reply_to":"1a6eadb0_4d3e0129","updated":"2016-12-15 12:21:53.000000000","message":"So if you use my suggestion in like 165, you can use \u0027my_set.update(my_list)\u0027. It\u0027s only the \u0027+\u0027 operator that doesn\u0027t work.\n\nIn other words:\n\n kill_signal \u003d signal.SIGKILL if force else signal.SIGTERM\n pids_to_kill \u003d {utils.find_fork_top_parent(pid) for pid in pids}\n if force:\n     children \u003d [...]\n     pids_to_kill.update(list(chain))\n\n(Also I think you can drop the \u0027list\u0027 since update should receive an iterable anyway).","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"6fa7b78a7bcb15d1216b37aa02576ba527507c54","unresolved":false,"context_lines":[{"line_number":162,"context_line":"        pids_to_kill \u003d parents + list(itertools.chain.from_iterable(children))"},{"line_number":163,"context_line":"        kill_signal \u003d signal.SIGKILL"},{"line_number":164,"context_line":"    else:"},{"line_number":165,"context_line":"        pids_to_kill \u003d parents"},{"line_number":166,"context_line":"        kill_signal \u003d signal.SIGTERM"},{"line_number":167,"context_line":"    for pid in pids_to_kill:"},{"line_number":168,"context_line":"        LOG.warning(_LW(\"Killing (%(signal)d) [%(pid)s] %(cmdline)s\"),"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_eac7b395","line":165,"range":{"start_line":165,"start_character":8,"end_line":165,"end_character":20},"updated":"2016-12-15 11:21:08.000000000","message":"How about:\n\n kill_signal \u003d signal.SIGKILL if force else signal.SIGTERM\n pids_to_kill \u003d parents\n if force:\n     children \u003d [...]\n     pids_to_kill.extend(list(chain))","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"667c4c9f346d785288055f8cc706cd0feafdae7d","unresolved":false,"context_lines":[{"line_number":162,"context_line":"        pids_to_kill \u003d parents + list(itertools.chain.from_iterable(children))"},{"line_number":163,"context_line":"        kill_signal \u003d signal.SIGKILL"},{"line_number":164,"context_line":"    else:"},{"line_number":165,"context_line":"        pids_to_kill \u003d parents"},{"line_number":166,"context_line":"        kill_signal \u003d signal.SIGTERM"},{"line_number":167,"context_line":"    for pid in pids_to_kill:"},{"line_number":168,"context_line":"        LOG.warning(_LW(\"Killing (%(signal)d) [%(pid)s] %(cmdline)s\"),"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_22f54256","line":165,"range":{"start_line":165,"start_character":8,"end_line":165,"end_character":20},"in_reply_to":"1a6eadb0_4d53616b","updated":"2016-12-15 18:09:55.000000000","message":"Done","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"b2b37ff40013fb79b3a60ee5f3a045ceaad75a42","unresolved":false,"context_lines":[{"line_number":162,"context_line":"        pids_to_kill \u003d parents + list(itertools.chain.from_iterable(children))"},{"line_number":163,"context_line":"        kill_signal \u003d signal.SIGKILL"},{"line_number":164,"context_line":"    else:"},{"line_number":165,"context_line":"        pids_to_kill \u003d parents"},{"line_number":166,"context_line":"        kill_signal \u003d signal.SIGTERM"},{"line_number":167,"context_line":"    for pid in pids_to_kill:"},{"line_number":168,"context_line":"        LOG.warning(_LW(\"Killing (%(signal)d) [%(pid)s] %(cmdline)s\"),"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_4d53616b","line":165,"range":{"start_line":165,"start_character":8,"end_line":165,"end_character":20},"in_reply_to":"1a6eadb0_eac7b395","updated":"2016-12-15 11:55:32.000000000","message":"Your approach will check force twice but if it really is more clear, i\u0027m happy to change it :)","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"6fa7b78a7bcb15d1216b37aa02576ba527507c54","unresolved":false,"context_lines":[{"line_number":164,"context_line":"    else:"},{"line_number":165,"context_line":"        pids_to_kill \u003d parents"},{"line_number":166,"context_line":"        kill_signal \u003d signal.SIGTERM"},{"line_number":167,"context_line":"    for pid in pids_to_kill:"},{"line_number":168,"context_line":"        LOG.warning(_LW(\"Killing (%(signal)d) [%(pid)s] %(cmdline)s\"),"},{"line_number":169,"context_line":"                    {"},{"line_number":170,"context_line":"                     \u0027signal\u0027: kill_signal,"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_eaf093ff","line":167,"updated":"2016-12-15 11:21:08.000000000","message":"nit: please add a whitespace line between L166 and L167, so it\u0027s clear that it\u0027s a different part of the code\u0027s logic flow.","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"667c4c9f346d785288055f8cc706cd0feafdae7d","unresolved":false,"context_lines":[{"line_number":164,"context_line":"    else:"},{"line_number":165,"context_line":"        pids_to_kill \u003d parents"},{"line_number":166,"context_line":"        kill_signal \u003d signal.SIGTERM"},{"line_number":167,"context_line":"    for pid in pids_to_kill:"},{"line_number":168,"context_line":"        LOG.warning(_LW(\"Killing (%(signal)d) [%(pid)s] %(cmdline)s\"),"},{"line_number":169,"context_line":"                    {"},{"line_number":170,"context_line":"                     \u0027signal\u0027: kill_signal,"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_ff0e868a","line":167,"in_reply_to":"1a6eadb0_eaf093ff","updated":"2016-12-15 18:09:55.000000000","message":"Done","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"5e608efd0c68c16fa412c24ede4a9804ee3f3475","unresolved":false,"context_lines":[{"line_number":165,"context_line":"        pids_to_kill \u003d parents"},{"line_number":166,"context_line":"        kill_signal \u003d signal.SIGTERM"},{"line_number":167,"context_line":"    for pid in pids_to_kill:"},{"line_number":168,"context_line":"        LOG.warning(_LW(\"Killing (%(signal)d) [%(pid)s] %(cmdline)s\"),"},{"line_number":169,"context_line":"                    {"},{"line_number":170,"context_line":"                     \u0027signal\u0027: kill_signal,"},{"line_number":171,"context_line":"                     \u0027pid\u0027: pid,"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_da73cee5","line":168,"range":{"start_line":168,"start_character":12,"end_line":168,"end_character":19},"updated":"2016-12-15 12:09:12.000000000","message":"Is warning the correct logging level? Seems more like a debug would be more appropriate here to me.","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"667c4c9f346d785288055f8cc706cd0feafdae7d","unresolved":false,"context_lines":[{"line_number":165,"context_line":"        pids_to_kill \u003d parents"},{"line_number":166,"context_line":"        kill_signal \u003d signal.SIGTERM"},{"line_number":167,"context_line":"    for pid in pids_to_kill:"},{"line_number":168,"context_line":"        LOG.warning(_LW(\"Killing (%(signal)d) [%(pid)s] %(cmdline)s\"),"},{"line_number":169,"context_line":"                    {"},{"line_number":170,"context_line":"                     \u0027signal\u0027: kill_signal,"},{"line_number":171,"context_line":"                     \u0027pid\u0027: pid,"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_3a400c34","line":168,"range":{"start_line":168,"start_character":12,"end_line":168,"end_character":19},"in_reply_to":"1a6eadb0_da73cee5","updated":"2016-12-15 18:09:55.000000000","message":"I think we already talked about this a long time ago :)\nSince this patch is intended as a fallback for those cases where there\u0027s no specific cleanup, this log entry is supposed to warn those to implement that specific task. \neg. keepalived, radvd, should be killed by l3 agent but if they\u0027re not, this patch will take care of them warning through this log entry that some specific cleanup might be needed.","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"6fa7b78a7bcb15d1216b37aa02576ba527507c54","unresolved":false,"context_lines":[{"line_number":166,"context_line":"        kill_signal \u003d signal.SIGTERM"},{"line_number":167,"context_line":"    for pid in pids_to_kill:"},{"line_number":168,"context_line":"        LOG.warning(_LW(\"Killing (%(signal)d) [%(pid)s] %(cmdline)s\"),"},{"line_number":169,"context_line":"                    {"},{"line_number":170,"context_line":"                     \u0027signal\u0027: kill_signal,"},{"line_number":171,"context_line":"                     \u0027pid\u0027: pid,"},{"line_number":172,"context_line":"                     \u0027cmdline\u0027: \u0027 \u0027.join(utils.get_cmdline_from_pid(pid))[:80]"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_6abc8306","line":169,"updated":"2016-12-15 11:21:08.000000000","message":"No line-drop is needed between L169 and L170 ({\u0027signal\u0027: ... is ok).","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"667c4c9f346d785288055f8cc706cd0feafdae7d","unresolved":false,"context_lines":[{"line_number":166,"context_line":"        kill_signal \u003d signal.SIGTERM"},{"line_number":167,"context_line":"    for pid in pids_to_kill:"},{"line_number":168,"context_line":"        LOG.warning(_LW(\"Killing (%(signal)d) [%(pid)s] %(cmdline)s\"),"},{"line_number":169,"context_line":"                    {"},{"line_number":170,"context_line":"                     \u0027signal\u0027: kill_signal,"},{"line_number":171,"context_line":"                     \u0027pid\u0027: pid,"},{"line_number":172,"context_line":"                     \u0027cmdline\u0027: \u0027 \u0027.join(utils.get_cmdline_from_pid(pid))[:80]"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_daa2b8fb","line":169,"in_reply_to":"1a6eadb0_6abc8306","updated":"2016-12-15 18:09:55.000000000","message":"Done","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"6fa7b78a7bcb15d1216b37aa02576ba527507c54","unresolved":false,"context_lines":[{"line_number":174,"context_line":"        try:"},{"line_number":175,"context_line":"            utils.kill_process(pid, kill_signal, run_as_root\u003dTrue)"},{"line_number":176,"context_line":"        except Exception:"},{"line_number":177,"context_line":"            LOG.error(_LE(\u0027An error occurred while killing [%s].\u0027), pid)"},{"line_number":178,"context_line":"    return bool(pids)"},{"line_number":179,"context_line":""},{"line_number":180,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_0a44ef18","line":177,"updated":"2016-12-15 11:21:08.000000000","message":"Please also include the error that had occurred, to ease the pain of debugging in case this fails.","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"667c4c9f346d785288055f8cc706cd0feafdae7d","unresolved":false,"context_lines":[{"line_number":174,"context_line":"        try:"},{"line_number":175,"context_line":"            utils.kill_process(pid, kill_signal, run_as_root\u003dTrue)"},{"line_number":176,"context_line":"        except Exception:"},{"line_number":177,"context_line":"            LOG.error(_LE(\u0027An error occurred while killing [%s].\u0027), pid)"},{"line_number":178,"context_line":"    return bool(pids)"},{"line_number":179,"context_line":""},{"line_number":180,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_a201523a","line":177,"in_reply_to":"1a6eadb0_0a44ef18","updated":"2016-12-15 18:09:55.000000000","message":"Done","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"6fa7b78a7bcb15d1216b37aa02576ba527507c54","unresolved":false,"context_lines":[{"line_number":175,"context_line":"            utils.kill_process(pid, kill_signal, run_as_root\u003dTrue)"},{"line_number":176,"context_line":"        except Exception:"},{"line_number":177,"context_line":"            LOG.error(_LE(\u0027An error occurred while killing [%s].\u0027), pid)"},{"line_number":178,"context_line":"    return bool(pids)"},{"line_number":179,"context_line":""},{"line_number":180,"context_line":""},{"line_number":181,"context_line":"def kill_listen_processes(namespace):"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_8a50ffd5","line":178,"range":{"start_line":178,"start_character":11,"end_line":178,"end_character":21},"updated":"2016-12-15 11:21:08.000000000","message":"I wouldn\u0027t expect a function called _kill_listen_processes() to return a boolean to indicate an error. Can we throw an exception instead?","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"667c4c9f346d785288055f8cc706cd0feafdae7d","unresolved":false,"context_lines":[{"line_number":175,"context_line":"            utils.kill_process(pid, kill_signal, run_as_root\u003dTrue)"},{"line_number":176,"context_line":"        except Exception:"},{"line_number":177,"context_line":"            LOG.error(_LE(\u0027An error occurred while killing [%s].\u0027), pid)"},{"line_number":178,"context_line":"    return bool(pids)"},{"line_number":179,"context_line":""},{"line_number":180,"context_line":""},{"line_number":181,"context_line":"def kill_listen_processes(namespace):"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_7a728412","line":178,"range":{"start_line":178,"start_character":11,"end_line":178,"end_character":21},"in_reply_to":"1a6eadb0_1b019f6a","updated":"2016-12-15 18:09:55.000000000","message":"Done","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"b2b37ff40013fb79b3a60ee5f3a045ceaad75a42","unresolved":false,"context_lines":[{"line_number":175,"context_line":"            utils.kill_process(pid, kill_signal, run_as_root\u003dTrue)"},{"line_number":176,"context_line":"        except Exception:"},{"line_number":177,"context_line":"            LOG.error(_LE(\u0027An error occurred while killing [%s].\u0027), pid)"},{"line_number":178,"context_line":"    return bool(pids)"},{"line_number":179,"context_line":""},{"line_number":180,"context_line":""},{"line_number":181,"context_line":"def kill_listen_processes(namespace):"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_ad19558a","line":178,"range":{"start_line":178,"start_character":11,"end_line":178,"end_character":21},"in_reply_to":"1a6eadb0_8a50ffd5","updated":"2016-12-15 11:55:32.000000000","message":"I just wanted to let the caller know that no processes have been killed in this particular namespace to avoid unnecessary further calls (and waits). That\u0027s the purpose of returning a boolean value, not notifying an error.\nI could raise an exception if no process have been killed but I think that the extra overhead due to excepting is not worth it... Since this is not a public function I still think that the current implementation is fine.\nStill open to see your thoughts and change it though","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"5e608efd0c68c16fa412c24ede4a9804ee3f3475","unresolved":false,"context_lines":[{"line_number":175,"context_line":"            utils.kill_process(pid, kill_signal, run_as_root\u003dTrue)"},{"line_number":176,"context_line":"        except Exception:"},{"line_number":177,"context_line":"            LOG.error(_LE(\u0027An error occurred while killing [%s].\u0027), pid)"},{"line_number":178,"context_line":"    return bool(pids)"},{"line_number":179,"context_line":""},{"line_number":180,"context_line":""},{"line_number":181,"context_line":"def kill_listen_processes(namespace):"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_b0328a0e","line":178,"range":{"start_line":178,"start_character":11,"end_line":178,"end_character":21},"in_reply_to":"1a6eadb0_ad19558a","updated":"2016-12-15 12:09:12.000000000","message":"I agree with Daniel, I think it\u0027s semantically wrong to raise an exception if namespace doesn\u0027t have any running processes. Maybe returning a number of how many processes were killed would make more sense than bool - the usage would remain the same. I don\u0027t really think it matters.","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"6ab1bdf7bceee67651c66ee4154ce8e464ff6224","unresolved":false,"context_lines":[{"line_number":175,"context_line":"            utils.kill_process(pid, kill_signal, run_as_root\u003dTrue)"},{"line_number":176,"context_line":"        except Exception:"},{"line_number":177,"context_line":"            LOG.error(_LE(\u0027An error occurred while killing [%s].\u0027), pid)"},{"line_number":178,"context_line":"    return bool(pids)"},{"line_number":179,"context_line":""},{"line_number":180,"context_line":""},{"line_number":181,"context_line":"def kill_listen_processes(namespace):"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_1b019f6a","line":178,"range":{"start_line":178,"start_character":11,"end_line":178,"end_character":21},"in_reply_to":"1a6eadb0_b0328a0e","updated":"2016-12-15 12:21:53.000000000","message":"Returning %d does make more sense.","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"5e608efd0c68c16fa412c24ede4a9804ee3f3475","unresolved":false,"context_lines":[{"line_number":185,"context_line":"    kills remaining processes with SIGKILL"},{"line_number":186,"context_line":"    \"\"\""},{"line_number":187,"context_line":"    if _kill_listen_processes(namespace, force\u003dFalse):"},{"line_number":188,"context_line":"        time.sleep(SIGTERM_WAITTIME)"},{"line_number":189,"context_line":"        _kill_listen_processes(namespace, force\u003dTrue)"},{"line_number":190,"context_line":""},{"line_number":191,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_1d48e05a","line":188,"range":{"start_line":188,"start_character":8,"end_line":188,"end_character":36},"updated":"2016-12-15 12:09:12.000000000","message":"Have you measured how long does it take to do the cleanup with e.g. 10 namespaces? It seems that it always waits when there were any processes in the namespace. That said, if 10 namespaces have running processes, it\u0027s gonna take at least 50 seconds. Maybe spawning this in a coroutine would solve the issue.","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"6fa7b78a7bcb15d1216b37aa02576ba527507c54","unresolved":false,"context_lines":[{"line_number":185,"context_line":"    kills remaining processes with SIGKILL"},{"line_number":186,"context_line":"    \"\"\""},{"line_number":187,"context_line":"    if _kill_listen_processes(namespace, force\u003dFalse):"},{"line_number":188,"context_line":"        time.sleep(SIGTERM_WAITTIME)"},{"line_number":189,"context_line":"        _kill_listen_processes(namespace, force\u003dTrue)"},{"line_number":190,"context_line":""},{"line_number":191,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_270e463b","line":188,"range":{"start_line":188,"start_character":8,"end_line":188,"end_character":18},"updated":"2016-12-15 11:21:08.000000000","message":"Take a look at \"wait_until_true\" [1], maybe it will make the code a bit more fluent.\n\n[1]: https://github.com/openstack/neutron/blob/master/neutron/common/utils.py#L697","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"6ab1bdf7bceee67651c66ee4154ce8e464ff6224","unresolved":false,"context_lines":[{"line_number":185,"context_line":"    kills remaining processes with SIGKILL"},{"line_number":186,"context_line":"    \"\"\""},{"line_number":187,"context_line":"    if _kill_listen_processes(namespace, force\u003dFalse):"},{"line_number":188,"context_line":"        time.sleep(SIGTERM_WAITTIME)"},{"line_number":189,"context_line":"        _kill_listen_processes(namespace, force\u003dTrue)"},{"line_number":190,"context_line":""},{"line_number":191,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_5b53176b","line":188,"range":{"start_line":188,"start_character":8,"end_line":188,"end_character":36},"in_reply_to":"1a6eadb0_1d48e05a","updated":"2016-12-15 12:21:53.000000000","message":"@Daniel Yes. Also, what Kuba said sounds like the time to wait should be a function of how many processes were signaled.","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"b2b37ff40013fb79b3a60ee5f3a045ceaad75a42","unresolved":false,"context_lines":[{"line_number":185,"context_line":"    kills remaining processes with SIGKILL"},{"line_number":186,"context_line":"    \"\"\""},{"line_number":187,"context_line":"    if _kill_listen_processes(namespace, force\u003dFalse):"},{"line_number":188,"context_line":"        time.sleep(SIGTERM_WAITTIME)"},{"line_number":189,"context_line":"        _kill_listen_processes(namespace, force\u003dTrue)"},{"line_number":190,"context_line":""},{"line_number":191,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_b09c4ac1","line":188,"range":{"start_line":188,"start_character":8,"end_line":188,"end_character":18},"in_reply_to":"1a6eadb0_270e463b","updated":"2016-12-15 11:55:32.000000000","message":"doing the sleep just to allow some times for the process to die...\nAre you suggesting to use the while_until_true on \u0027find_listen_pids_namespace\u0027 return value, actively checking for listening processes every \u0027sleep\u003d\u0027 seconds until the SIGTERM_WAITTIME timeout expires?","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"667c4c9f346d785288055f8cc706cd0feafdae7d","unresolved":false,"context_lines":[{"line_number":185,"context_line":"    kills remaining processes with SIGKILL"},{"line_number":186,"context_line":"    \"\"\""},{"line_number":187,"context_line":"    if _kill_listen_processes(namespace, force\u003dFalse):"},{"line_number":188,"context_line":"        time.sleep(SIGTERM_WAITTIME)"},{"line_number":189,"context_line":"        _kill_listen_processes(namespace, force\u003dTrue)"},{"line_number":190,"context_line":""},{"line_number":191,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"1a6eadb0_faea1473","line":188,"range":{"start_line":188,"start_character":8,"end_line":188,"end_character":36},"in_reply_to":"1a6eadb0_5b53176b","updated":"2016-12-15 18:09:55.000000000","message":"Nice suggestion, thanks :)\nThis way, if there\u0027re processes which die right away after the SIGTERM, then there\u0027s no need neither to wait nor to try the SIGKILL.\nDone","commit_id":"7c6906d9d0d106989631b9c8e5e169c6d0ccb99a"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"c3d46c592f7ba82be783dd149a374a0fab65645c","unresolved":false,"context_lines":[{"line_number":160,"context_line":"    this function returns the number of listening processes."},{"line_number":161,"context_line":"    \"\"\""},{"line_number":162,"context_line":"    pids \u003d find_listen_pids_namespace(namespace)"},{"line_number":163,"context_line":"    kill_signal \u003d signal.SIGKILL if force else signal.SIGTERM"},{"line_number":164,"context_line":"    pids_to_kill \u003d {utils.find_fork_top_parent(pid) for pid in pids}"},{"line_number":165,"context_line":"    if force:"},{"line_number":166,"context_line":"        children \u003d [utils.find_child_pids(pid, True) for pid in pids_to_kill]"}],"source_content_type":"text/x-python","patch_set":18,"id":"1a6eadb0_a9591237","line":163,"range":{"start_line":163,"start_character":0,"end_line":163,"end_character":61},"updated":"2016-12-16 11:18:33.000000000","message":"No action required: you\u0027re now checking twice for force, better approach is:\n\n kill_signal \u003d signal.SIGTERM\n if force:\n     kill_signal \u003d signal.SIGKILL","commit_id":"795a9d4ee83348e38e4a69c42618636192f7c354"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"6d5606f852ffa428654c92de4faa10c0df12b5fe","unresolved":false,"context_lines":[{"line_number":160,"context_line":"    this function returns the number of listening processes."},{"line_number":161,"context_line":"    \"\"\""},{"line_number":162,"context_line":"    pids \u003d find_listen_pids_namespace(namespace)"},{"line_number":163,"context_line":"    kill_signal \u003d signal.SIGKILL if force else signal.SIGTERM"},{"line_number":164,"context_line":"    pids_to_kill \u003d {utils.find_fork_top_parent(pid) for pid in pids}"},{"line_number":165,"context_line":"    if force:"},{"line_number":166,"context_line":"        children \u003d [utils.find_child_pids(pid, True) for pid in pids_to_kill]"}],"source_content_type":"text/x-python","patch_set":18,"id":"1a6eadb0_80169b53","line":163,"range":{"start_line":163,"start_character":0,"end_line":163,"end_character":61},"in_reply_to":"1a6eadb0_a9591237","updated":"2016-12-19 14:25:14.000000000","message":"Done","commit_id":"795a9d4ee83348e38e4a69c42618636192f7c354"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"d4589a3cc517c7caa6b528c2955aa7abeccfbf99","unresolved":false,"context_lines":[{"line_number":167,"context_line":"        pids_to_kill.update(itertools.chain.from_iterable(children))"},{"line_number":168,"context_line":""},{"line_number":169,"context_line":"    for pid in pids_to_kill:"},{"line_number":170,"context_line":"        LOG.warning(_LW(\"Killing (%(signal)d) [%(pid)s] %(cmdline)s\"),"},{"line_number":171,"context_line":"                    {\u0027signal\u0027: kill_signal,"},{"line_number":172,"context_line":"                     \u0027pid\u0027: pid,"},{"line_number":173,"context_line":"                     \u0027cmdline\u0027: \u0027 \u0027.join(utils.get_cmdline_from_pid(pid))[:80]"}],"source_content_type":"text/x-python","patch_set":18,"id":"1a6eadb0_69a7fabc","line":170,"updated":"2016-12-16 11:22:22.000000000","message":"extend the message or add more comments if you need to resubmit.","commit_id":"795a9d4ee83348e38e4a69c42618636192f7c354"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"6d5606f852ffa428654c92de4faa10c0df12b5fe","unresolved":false,"context_lines":[{"line_number":167,"context_line":"        pids_to_kill.update(itertools.chain.from_iterable(children))"},{"line_number":168,"context_line":""},{"line_number":169,"context_line":"    for pid in pids_to_kill:"},{"line_number":170,"context_line":"        LOG.warning(_LW(\"Killing (%(signal)d) [%(pid)s] %(cmdline)s\"),"},{"line_number":171,"context_line":"                    {\u0027signal\u0027: kill_signal,"},{"line_number":172,"context_line":"                     \u0027pid\u0027: pid,"},{"line_number":173,"context_line":"                     \u0027cmdline\u0027: \u0027 \u0027.join(utils.get_cmdline_from_pid(pid))[:80]"}],"source_content_type":"text/x-python","patch_set":18,"id":"1a6eadb0_a00b972a","line":170,"in_reply_to":"1a6eadb0_69a7fabc","updated":"2016-12-19 14:25:14.000000000","message":"Done","commit_id":"795a9d4ee83348e38e4a69c42618636192f7c354"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"c3d46c592f7ba82be783dd149a374a0fab65645c","unresolved":false,"context_lines":[{"line_number":176,"context_line":"            utils.kill_process(pid, kill_signal, run_as_root\u003dTrue)"},{"line_number":177,"context_line":"        except Exception as ex:"},{"line_number":178,"context_line":"            LOG.error(_LE(\u0027An error occurred while killing \\"},{"line_number":179,"context_line":"                          [%(pid)s]: %(msg)s\u0027), {\u0027pid\u0027: pid, \u0027msg\u0027: str(ex)})"},{"line_number":180,"context_line":"    return len(pids)"},{"line_number":181,"context_line":""},{"line_number":182,"context_line":""}],"source_content_type":"text/x-python","patch_set":18,"id":"1a6eadb0_661e4971","line":179,"range":{"start_line":179,"start_character":68,"end_line":179,"end_character":72},"updated":"2016-12-16 11:18:33.000000000","message":"This is not needed, it will be done implicitly.","commit_id":"795a9d4ee83348e38e4a69c42618636192f7c354"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"6d5606f852ffa428654c92de4faa10c0df12b5fe","unresolved":false,"context_lines":[{"line_number":176,"context_line":"            utils.kill_process(pid, kill_signal, run_as_root\u003dTrue)"},{"line_number":177,"context_line":"        except Exception as ex:"},{"line_number":178,"context_line":"            LOG.error(_LE(\u0027An error occurred while killing \\"},{"line_number":179,"context_line":"                          [%(pid)s]: %(msg)s\u0027), {\u0027pid\u0027: pid, \u0027msg\u0027: str(ex)})"},{"line_number":180,"context_line":"    return len(pids)"},{"line_number":181,"context_line":""},{"line_number":182,"context_line":""}],"source_content_type":"text/x-python","patch_set":18,"id":"1a6eadb0_a339e1da","line":179,"range":{"start_line":179,"start_character":68,"end_line":179,"end_character":72},"in_reply_to":"1a6eadb0_661e4971","updated":"2016-12-19 14:25:14.000000000","message":"Done","commit_id":"795a9d4ee83348e38e4a69c42618636192f7c354"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"c3d46c592f7ba82be783dd149a374a0fab65645c","unresolved":false,"context_lines":[{"line_number":191,"context_line":"            common_utils.wait_until_true("},{"line_number":192,"context_line":"                lambda: not find_listen_pids_namespace(namespace),"},{"line_number":193,"context_line":"                timeout\u003dSIGTERM_WAITTIME,"},{"line_number":194,"context_line":"                exception\u003dException(\u0027Not all processes died with SIGTERM\u0027))"},{"line_number":195,"context_line":"        except Exception:"},{"line_number":196,"context_line":"            _kill_listen_processes(namespace, force\u003dTrue)"},{"line_number":197,"context_line":""}],"source_content_type":"text/x-python","patch_set":18,"id":"1a6eadb0_096cc69a","line":194,"range":{"start_line":194,"start_character":36,"end_line":194,"end_character":74},"updated":"2016-12-16 11:18:33.000000000","message":"This is unused.","commit_id":"795a9d4ee83348e38e4a69c42618636192f7c354"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"d4589a3cc517c7caa6b528c2955aa7abeccfbf99","unresolved":false,"context_lines":[{"line_number":191,"context_line":"            common_utils.wait_until_true("},{"line_number":192,"context_line":"                lambda: not find_listen_pids_namespace(namespace),"},{"line_number":193,"context_line":"                timeout\u003dSIGTERM_WAITTIME,"},{"line_number":194,"context_line":"                exception\u003dException(\u0027Not all processes died with SIGTERM\u0027))"},{"line_number":195,"context_line":"        except Exception:"},{"line_number":196,"context_line":"            _kill_listen_processes(namespace, force\u003dTrue)"},{"line_number":197,"context_line":""}],"source_content_type":"text/x-python","patch_set":18,"id":"1a6eadb0_a9ad929c","line":194,"range":{"start_line":194,"start_character":36,"end_line":194,"end_character":74},"in_reply_to":"1a6eadb0_096cc69a","updated":"2016-12-16 11:22:22.000000000","message":"Right.","commit_id":"795a9d4ee83348e38e4a69c42618636192f7c354"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"6d5606f852ffa428654c92de4faa10c0df12b5fe","unresolved":false,"context_lines":[{"line_number":191,"context_line":"            common_utils.wait_until_true("},{"line_number":192,"context_line":"                lambda: not find_listen_pids_namespace(namespace),"},{"line_number":193,"context_line":"                timeout\u003dSIGTERM_WAITTIME,"},{"line_number":194,"context_line":"                exception\u003dException(\u0027Not all processes died with SIGTERM\u0027))"},{"line_number":195,"context_line":"        except Exception:"},{"line_number":196,"context_line":"            _kill_listen_processes(namespace, force\u003dTrue)"},{"line_number":197,"context_line":""}],"source_content_type":"text/x-python","patch_set":18,"id":"1a6eadb0_e333d9f4","line":194,"range":{"start_line":194,"start_character":36,"end_line":194,"end_character":74},"in_reply_to":"1a6eadb0_a9ad929c","updated":"2016-12-19 14:25:14.000000000","message":"I\u0027m using it in PS91 due to the reasons exposed in my next comment","commit_id":"795a9d4ee83348e38e4a69c42618636192f7c354"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"c3d46c592f7ba82be783dd149a374a0fab65645c","unresolved":false,"context_lines":[{"line_number":192,"context_line":"                lambda: not find_listen_pids_namespace(namespace),"},{"line_number":193,"context_line":"                timeout\u003dSIGTERM_WAITTIME,"},{"line_number":194,"context_line":"                exception\u003dException(\u0027Not all processes died with SIGTERM\u0027))"},{"line_number":195,"context_line":"        except Exception:"},{"line_number":196,"context_line":"            _kill_listen_processes(namespace, force\u003dTrue)"},{"line_number":197,"context_line":""},{"line_number":198,"context_line":""}],"source_content_type":"text/x-python","patch_set":18,"id":"1a6eadb0_c9756e64","line":195,"range":{"start_line":195,"start_character":15,"end_line":195,"end_character":24},"updated":"2016-12-16 11:18:33.000000000","message":"Do you want to use SIGKILL only when the timeout occurs or even if find_listen_pids_namespace raises RuntimeError?\n\nMaybe not defining exception on L194 and catching eventlet.Timeout here will be better scoped.","commit_id":"795a9d4ee83348e38e4a69c42618636192f7c354"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"6d5606f852ffa428654c92de4faa10c0df12b5fe","unresolved":false,"context_lines":[{"line_number":192,"context_line":"                lambda: not find_listen_pids_namespace(namespace),"},{"line_number":193,"context_line":"                timeout\u003dSIGTERM_WAITTIME,"},{"line_number":194,"context_line":"                exception\u003dException(\u0027Not all processes died with SIGTERM\u0027))"},{"line_number":195,"context_line":"        except Exception:"},{"line_number":196,"context_line":"            _kill_listen_processes(namespace, force\u003dTrue)"},{"line_number":197,"context_line":""},{"line_number":198,"context_line":""}],"source_content_type":"text/x-python","patch_set":18,"id":"1a6eadb0_03b6153d","line":195,"range":{"start_line":195,"start_character":15,"end_line":195,"end_character":24},"in_reply_to":"1a6eadb0_c9756e64","updated":"2016-12-19 14:25:14.000000000","message":"I was unable to catch eventlet.timeout.Timeout since importing eventlet from this module will import local cmd/eventlet which doesn\u0027t have the timeout module. I worked out a solution to handle a specific Exception string","commit_id":"795a9d4ee83348e38e4a69c42618636192f7c354"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"8c22c87405ce8359bc8714165a64c0d84a0be302","unresolved":false,"context_lines":[{"line_number":181,"context_line":"    return len(pids)"},{"line_number":182,"context_line":""},{"line_number":183,"context_line":""},{"line_number":184,"context_line":"def kill_listen_processes(namespace):"},{"line_number":185,"context_line":"    \"\"\"Kill all processes listening within the given namespace."},{"line_number":186,"context_line":""},{"line_number":187,"context_line":"    First it tries to kill them using SIGTERM, waits until they die gracefully"}],"source_content_type":"text/x-python","patch_set":19,"id":"1a6eadb0_22cdf086","line":184,"range":{"start_line":184,"start_character":4,"end_line":184,"end_character":25},"updated":"2016-12-18 07:52:39.000000000","message":"Looking back at my suggestion, it was a bad one. The original code from patchset 16 was more clear than this so I think you should revert back. Sorry for the hassle.","commit_id":"5f3419013466d534ed2f5f37c528d4fc46d7e0fc"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"12eeccd5bf1ef9327d5ee4e77be403465e606beb","unresolved":false,"context_lines":[{"line_number":181,"context_line":"    return len(pids)"},{"line_number":182,"context_line":""},{"line_number":183,"context_line":""},{"line_number":184,"context_line":"def kill_listen_processes(namespace):"},{"line_number":185,"context_line":"    \"\"\"Kill all processes listening within the given namespace."},{"line_number":186,"context_line":""},{"line_number":187,"context_line":"    First it tries to kill them using SIGTERM, waits until they die gracefully"}],"source_content_type":"text/x-python","patch_set":19,"id":"1a6eadb0_a2cd695f","line":184,"range":{"start_line":184,"start_character":4,"end_line":184,"end_character":25},"in_reply_to":"1a6eadb0_22cdf086","updated":"2016-12-19 13:42:53.000000000","message":"Although probably you\u0027re right and PS16 was clearer, i actually think that your suggestion was good! If all processes die with the SIGTERM, then there\u0027s no point on waiting SIGTERM_WAITTIME seconds so it\u0027s quite a nice improvement.","commit_id":"5f3419013466d534ed2f5f37c528d4fc46d7e0fc"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"9ba567fb1637aee92153e04d9082280b12308051","unresolved":false,"context_lines":[{"line_number":169,"context_line":"        pids_to_kill.update(itertools.chain.from_iterable(children))"},{"line_number":170,"context_line":""},{"line_number":171,"context_line":"    for pid in pids_to_kill:"},{"line_number":172,"context_line":"        # Throw a warning since this particular cleanup may need an specific"},{"line_number":173,"context_line":"        # implementation in the right module. Ideally, netns_cleanup wouldn\u0027t"},{"line_number":174,"context_line":"        # kill any processes as the responsible module should\u0027ve killed them"},{"line_number":175,"context_line":"        # before cleaning up the namespace"}],"source_content_type":"text/x-python","patch_set":20,"id":"1a6eadb0_63e6e9e9","line":172,"range":{"start_line":172,"start_character":65,"end_line":172,"end_character":67},"updated":"2016-12-19 14:41:00.000000000","message":"a","commit_id":"ed1b50991ebb8211610382bea4af76cdd0f06665"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"1995e055d1af45f2d9d304d2e080df7613f7b794","unresolved":false,"context_lines":[{"line_number":169,"context_line":"        pids_to_kill.update(itertools.chain.from_iterable(children))"},{"line_number":170,"context_line":""},{"line_number":171,"context_line":"    for pid in pids_to_kill:"},{"line_number":172,"context_line":"        # Throw a warning since this particular cleanup may need an specific"},{"line_number":173,"context_line":"        # implementation in the right module. Ideally, netns_cleanup wouldn\u0027t"},{"line_number":174,"context_line":"        # kill any processes as the responsible module should\u0027ve killed them"},{"line_number":175,"context_line":"        # before cleaning up the namespace"}],"source_content_type":"text/x-python","patch_set":20,"id":"1a6eadb0_a5c9e15c","line":172,"range":{"start_line":172,"start_character":65,"end_line":172,"end_character":67},"in_reply_to":"1a6eadb0_63e6e9e9","updated":"2016-12-19 16:40:14.000000000","message":"Done","commit_id":"ed1b50991ebb8211610382bea4af76cdd0f06665"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"9ba567fb1637aee92153e04d9082280b12308051","unresolved":false,"context_lines":[{"line_number":204,"context_line":"                exception\u003dException(SIGTERM_TIMEOUT_EXCEPTION))"},{"line_number":205,"context_line":"        except Exception as ex:"},{"line_number":206,"context_line":"            if str(ex) \u003d\u003d SIGTERM_TIMEOUT_EXCEPTION:"},{"line_number":207,"context_line":"                _kill_listen_processes(namespace, force\u003dTrue)"},{"line_number":208,"context_line":""},{"line_number":209,"context_line":""},{"line_number":210,"context_line":"def destroy_namespace(conf, namespace, force\u003dFalse):"}],"source_content_type":"text/x-python","patch_set":20,"id":"1a6eadb0_231151b0","line":207,"updated":"2016-12-19 14:41:00.000000000","message":"else:\n     raise","commit_id":"ed1b50991ebb8211610382bea4af76cdd0f06665"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"1995e055d1af45f2d9d304d2e080df7613f7b794","unresolved":false,"context_lines":[{"line_number":204,"context_line":"                exception\u003dException(SIGTERM_TIMEOUT_EXCEPTION))"},{"line_number":205,"context_line":"        except Exception as ex:"},{"line_number":206,"context_line":"            if str(ex) \u003d\u003d SIGTERM_TIMEOUT_EXCEPTION:"},{"line_number":207,"context_line":"                _kill_listen_processes(namespace, force\u003dTrue)"},{"line_number":208,"context_line":""},{"line_number":209,"context_line":""},{"line_number":210,"context_line":"def destroy_namespace(conf, namespace, force\u003dFalse):"}],"source_content_type":"text/x-python","patch_set":20,"id":"1a6eadb0_65aa6987","line":207,"in_reply_to":"1a6eadb0_231151b0","updated":"2016-12-19 16:40:14.000000000","message":"Done","commit_id":"ed1b50991ebb8211610382bea4af76cdd0f06665"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"e008037e0d442194cabb9ffe70d7df7e38f8a2fb","unresolved":false,"context_lines":[{"line_number":223,"context_line":"            # so a second check is required here."},{"line_number":224,"context_line":"            if ip.netns.exists(namespace):"},{"line_number":225,"context_line":"                kill_listen_processes(namespace)"},{"line_number":226,"context_line":"                for device in ip.get_devices(exclude_loopback\u003dTrue):"},{"line_number":227,"context_line":"                    unplug_device(conf, device)"},{"line_number":228,"context_line":""},{"line_number":229,"context_line":"        ip.garbage_collect_namespace()"},{"line_number":230,"context_line":"    except Exception:"}],"source_content_type":"text/x-python","patch_set":20,"id":"1a6eadb0_0ad8e21c","line":227,"range":{"start_line":226,"start_character":16,"end_line":227,"end_character":47},"updated":"2016-12-19 16:11:15.000000000","message":"Sorry for a dumb question, but don\u0027t we have to unplug devices first and after that kill processes? Or it does not matter?","commit_id":"ed1b50991ebb8211610382bea4af76cdd0f06665"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"9792debd95d9841f461fb233af0bc449928303b2","unresolved":false,"context_lines":[{"line_number":223,"context_line":"            # so a second check is required here."},{"line_number":224,"context_line":"            if ip.netns.exists(namespace):"},{"line_number":225,"context_line":"                kill_listen_processes(namespace)"},{"line_number":226,"context_line":"                for device in ip.get_devices(exclude_loopback\u003dTrue):"},{"line_number":227,"context_line":"                    unplug_device(conf, device)"},{"line_number":228,"context_line":""},{"line_number":229,"context_line":"        ip.garbage_collect_namespace()"},{"line_number":230,"context_line":"    except Exception:"}],"source_content_type":"text/x-python","patch_set":20,"id":"1a6eadb0_e5e67943","line":227,"range":{"start_line":226,"start_character":16,"end_line":227,"end_character":47},"in_reply_to":"1a6eadb0_0ad8e21c","updated":"2016-12-19 16:19:35.000000000","message":"Funny that I had opposite comment in PS1 :)","commit_id":"ed1b50991ebb8211610382bea4af76cdd0f06665"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"1995e055d1af45f2d9d304d2e080df7613f7b794","unresolved":false,"context_lines":[{"line_number":223,"context_line":"            # so a second check is required here."},{"line_number":224,"context_line":"            if ip.netns.exists(namespace):"},{"line_number":225,"context_line":"                kill_listen_processes(namespace)"},{"line_number":226,"context_line":"                for device in ip.get_devices(exclude_loopback\u003dTrue):"},{"line_number":227,"context_line":"                    unplug_device(conf, device)"},{"line_number":228,"context_line":""},{"line_number":229,"context_line":"        ip.garbage_collect_namespace()"},{"line_number":230,"context_line":"    except Exception:"}],"source_content_type":"text/x-python","patch_set":20,"id":"1a6eadb0_c59fbd4e","line":227,"range":{"start_line":226,"start_character":16,"end_line":227,"end_character":47},"in_reply_to":"1a6eadb0_0ad8e21c","updated":"2016-12-19 16:40:14.000000000","message":"we discussed this also and probably unplugging devices before would increase the chances that some processes fail","commit_id":"ed1b50991ebb8211610382bea4af76cdd0f06665"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"302dd12940692fb5b7153c3d6195d9a5094b94e3","unresolved":false,"context_lines":[{"line_number":223,"context_line":"            # so a second check is required here."},{"line_number":224,"context_line":"            if ip.netns.exists(namespace):"},{"line_number":225,"context_line":"                kill_listen_processes(namespace)"},{"line_number":226,"context_line":"                for device in ip.get_devices(exclude_loopback\u003dTrue):"},{"line_number":227,"context_line":"                    unplug_device(conf, device)"},{"line_number":228,"context_line":""},{"line_number":229,"context_line":"        ip.garbage_collect_namespace()"},{"line_number":230,"context_line":"    except Exception:"}],"source_content_type":"text/x-python","patch_set":20,"id":"1a6eadb0_694b23b1","line":227,"range":{"start_line":226,"start_character":16,"end_line":227,"end_character":47},"in_reply_to":"1a6eadb0_c59fbd4e","updated":"2016-12-19 16:49:23.000000000","message":"Correct, first kill process, then unplug interface.\n\nFor example, dnsmasq is known to do \"funny\" things with ovs if you do it the other way around.","commit_id":"ed1b50991ebb8211610382bea4af76cdd0f06665"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"9b454584c30c0ec32e3d69ac8e611aad9370b768","unresolved":false,"context_lines":[{"line_number":201,"context_line":"            common_utils.wait_until_true("},{"line_number":202,"context_line":"                lambda: not find_listen_pids_namespace(namespace),"},{"line_number":203,"context_line":"                timeout\u003dSIGTERM_WAITTIME,"},{"line_number":204,"context_line":"                exception\u003dException(SIGTERM_TIMEOUT_EXCEPTION))"},{"line_number":205,"context_line":"        except Exception as ex:"},{"line_number":206,"context_line":"            if str(ex) \u003d\u003d SIGTERM_TIMEOUT_EXCEPTION:"},{"line_number":207,"context_line":"                _kill_listen_processes(namespace, force\u003dTrue)"},{"line_number":208,"context_line":"            else:"},{"line_number":209,"context_line":"                raise"},{"line_number":210,"context_line":""},{"line_number":211,"context_line":""},{"line_number":212,"context_line":"def destroy_namespace(conf, namespace, force\u003dFalse):"}],"source_content_type":"text/x-python","patch_set":21,"id":"1a6eadb0_29d84bef","line":209,"range":{"start_line":204,"start_character":0,"end_line":209,"end_character":21},"updated":"2016-12-19 16:49:04.000000000","message":"Maybe better way is:\n\n class NoPidsInNamespaceException(Exception):\n     pass\n\n\n try:\n     wait_until_true(...\n         exception\u003dNoPidsInNamespaceException\n     )\n except NoPidsInNamespaceException:\n     _kill_listen_processes()","commit_id":"bd2079327062b2be38faa574298888f8fbdb878d"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"507729cc6c2a92efb5ff9bb7a15dedbea5006d1a","unresolved":false,"context_lines":[{"line_number":201,"context_line":"            common_utils.wait_until_true("},{"line_number":202,"context_line":"                lambda: not find_listen_pids_namespace(namespace),"},{"line_number":203,"context_line":"                timeout\u003dSIGTERM_WAITTIME,"},{"line_number":204,"context_line":"                exception\u003dException(SIGTERM_TIMEOUT_EXCEPTION))"},{"line_number":205,"context_line":"        except Exception as ex:"},{"line_number":206,"context_line":"            if str(ex) \u003d\u003d SIGTERM_TIMEOUT_EXCEPTION:"},{"line_number":207,"context_line":"                _kill_listen_processes(namespace, force\u003dTrue)"},{"line_number":208,"context_line":"            else:"},{"line_number":209,"context_line":"                raise"},{"line_number":210,"context_line":""},{"line_number":211,"context_line":""},{"line_number":212,"context_line":"def destroy_namespace(conf, namespace, force\u003dFalse):"}],"source_content_type":"text/x-python","patch_set":21,"id":"1a6eadb0_8c87ad11","line":209,"range":{"start_line":204,"start_character":0,"end_line":209,"end_character":21},"in_reply_to":"1a6eadb0_09770fd5","updated":"2016-12-19 17:00:51.000000000","message":"I\u0027m really sorry for not realizing that in previous PS :( It seems the constant string is just a workaround for getting functionality that can be solved by custom exception.","commit_id":"bd2079327062b2be38faa574298888f8fbdb878d"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"ba1dc705a8af5a9e39e9bfee5a31cc55de4ce7bd","unresolved":false,"context_lines":[{"line_number":201,"context_line":"            common_utils.wait_until_true("},{"line_number":202,"context_line":"                lambda: not find_listen_pids_namespace(namespace),"},{"line_number":203,"context_line":"                timeout\u003dSIGTERM_WAITTIME,"},{"line_number":204,"context_line":"                exception\u003dException(SIGTERM_TIMEOUT_EXCEPTION))"},{"line_number":205,"context_line":"        except Exception as ex:"},{"line_number":206,"context_line":"            if str(ex) \u003d\u003d SIGTERM_TIMEOUT_EXCEPTION:"},{"line_number":207,"context_line":"                _kill_listen_processes(namespace, force\u003dTrue)"},{"line_number":208,"context_line":"            else:"},{"line_number":209,"context_line":"                raise"},{"line_number":210,"context_line":""},{"line_number":211,"context_line":""},{"line_number":212,"context_line":"def destroy_namespace(conf, namespace, force\u003dFalse):"}],"source_content_type":"text/x-python","patch_set":21,"id":"1a6eadb0_09770fd5","line":209,"range":{"start_line":204,"start_character":0,"end_line":209,"end_character":21},"in_reply_to":"1a6eadb0_29d84bef","updated":"2016-12-19 16:51:59.000000000","message":"/me hears Daniel swearing  XDDD lol, he\u0027s changing it now ;)","commit_id":"bd2079327062b2be38faa574298888f8fbdb878d"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"ac9994c7ac5eb16606737045a9b1827f04c997a9","unresolved":false,"context_lines":[{"line_number":201,"context_line":"            common_utils.wait_until_true("},{"line_number":202,"context_line":"                lambda: not find_listen_pids_namespace(namespace),"},{"line_number":203,"context_line":"                timeout\u003dSIGTERM_WAITTIME,"},{"line_number":204,"context_line":"                exception\u003dException(SIGTERM_TIMEOUT_EXCEPTION))"},{"line_number":205,"context_line":"        except Exception as ex:"},{"line_number":206,"context_line":"            if str(ex) \u003d\u003d SIGTERM_TIMEOUT_EXCEPTION:"},{"line_number":207,"context_line":"                _kill_listen_processes(namespace, force\u003dTrue)"},{"line_number":208,"context_line":"            else:"},{"line_number":209,"context_line":"                raise"},{"line_number":210,"context_line":""},{"line_number":211,"context_line":""},{"line_number":212,"context_line":"def destroy_namespace(conf, namespace, force\u003dFalse):"}],"source_content_type":"text/x-python","patch_set":21,"id":"1a6eadb0_0ccabd4f","line":209,"range":{"start_line":204,"start_character":0,"end_line":209,"end_character":21},"in_reply_to":"1a6eadb0_8c87ad11","updated":"2016-12-19 17:02:00.000000000","message":"Np, he actually agreed AFAIK :)","commit_id":"bd2079327062b2be38faa574298888f8fbdb878d"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"68f6a08bce1d01e497f406ae917ad0540ddd9be0","unresolved":false,"context_lines":[{"line_number":48,"context_line":"    \u0027lbaas\u0027: [LB_NS_PREFIX],"},{"line_number":49,"context_line":"}"},{"line_number":50,"context_line":"SIGTERM_WAITTIME \u003d 10"},{"line_number":51,"context_line":"SIGTERM_TIMEOUT_EXCEPTION \u003d \u0027SIGTERM Timeout\u0027"},{"line_number":52,"context_line":"NETSTAT_PIDS_REGEX \u003d re.compile(r\u0027.* (?P\u003cpid\u003e\\d{2,6})/.*\u0027)"},{"line_number":53,"context_line":""},{"line_number":54,"context_line":""}],"source_content_type":"text/x-python","patch_set":22,"id":"1a6eadb0_0cb0fd8a","line":51,"updated":"2016-12-19 17:10:16.000000000","message":"Not used now","commit_id":"49cb5963963d2dc653fe929244f18b732e87093b"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"68f6a08bce1d01e497f406ae917ad0540ddd9be0","unresolved":false,"context_lines":[{"line_number":185,"context_line":"        try:"},{"line_number":186,"context_line":"            utils.kill_process(pid, kill_signal, run_as_root\u003dTrue)"},{"line_number":187,"context_line":"        except Exception as ex:"},{"line_number":188,"context_line":"            LOG.error(_LE(\u0027An error occurred while killing \\"},{"line_number":189,"context_line":"                          [%(pid)s]: %(msg)s\u0027), {\u0027pid\u0027: pid, \u0027msg\u0027: ex})"},{"line_number":190,"context_line":"    return len(pids)"},{"line_number":191,"context_line":""}],"source_content_type":"text/x-python","patch_set":22,"id":"1a6eadb0_2c5bf955","line":188,"range":{"start_line":188,"start_character":59,"end_line":188,"end_character":60},"updated":"2016-12-19 17:10:16.000000000","message":"This will print wrong I think. You should close the string and open it on another line:\n\n LOG.error(_LE(\u0027An error bla bla \u0027\n                          \u0027 bla bla bla\u0027, {params})\n\notherwise this would print lots of white spaces:\n\n An error occurred while killing \\                          [\u003cpidNumber]","commit_id":"49cb5963963d2dc653fe929244f18b732e87093b"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"72bc70e5adfb9a6fb2acc1124492f5638ec70bdf","unresolved":false,"context_lines":[{"line_number":185,"context_line":"        try:"},{"line_number":186,"context_line":"            utils.kill_process(pid, kill_signal, run_as_root\u003dTrue)"},{"line_number":187,"context_line":"        except Exception as ex:"},{"line_number":188,"context_line":"            LOG.error(_LE(\u0027An error occurred while killing \\"},{"line_number":189,"context_line":"                          [%(pid)s]: %(msg)s\u0027), {\u0027pid\u0027: pid, \u0027msg\u0027: ex})"},{"line_number":190,"context_line":"    return len(pids)"},{"line_number":191,"context_line":""}],"source_content_type":"text/x-python","patch_set":22,"id":"1a6eadb0_cf57d7c8","line":188,"range":{"start_line":188,"start_character":59,"end_line":188,"end_character":60},"in_reply_to":"1a6eadb0_2c5bf955","updated":"2016-12-19 17:17:45.000000000","message":"Done","commit_id":"49cb5963963d2dc653fe929244f18b732e87093b"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"4149ec5a240f152ae220a7288ea744702e0d221b","unresolved":false,"context_lines":[{"line_number":48,"context_line":"    \u0027lbaas\u0027: [LB_NS_PREFIX],"},{"line_number":49,"context_line":"}"},{"line_number":50,"context_line":"SIGTERM_WAITTIME \u003d 10"},{"line_number":51,"context_line":"SIGTERM_TIMEOUT_EXCEPTION \u003d \u0027SIGTERM Timeout\u0027"},{"line_number":52,"context_line":"NETSTAT_PIDS_REGEX \u003d re.compile(r\u0027.* (?P\u003cpid\u003e\\d{2,6})/.*\u0027)"},{"line_number":53,"context_line":""},{"line_number":54,"context_line":""}],"source_content_type":"text/x-python","patch_set":23,"id":"1a6eadb0_8c624d15","line":51,"updated":"2016-12-19 17:07:48.000000000","message":"you can remove this constant now :)","commit_id":"48b864ffeee42d35a399e4d61d809ea68cf50e4e"}],"neutron/tests/functional/cmd/process_spawn.py":[{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"d120739a779c265a9ebf16ccf5a72608325a9f89","unresolved":false,"context_lines":[{"line_number":27,"context_line":""},{"line_number":28,"context_line":"def main():"},{"line_number":29,"context_line":""},{"line_number":30,"context_line":"    class ProcessSpawn(daemon.Daemon):"},{"line_number":31,"context_line":"        \"\"\""},{"line_number":32,"context_line":"        This class is part of the functional test of the netns_cleanup module."},{"line_number":33,"context_line":"        It allows spawning processes that listen on random ports either on"}],"source_content_type":"text/x-python","patch_set":13,"id":"1a6eadb0_76178551","line":30,"range":{"start_line":30,"start_character":4,"end_line":30,"end_character":38},"updated":"2016-12-13 10:47:16.000000000","message":"Is there a reason this is in the main function()? It belongs to module level.","commit_id":"7057de2d829dbfef7c74aea617724d068a8ba7ae"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"10b8c9436a23cfc617439a346457dcaf8f1be9ac","unresolved":false,"context_lines":[{"line_number":27,"context_line":""},{"line_number":28,"context_line":"def main():"},{"line_number":29,"context_line":""},{"line_number":30,"context_line":"    class ProcessSpawn(daemon.Daemon):"},{"line_number":31,"context_line":"        \"\"\""},{"line_number":32,"context_line":"        This class is part of the functional test of the netns_cleanup module."},{"line_number":33,"context_line":"        It allows spawning processes that listen on random ports either on"}],"source_content_type":"text/x-python","patch_set":13,"id":"1a6eadb0_6a20769c","line":30,"range":{"start_line":30,"start_character":4,"end_line":30,"end_character":38},"in_reply_to":"1a6eadb0_76178551","updated":"2016-12-13 11:50:29.000000000","message":"Not really... i took this as a base: \nhttps://github.com/openstack/neutron/blob/master/neutron/tests/functional/agent/linux/simple_daemon.py","commit_id":"7057de2d829dbfef7c74aea617724d068a8ba7ae"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"d120739a779c265a9ebf16ccf5a72608325a9f89","unresolved":false,"context_lines":[{"line_number":51,"context_line":"            super(ProcessSpawn, self).__init__(pidfile)"},{"line_number":52,"context_line":""},{"line_number":53,"context_line":"        def start_listening(self):"},{"line_number":54,"context_line":"            dct_family \u003d {"},{"line_number":55,"context_line":"                \u0027v4\u0027: socket.AF_INET,"},{"line_number":56,"context_line":"                \u0027v6\u0027: socket.AF_INET6,"},{"line_number":57,"context_line":"                \u0027unix\u0027: socket.AF_UNIX"},{"line_number":58,"context_line":"            }"},{"line_number":59,"context_line":"            dct_proto \u003d {"},{"line_number":60,"context_line":"                \u0027tcp\u0027: socket.SOCK_STREAM,"},{"line_number":61,"context_line":"                \u0027udp\u0027: socket.SOCK_DGRAM,"},{"line_number":62,"context_line":"            }"},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"            try:"},{"line_number":65,"context_line":"                socket_family \u003d dct_family[self.family]"}],"source_content_type":"text/x-python","patch_set":13,"id":"1a6eadb0_1974c29a","line":62,"range":{"start_line":54,"start_character":0,"end_line":62,"end_character":13},"updated":"2016-12-13 10:47:16.000000000","message":"These seems like constants. They should be moved to the module level.","commit_id":"7057de2d829dbfef7c74aea617724d068a8ba7ae"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"10b8c9436a23cfc617439a346457dcaf8f1be9ac","unresolved":false,"context_lines":[{"line_number":51,"context_line":"            super(ProcessSpawn, self).__init__(pidfile)"},{"line_number":52,"context_line":""},{"line_number":53,"context_line":"        def start_listening(self):"},{"line_number":54,"context_line":"            dct_family \u003d {"},{"line_number":55,"context_line":"                \u0027v4\u0027: socket.AF_INET,"},{"line_number":56,"context_line":"                \u0027v6\u0027: socket.AF_INET6,"},{"line_number":57,"context_line":"                \u0027unix\u0027: socket.AF_UNIX"},{"line_number":58,"context_line":"            }"},{"line_number":59,"context_line":"            dct_proto \u003d {"},{"line_number":60,"context_line":"                \u0027tcp\u0027: socket.SOCK_STREAM,"},{"line_number":61,"context_line":"                \u0027udp\u0027: socket.SOCK_DGRAM,"},{"line_number":62,"context_line":"            }"},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"            try:"},{"line_number":65,"context_line":"                socket_family \u003d dct_family[self.family]"}],"source_content_type":"text/x-python","patch_set":13,"id":"1a6eadb0_6ffec86c","line":62,"range":{"start_line":54,"start_character":0,"end_line":62,"end_character":13},"in_reply_to":"1a6eadb0_1974c29a","updated":"2016-12-13 11:50:29.000000000","message":"Done","commit_id":"7057de2d829dbfef7c74aea617724d068a8ba7ae"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"d120739a779c265a9ebf16ccf5a72608325a9f89","unresolved":false,"context_lines":[{"line_number":65,"context_line":"                socket_family \u003d dct_family[self.family]"},{"line_number":66,"context_line":"                socket_type \u003d dct_proto[self.proto]"},{"line_number":67,"context_line":"            except KeyError:"},{"line_number":68,"context_line":"                return False"},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"            self.listen_socket \u003d socket.socket(socket_family, socket_type)"},{"line_number":71,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"1a6eadb0_790e9635","line":68,"range":{"start_line":68,"start_character":16,"end_line":68,"end_character":28},"updated":"2016-12-13 10:47:16.000000000","message":"It\u0027s not used anywhere","commit_id":"7057de2d829dbfef7c74aea617724d068a8ba7ae"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"10b8c9436a23cfc617439a346457dcaf8f1be9ac","unresolved":false,"context_lines":[{"line_number":65,"context_line":"                socket_family \u003d dct_family[self.family]"},{"line_number":66,"context_line":"                socket_type \u003d dct_proto[self.proto]"},{"line_number":67,"context_line":"            except KeyError:"},{"line_number":68,"context_line":"                return False"},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"            self.listen_socket \u003d socket.socket(socket_family, socket_type)"},{"line_number":71,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"1a6eadb0_6a09562c","line":68,"range":{"start_line":68,"start_character":16,"end_line":68,"end_character":28},"in_reply_to":"1a6eadb0_790e9635","updated":"2016-12-13 11:50:29.000000000","message":"Done","commit_id":"7057de2d829dbfef7c74aea617724d068a8ba7ae"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"d120739a779c265a9ebf16ccf5a72608325a9f89","unresolved":false,"context_lines":[{"line_number":72,"context_line":"            # Try to listen in a random port which is not currently in use"},{"line_number":73,"context_line":"            retries \u003d 0"},{"line_number":74,"context_line":"            done \u003d False"},{"line_number":75,"context_line":"            while not done and retries \u003c ProcessSpawn.MAX_BIND_RETRIES:"},{"line_number":76,"context_line":"                try:"},{"line_number":77,"context_line":"                    if self.family \u003d\u003d \u0027unix\u0027:"},{"line_number":78,"context_line":"                        self.listen_socket.bind(\u0027\u0027)"},{"line_number":79,"context_line":"                    else:"},{"line_number":80,"context_line":"                        port \u003d self._get_random_port()"},{"line_number":81,"context_line":"                        self.listen_socket.bind((\u0027\u0027, port))"},{"line_number":82,"context_line":"                    done \u003d True"},{"line_number":83,"context_line":"                except socket.error:"},{"line_number":84,"context_line":"                    retries +\u003d 1"},{"line_number":85,"context_line":""},{"line_number":86,"context_line":"            if done and \u0027tcp\u0027 in self.proto:"},{"line_number":87,"context_line":"                self.listen_socket.listen(0)"},{"line_number":88,"context_line":"            return done"},{"line_number":89,"context_line":""},{"line_number":90,"context_line":"        def do_sleep(self):"}],"source_content_type":"text/x-python","patch_set":13,"id":"1a6eadb0_192cc249","line":87,"range":{"start_line":75,"start_character":0,"end_line":87,"end_character":44},"updated":"2016-12-13 10:47:16.000000000","message":"Suggestion:\n\n while retries \u003c ProcessSpawn.MAX_BIND_RETRIES:\n     try:\n         \u003cdo_stuff\u003e\n         break\n     except socket.error:\n         retries +\u003d 1\n     else:\n         \u003cmaybe log some error message\u003e\n         return\n\n     if self.proto \u003d\u003d constants.PROTO_NAME_TCP:\n         self.listen_socket.listen(0)","commit_id":"7057de2d829dbfef7c74aea617724d068a8ba7ae"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"ac2f1ea78230d8fca45e4a8d1a8805722b722b3b","unresolved":false,"context_lines":[{"line_number":72,"context_line":"            # Try to listen in a random port which is not currently in use"},{"line_number":73,"context_line":"            retries \u003d 0"},{"line_number":74,"context_line":"            done \u003d False"},{"line_number":75,"context_line":"            while not done and retries \u003c ProcessSpawn.MAX_BIND_RETRIES:"},{"line_number":76,"context_line":"                try:"},{"line_number":77,"context_line":"                    if self.family \u003d\u003d \u0027unix\u0027:"},{"line_number":78,"context_line":"                        self.listen_socket.bind(\u0027\u0027)"},{"line_number":79,"context_line":"                    else:"},{"line_number":80,"context_line":"                        port \u003d self._get_random_port()"},{"line_number":81,"context_line":"                        self.listen_socket.bind((\u0027\u0027, port))"},{"line_number":82,"context_line":"                    done \u003d True"},{"line_number":83,"context_line":"                except socket.error:"},{"line_number":84,"context_line":"                    retries +\u003d 1"},{"line_number":85,"context_line":""},{"line_number":86,"context_line":"            if done and \u0027tcp\u0027 in self.proto:"},{"line_number":87,"context_line":"                self.listen_socket.listen(0)"},{"line_number":88,"context_line":"            return done"},{"line_number":89,"context_line":""},{"line_number":90,"context_line":"        def do_sleep(self):"}],"source_content_type":"text/x-python","patch_set":13,"id":"1a6eadb0_6f8ec379","line":87,"range":{"start_line":75,"start_character":0,"end_line":87,"end_character":44},"in_reply_to":"1a6eadb0_0fd9d421","updated":"2016-12-13 13:03:05.000000000","message":"Sorry, I put wrong indentation here, should be:\n\n while retries \u003c ProcessSpawn.MAX_BIND_RETRIES:\n     try:\n         \u003cdo_stuff\u003e\n         break\n     except socket.error:\n         retries +\u003d 1\n else:\n     \u003cmaybe log some error message\u003e\n     return\n if self.proto \u003d\u003d constants.PROTO_NAME_TCP:\n     self.listen_socket.listen(0)","commit_id":"7057de2d829dbfef7c74aea617724d068a8ba7ae"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"10b8c9436a23cfc617439a346457dcaf8f1be9ac","unresolved":false,"context_lines":[{"line_number":72,"context_line":"            # Try to listen in a random port which is not currently in use"},{"line_number":73,"context_line":"            retries \u003d 0"},{"line_number":74,"context_line":"            done \u003d False"},{"line_number":75,"context_line":"            while not done and retries \u003c ProcessSpawn.MAX_BIND_RETRIES:"},{"line_number":76,"context_line":"                try:"},{"line_number":77,"context_line":"                    if self.family \u003d\u003d \u0027unix\u0027:"},{"line_number":78,"context_line":"                        self.listen_socket.bind(\u0027\u0027)"},{"line_number":79,"context_line":"                    else:"},{"line_number":80,"context_line":"                        port \u003d self._get_random_port()"},{"line_number":81,"context_line":"                        self.listen_socket.bind((\u0027\u0027, port))"},{"line_number":82,"context_line":"                    done \u003d True"},{"line_number":83,"context_line":"                except socket.error:"},{"line_number":84,"context_line":"                    retries +\u003d 1"},{"line_number":85,"context_line":""},{"line_number":86,"context_line":"            if done and \u0027tcp\u0027 in self.proto:"},{"line_number":87,"context_line":"                self.listen_socket.listen(0)"},{"line_number":88,"context_line":"            return done"},{"line_number":89,"context_line":""},{"line_number":90,"context_line":"        def do_sleep(self):"}],"source_content_type":"text/x-python","patch_set":13,"id":"1a6eadb0_0fd9d421","line":87,"range":{"start_line":75,"start_character":0,"end_line":87,"end_character":44},"in_reply_to":"1a6eadb0_192cc249","updated":"2016-12-13 11:50:29.000000000","message":"Done","commit_id":"7057de2d829dbfef7c74aea617724d068a8ba7ae"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"d120739a779c265a9ebf16ccf5a72608325a9f89","unresolved":false,"context_lines":[{"line_number":95,"context_line":"            # Spawn as many children as requested"},{"line_number":96,"context_line":"            children \u003d []"},{"line_number":97,"context_line":"            num_children \u003d self.num_children"},{"line_number":98,"context_line":"            while num_children \u003e 0:"},{"line_number":99,"context_line":"                child_pid \u003d os.fork()"},{"line_number":100,"context_line":"                if child_pid \u003d\u003d 0:"},{"line_number":101,"context_line":"                    # Listen and do nothing else"}],"source_content_type":"text/x-python","patch_set":13,"id":"1a6eadb0_59b0fadd","line":98,"range":{"start_line":98,"start_character":18,"end_line":98,"end_character":34},"updated":"2016-12-13 10:47:16.000000000","message":"Nit: You could omit num_children if you\u0027d use\n\n while len(children) !\u003d self.num_children:","commit_id":"7057de2d829dbfef7c74aea617724d068a8ba7ae"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"10b8c9436a23cfc617439a346457dcaf8f1be9ac","unresolved":false,"context_lines":[{"line_number":95,"context_line":"            # Spawn as many children as requested"},{"line_number":96,"context_line":"            children \u003d []"},{"line_number":97,"context_line":"            num_children \u003d self.num_children"},{"line_number":98,"context_line":"            while num_children \u003e 0:"},{"line_number":99,"context_line":"                child_pid \u003d os.fork()"},{"line_number":100,"context_line":"                if child_pid \u003d\u003d 0:"},{"line_number":101,"context_line":"                    # Listen and do nothing else"}],"source_content_type":"text/x-python","patch_set":13,"id":"1a6eadb0_8f408458","line":98,"range":{"start_line":98,"start_character":18,"end_line":98,"end_character":34},"in_reply_to":"1a6eadb0_59b0fadd","updated":"2016-12-13 11:50:29.000000000","message":"Done","commit_id":"7057de2d829dbfef7c74aea617724d068a8ba7ae"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"d120739a779c265a9ebf16ccf5a72608325a9f89","unresolved":false,"context_lines":[{"line_number":100,"context_line":"                if child_pid \u003d\u003d 0:"},{"line_number":101,"context_line":"                    # Listen and do nothing else"},{"line_number":102,"context_line":"                    self.start_listening()"},{"line_number":103,"context_line":"                    self.do_sleep()"},{"line_number":104,"context_line":"                num_children -\u003d 1"},{"line_number":105,"context_line":"                children.append(child_pid)"},{"line_number":106,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"1a6eadb0_198f6224","line":103,"updated":"2016-12-13 10:47:16.000000000","message":"It would be safer to call return after this line","commit_id":"7057de2d829dbfef7c74aea617724d068a8ba7ae"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"10b8c9436a23cfc617439a346457dcaf8f1be9ac","unresolved":false,"context_lines":[{"line_number":100,"context_line":"                if child_pid \u003d\u003d 0:"},{"line_number":101,"context_line":"                    # Listen and do nothing else"},{"line_number":102,"context_line":"                    self.start_listening()"},{"line_number":103,"context_line":"                    self.do_sleep()"},{"line_number":104,"context_line":"                num_children -\u003d 1"},{"line_number":105,"context_line":"                children.append(child_pid)"},{"line_number":106,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"1a6eadb0_ef93b8f8","line":103,"in_reply_to":"1a6eadb0_198f6224","updated":"2016-12-13 11:50:29.000000000","message":"Done","commit_id":"7057de2d829dbfef7c74aea617724d068a8ba7ae"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"d120739a779c265a9ebf16ccf5a72608325a9f89","unresolved":false,"context_lines":[{"line_number":102,"context_line":"                    self.start_listening()"},{"line_number":103,"context_line":"                    self.do_sleep()"},{"line_number":104,"context_line":"                num_children -\u003d 1"},{"line_number":105,"context_line":"                children.append(child_pid)"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"            # Install a SIGTERM handler if requested"},{"line_number":108,"context_line":"            if not self.ignore_sigterm:"}],"source_content_type":"text/x-python","patch_set":13,"id":"1a6eadb0_3917bea4","line":105,"range":{"start_line":105,"start_character":16,"end_line":105,"end_character":24},"updated":"2016-12-13 10:47:16.000000000","message":"Why not using self.child_pids directly?","commit_id":"7057de2d829dbfef7c74aea617724d068a8ba7ae"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"10b8c9436a23cfc617439a346457dcaf8f1be9ac","unresolved":false,"context_lines":[{"line_number":102,"context_line":"                    self.start_listening()"},{"line_number":103,"context_line":"                    self.do_sleep()"},{"line_number":104,"context_line":"                num_children -\u003d 1"},{"line_number":105,"context_line":"                children.append(child_pid)"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"            # Install a SIGTERM handler if requested"},{"line_number":108,"context_line":"            if not self.ignore_sigterm:"}],"source_content_type":"text/x-python","patch_set":13,"id":"1a6eadb0_af89c0cc","line":105,"range":{"start_line":105,"start_character":16,"end_line":105,"end_character":24},"in_reply_to":"1a6eadb0_3917bea4","updated":"2016-12-13 11:50:29.000000000","message":"If I use child_pids directly, then this would be modified for all spawned processes and on SIGTERM, all of them will try to kill each element of this list. By using \u0027children\u0027 and assigning self.child_pids to it later, I\u0027m making sure that only the parent has it populated","commit_id":"7057de2d829dbfef7c74aea617724d068a8ba7ae"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"d120739a779c265a9ebf16ccf5a72608325a9f89","unresolved":false,"context_lines":[{"line_number":128,"context_line":"                    pass"},{"line_number":129,"context_line":"            sys.exit(0)"},{"line_number":130,"context_line":""},{"line_number":131,"context_line":"    opts \u003d ["},{"line_number":132,"context_line":"        cfg.IntOpt(\u0027num_children\u0027,"},{"line_number":133,"context_line":"                   short\u003d\u0027n\u0027,"},{"line_number":134,"context_line":"                   default\u003d0,"}],"source_content_type":"text/x-python","patch_set":13,"id":"1a6eadb0_f97466fe","line":131,"range":{"start_line":131,"start_character":4,"end_line":131,"end_character":8},"updated":"2016-12-13 10:47:16.000000000","message":"This is constant, should be on module level","commit_id":"7057de2d829dbfef7c74aea617724d068a8ba7ae"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"10b8c9436a23cfc617439a346457dcaf8f1be9ac","unresolved":false,"context_lines":[{"line_number":128,"context_line":"                    pass"},{"line_number":129,"context_line":"            sys.exit(0)"},{"line_number":130,"context_line":""},{"line_number":131,"context_line":"    opts \u003d ["},{"line_number":132,"context_line":"        cfg.IntOpt(\u0027num_children\u0027,"},{"line_number":133,"context_line":"                   short\u003d\u0027n\u0027,"},{"line_number":134,"context_line":"                   default\u003d0,"}],"source_content_type":"text/x-python","patch_set":13,"id":"1a6eadb0_2a4d9e72","line":131,"range":{"start_line":131,"start_character":4,"end_line":131,"end_character":8},"in_reply_to":"1a6eadb0_f97466fe","updated":"2016-12-13 11:50:29.000000000","message":"Done","commit_id":"7057de2d829dbfef7c74aea617724d068a8ba7ae"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"bf0917abf63488871166520cb66e5ed89cfb68da","unresolved":false,"context_lines":[{"line_number":85,"context_line":"                    self.listen_socket.bind((\u0027\u0027, port))"},{"line_number":86,"context_line":"            except socket.error:"},{"line_number":87,"context_line":"                retries +\u003d 1"},{"line_number":88,"context_line":"            else:"},{"line_number":89,"context_line":"                if n_const.PROTO_NAME_TCP in self.proto:"},{"line_number":90,"context_line":"                    self.listen_socket.listen(0)"},{"line_number":91,"context_line":"                break"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a6eadb0_33e4040c","line":88,"range":{"start_line":88,"start_character":12,"end_line":88,"end_character":17},"updated":"2016-12-14 10:34:56.000000000","message":"The idea was that else clause belongs to \u0027while\u0027 so L90 is executed after while loop was successful","commit_id":"d823c360987bd85bdb90327e5b10cb6b787c2920"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"ed8d34f153db4b3a68c577958d8bc8489d2f0fe3","unresolved":false,"context_lines":[{"line_number":85,"context_line":"                    self.listen_socket.bind((\u0027\u0027, port))"},{"line_number":86,"context_line":"            except socket.error:"},{"line_number":87,"context_line":"                retries +\u003d 1"},{"line_number":88,"context_line":"            else:"},{"line_number":89,"context_line":"                if n_const.PROTO_NAME_TCP in self.proto:"},{"line_number":90,"context_line":"                    self.listen_socket.listen(0)"},{"line_number":91,"context_line":"                break"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a6eadb0_94d4de20","line":88,"range":{"start_line":88,"start_character":12,"end_line":88,"end_character":17},"in_reply_to":"1a6eadb0_33e4040c","updated":"2016-12-14 13:35:04.000000000","message":"Done","commit_id":"d823c360987bd85bdb90327e5b10cb6b787c2920"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"bf0917abf63488871166520cb66e5ed89cfb68da","unresolved":false,"context_lines":[{"line_number":118,"context_line":"    @staticmethod"},{"line_number":119,"context_line":"    def _get_random_port():"},{"line_number":120,"context_line":"        random.seed(os.getpid())"},{"line_number":121,"context_line":"        return random.randint(1024, 65535)"},{"line_number":122,"context_line":""},{"line_number":123,"context_line":"    def sigterm_handler(self, signum, frame):"},{"line_number":124,"context_line":"        if self.listen_socket:"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a6eadb0_a10c6795","line":121,"range":{"start_line":121,"start_character":0,"end_line":121,"end_character":42},"updated":"2016-12-14 10:34:56.000000000","message":"What if the generated port is in use here? Would it be safer to use https://github.com/openstack/neutron/blob/master/neutron/tests/common/net_helpers.py#L195 ?\n\nI know this is executed in its own namespace and thus there are no running processes - I just suggest to be more defensive.","commit_id":"d823c360987bd85bdb90327e5b10cb6b787c2920"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"ed8d34f153db4b3a68c577958d8bc8489d2f0fe3","unresolved":false,"context_lines":[{"line_number":118,"context_line":"    @staticmethod"},{"line_number":119,"context_line":"    def _get_random_port():"},{"line_number":120,"context_line":"        random.seed(os.getpid())"},{"line_number":121,"context_line":"        return random.randint(1024, 65535)"},{"line_number":122,"context_line":""},{"line_number":123,"context_line":"    def sigterm_handler(self, signum, frame):"},{"line_number":124,"context_line":"        if self.listen_socket:"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a6eadb0_14e9aee6","line":121,"range":{"start_line":121,"start_character":0,"end_line":121,"end_character":42},"in_reply_to":"1a6eadb0_a10c6795","updated":"2016-12-14 13:35:04.000000000","message":"Done","commit_id":"d823c360987bd85bdb90327e5b10cb6b787c2920"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"bf0917abf63488871166520cb66e5ed89cfb68da","unresolved":false,"context_lines":[{"line_number":131,"context_line":"        sys.exit(0)"},{"line_number":132,"context_line":""},{"line_number":133,"context_line":""},{"line_number":134,"context_line":"opts \u003d ["},{"line_number":135,"context_line":"    cfg.IntOpt(\u0027num_children\u0027,"},{"line_number":136,"context_line":"               short\u003d\u0027n\u0027,"},{"line_number":137,"context_line":"               default\u003d0,"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a6eadb0_8194cb37","line":134,"range":{"start_line":134,"start_character":0,"end_line":134,"end_character":4},"updated":"2016-12-14 10:34:56.000000000","message":"Nit: constants are usually first and then functions and then classes","commit_id":"d823c360987bd85bdb90327e5b10cb6b787c2920"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"ed8d34f153db4b3a68c577958d8bc8489d2f0fe3","unresolved":false,"context_lines":[{"line_number":131,"context_line":"        sys.exit(0)"},{"line_number":132,"context_line":""},{"line_number":133,"context_line":""},{"line_number":134,"context_line":"opts \u003d ["},{"line_number":135,"context_line":"    cfg.IntOpt(\u0027num_children\u0027,"},{"line_number":136,"context_line":"               short\u003d\u0027n\u0027,"},{"line_number":137,"context_line":"               default\u003d0,"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a6eadb0_0b3c2c2e","line":134,"range":{"start_line":134,"start_character":0,"end_line":134,"end_character":4},"in_reply_to":"1a6eadb0_8194cb37","updated":"2016-12-14 13:35:04.000000000","message":"Done","commit_id":"d823c360987bd85bdb90327e5b10cb6b787c2920"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"8c22c87405ce8359bc8714165a64c0d84a0be302","unresolved":false,"context_lines":[{"line_number":109,"context_line":"            socket_family \u003d self.DCT_FAMILY[self.family]"},{"line_number":110,"context_line":"            socket_type \u003d self.DCT_PROTO[self.proto]"},{"line_number":111,"context_line":"        except KeyError:"},{"line_number":112,"context_line":"            return"},{"line_number":113,"context_line":""},{"line_number":114,"context_line":"        self.listen_socket \u003d socket.socket(socket_family, socket_type)"},{"line_number":115,"context_line":""}],"source_content_type":"text/x-python","patch_set":19,"id":"1a6eadb0_429f4c50","line":112,"range":{"start_line":112,"start_character":12,"end_line":112,"end_character":18},"updated":"2016-12-18 07:52:39.000000000","message":"Actually I think that if the wrong protocol/family was provided, we want to fail the test since something has gone wrong - this will silently ignore the error and will make debugging difficult. I\u0027d just ignore the error and raise the KeyError as it is.","commit_id":"5f3419013466d534ed2f5f37c528d4fc46d7e0fc"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"12eeccd5bf1ef9327d5ee4e77be403465e606beb","unresolved":false,"context_lines":[{"line_number":109,"context_line":"            socket_family \u003d self.DCT_FAMILY[self.family]"},{"line_number":110,"context_line":"            socket_type \u003d self.DCT_PROTO[self.proto]"},{"line_number":111,"context_line":"        except KeyError:"},{"line_number":112,"context_line":"            return"},{"line_number":113,"context_line":""},{"line_number":114,"context_line":"        self.listen_socket \u003d socket.socket(socket_family, socket_type)"},{"line_number":115,"context_line":""}],"source_content_type":"text/x-python","patch_set":19,"id":"1a6eadb0_c7f0b7cc","line":112,"range":{"start_line":112,"start_character":12,"end_line":112,"end_character":18},"in_reply_to":"1a6eadb0_429f4c50","updated":"2016-12-19 13:42:53.000000000","message":"Done","commit_id":"5f3419013466d534ed2f5f37c528d4fc46d7e0fc"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"8c22c87405ce8359bc8714165a64c0d84a0be302","unresolved":false,"context_lines":[{"line_number":118,"context_line":"        while retries \u003c ProcessSpawn.MAX_BIND_RETRIES:"},{"line_number":119,"context_line":"            try:"},{"line_number":120,"context_line":"                if self.family \u003d\u003d UNIX_FAMILY:"},{"line_number":121,"context_line":"                    self.listen_socket.bind(\u0027\u0027)"},{"line_number":122,"context_line":"                else:"},{"line_number":123,"context_line":"                    port \u003d net_helpers.get_free_namespace_port(self.proto)"},{"line_number":124,"context_line":"                    self.listen_socket.bind((\u0027\u0027, port))"}],"source_content_type":"text/x-python","patch_set":19,"id":"1a6eadb0_82a9647e","line":121,"range":{"start_line":121,"start_character":44,"end_line":121,"end_character":47},"updated":"2016-12-18 07:52:39.000000000","message":"Shouldn\u0027t bind() just receive no args in this case?","commit_id":"5f3419013466d534ed2f5f37c528d4fc46d7e0fc"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"12eeccd5bf1ef9327d5ee4e77be403465e606beb","unresolved":false,"context_lines":[{"line_number":118,"context_line":"        while retries \u003c ProcessSpawn.MAX_BIND_RETRIES:"},{"line_number":119,"context_line":"            try:"},{"line_number":120,"context_line":"                if self.family \u003d\u003d UNIX_FAMILY:"},{"line_number":121,"context_line":"                    self.listen_socket.bind(\u0027\u0027)"},{"line_number":122,"context_line":"                else:"},{"line_number":123,"context_line":"                    port \u003d net_helpers.get_free_namespace_port(self.proto)"},{"line_number":124,"context_line":"                    self.listen_socket.bind((\u0027\u0027, port))"}],"source_content_type":"text/x-python","patch_set":19,"id":"1a6eadb0_c70277b4","line":121,"range":{"start_line":121,"start_character":44,"end_line":121,"end_character":47},"in_reply_to":"1a6eadb0_82a9647e","updated":"2016-12-19 13:42:53.000000000","message":"No, it takes one arg:\n\n\u003e\u003e\u003e s.bind()\nTraceback (most recent call last):\n  File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\n  File \"/usr/lib64/python2.7/socket.py\", line 224, in meth\n    return getattr(self._sock,name)(*args)\nTypeError: bind() takes exactly one argument (0 given)","commit_id":"5f3419013466d534ed2f5f37c528d4fc46d7e0fc"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"8c22c87405ce8359bc8714165a64c0d84a0be302","unresolved":false,"context_lines":[{"line_number":121,"context_line":"                    self.listen_socket.bind(\u0027\u0027)"},{"line_number":122,"context_line":"                else:"},{"line_number":123,"context_line":"                    port \u003d net_helpers.get_free_namespace_port(self.proto)"},{"line_number":124,"context_line":"                    self.listen_socket.bind((\u0027\u0027, port))"},{"line_number":125,"context_line":"            except socket.error:"},{"line_number":126,"context_line":"                retries +\u003d 1"},{"line_number":127,"context_line":"            else:"}],"source_content_type":"text/x-python","patch_set":19,"id":"1a6eadb0_42c66c4a","line":124,"updated":"2016-12-18 07:52:39.000000000","message":"nit: Again, something like the following can be done:\n\n bind_arg \u003d \u0027\u0027\n if self.family !\u003d UNIX_FAMILY:\n     bind_arg \u003d (\u0027\u0027, port)\n self.listen_socket.bind(bind_arg)","commit_id":"5f3419013466d534ed2f5f37c528d4fc46d7e0fc"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"8c22c87405ce8359bc8714165a64c0d84a0be302","unresolved":false,"context_lines":[{"line_number":135,"context_line":""},{"line_number":136,"context_line":"    def run(self):"},{"line_number":137,"context_line":"        # Spawn as many children as requested"},{"line_number":138,"context_line":"        children \u003d []"},{"line_number":139,"context_line":"        while len(children) !\u003d self.num_children:"},{"line_number":140,"context_line":"            child_pid \u003d os.fork()"},{"line_number":141,"context_line":"            if child_pid \u003d\u003d 0:"}],"source_content_type":"text/x-python","patch_set":19,"id":"1a6eadb0_c2e0bccf","line":138,"range":{"start_line":138,"start_character":8,"end_line":138,"end_character":16},"updated":"2016-12-18 07:52:39.000000000","message":"This can modify \u0027self.child_pids\u0027 from the get go, which means like 152 is not required.","commit_id":"5f3419013466d534ed2f5f37c528d4fc46d7e0fc"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"12eeccd5bf1ef9327d5ee4e77be403465e606beb","unresolved":false,"context_lines":[{"line_number":135,"context_line":""},{"line_number":136,"context_line":"    def run(self):"},{"line_number":137,"context_line":"        # Spawn as many children as requested"},{"line_number":138,"context_line":"        children \u003d []"},{"line_number":139,"context_line":"        while len(children) !\u003d self.num_children:"},{"line_number":140,"context_line":"            child_pid \u003d os.fork()"},{"line_number":141,"context_line":"            if child_pid \u003d\u003d 0:"}],"source_content_type":"text/x-python","patch_set":19,"id":"1a6eadb0_513618b5","line":138,"range":{"start_line":138,"start_character":8,"end_line":138,"end_character":16},"in_reply_to":"1a6eadb0_c2e0bccf","updated":"2016-12-19 13:42:53.000000000","message":"152 assignment is necessary since i only want father\u0027s copy of \"seld.child_pids\" to be populated when the SIGTERM signal arrives","commit_id":"5f3419013466d534ed2f5f37c528d4fc46d7e0fc"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"12eeccd5bf1ef9327d5ee4e77be403465e606beb","unresolved":false,"context_lines":[{"line_number":135,"context_line":""},{"line_number":136,"context_line":"    def run(self):"},{"line_number":137,"context_line":"        # Spawn as many children as requested"},{"line_number":138,"context_line":"        children \u003d []"},{"line_number":139,"context_line":"        while len(children) !\u003d self.num_children:"},{"line_number":140,"context_line":"            child_pid \u003d os.fork()"},{"line_number":141,"context_line":"            if child_pid \u003d\u003d 0:"}],"source_content_type":"text/x-python","patch_set":19,"id":"1a6eadb0_2264f947","line":138,"range":{"start_line":138,"start_character":8,"end_line":138,"end_character":16},"in_reply_to":"1a6eadb0_c2e0bccf","updated":"2016-12-19 13:42:53.000000000","message":"i\u0027m using \u0027children\u0027 and assignment in 152 because this way, only the parent will have the list populated with the PIDs. Otherwise, also children would have it","commit_id":"5f3419013466d534ed2f5f37c528d4fc46d7e0fc"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"8c22c87405ce8359bc8714165a64c0d84a0be302","unresolved":false,"context_lines":[{"line_number":136,"context_line":"    def run(self):"},{"line_number":137,"context_line":"        # Spawn as many children as requested"},{"line_number":138,"context_line":"        children \u003d []"},{"line_number":139,"context_line":"        while len(children) !\u003d self.num_children:"},{"line_number":140,"context_line":"            child_pid \u003d os.fork()"},{"line_number":141,"context_line":"            if child_pid \u003d\u003d 0:"},{"line_number":142,"context_line":"                # Listen and do nothing else"}],"source_content_type":"text/x-python","patch_set":19,"id":"1a6eadb0_a2dbc020","line":139,"range":{"start_line":139,"start_character":14,"end_line":139,"end_character":49},"updated":"2016-12-18 07:52:39.000000000","message":"This can be replaced with \u0027for i in self.num_children\u0027.","commit_id":"5f3419013466d534ed2f5f37c528d4fc46d7e0fc"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"12eeccd5bf1ef9327d5ee4e77be403465e606beb","unresolved":false,"context_lines":[{"line_number":136,"context_line":"    def run(self):"},{"line_number":137,"context_line":"        # Spawn as many children as requested"},{"line_number":138,"context_line":"        children \u003d []"},{"line_number":139,"context_line":"        while len(children) !\u003d self.num_children:"},{"line_number":140,"context_line":"            child_pid \u003d os.fork()"},{"line_number":141,"context_line":"            if child_pid \u003d\u003d 0:"},{"line_number":142,"context_line":"                # Listen and do nothing else"}],"source_content_type":"text/x-python","patch_set":19,"id":"1a6eadb0_d1dce876","line":139,"range":{"start_line":139,"start_character":14,"end_line":139,"end_character":49},"in_reply_to":"1a6eadb0_a2dbc020","updated":"2016-12-19 13:42:53.000000000","message":"Done","commit_id":"5f3419013466d534ed2f5f37c528d4fc46d7e0fc"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"12eeccd5bf1ef9327d5ee4e77be403465e606beb","unresolved":false,"context_lines":[{"line_number":136,"context_line":"    def run(self):"},{"line_number":137,"context_line":"        # Spawn as many children as requested"},{"line_number":138,"context_line":"        children \u003d []"},{"line_number":139,"context_line":"        while len(children) !\u003d self.num_children:"},{"line_number":140,"context_line":"            child_pid \u003d os.fork()"},{"line_number":141,"context_line":"            if child_pid \u003d\u003d 0:"},{"line_number":142,"context_line":"                # Listen and do nothing else"}],"source_content_type":"text/x-python","patch_set":19,"id":"1a6eadb0_c2f18597","line":139,"range":{"start_line":139,"start_character":14,"end_line":139,"end_character":49},"in_reply_to":"1a6eadb0_a2dbc020","updated":"2016-12-19 13:42:53.000000000","message":"i\u0027d rather leave it like this since \u0027i\u0027 var then wouldn\u0027t be used","commit_id":"5f3419013466d534ed2f5f37c528d4fc46d7e0fc"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"e66d48729913ae278dd0c9ad323285d92bc3e704","unresolved":false,"context_lines":[{"line_number":124,"context_line":"            else:"},{"line_number":125,"context_line":"                if n_const.PROTO_NAME_TCP in self.proto:"},{"line_number":126,"context_line":"                    self.listen_socket.listen(0)"},{"line_number":127,"context_line":"                break"},{"line_number":128,"context_line":""},{"line_number":129,"context_line":"    def do_sleep(self):"},{"line_number":130,"context_line":"        while True:"}],"source_content_type":"text/x-python","patch_set":24,"id":"1a6eadb0_8fb5dfd1","line":127,"updated":"2016-12-19 22:20:32.000000000","message":"What if we get to this line? Do you want to silently not start listening? Even though it\u0027s unlike it happens, it will cause failures in functional tests as expected process count found in namespace won\u0027t correspond with expected value.","commit_id":"eb5cb29fc0038005dee6a202cc48587cda1d11f5"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"47eca8f1ac323082d443d5a3da208aa2ddfc9433","unresolved":false,"context_lines":[{"line_number":124,"context_line":"            else:"},{"line_number":125,"context_line":"                if n_const.PROTO_NAME_TCP in self.proto:"},{"line_number":126,"context_line":"                    self.listen_socket.listen(0)"},{"line_number":127,"context_line":"                break"},{"line_number":128,"context_line":""},{"line_number":129,"context_line":"    def do_sleep(self):"},{"line_number":130,"context_line":"        while True:"}],"source_content_type":"text/x-python","patch_set":24,"id":"1a6eadb0_3cd8637f","line":127,"in_reply_to":"1a6eadb0_8fb5dfd1","updated":"2016-12-20 09:57:07.000000000","message":"Hmm, I guess the only enhancement to that would be adding logging. I believe that could be added if we ever see this failing to spawn enough processes.","commit_id":"eb5cb29fc0038005dee6a202cc48587cda1d11f5"}],"neutron/tests/functional/cmd/test_netns_cleanup.py":[{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"ef53b3076e0df07efaa0f6acf5321ef8175c1c85","unresolved":false,"context_lines":[{"line_number":66,"context_line":"        # killed during cleanup"},{"line_number":67,"context_line":"        self._launch_processes([l3_namespace, dhcp_namespace])"},{"line_number":68,"context_line":"        procs_before \u003d self._get_num_spawned_procs()"},{"line_number":69,"context_line":"        self.assertEqual(procs_before, 18 * 2)"},{"line_number":70,"context_line":""},{"line_number":71,"context_line":"        netns_cleanup.cleanup_network_namespaces(self.conf)"},{"line_number":72,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"3a71b18c_9e63d619","line":69,"range":{"start_line":69,"start_character":38,"end_line":69,"end_character":45},"updated":"2016-12-12 10:33:31.000000000","message":"Can you put all the calculations here and in 85-89 as constants up in the module?\n\nand then: \nlen(self.get_namespaces.return_value) * (YOUR_CONST)","commit_id":"7f05857b5b7c4e7d385ea52533c360cbbe36b5cf"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"bf0917abf63488871166520cb66e5ed89cfb68da","unresolved":false,"context_lines":[{"line_number":69,"context_line":"        # launch processes in each namespace to make sure they\u0027re"},{"line_number":70,"context_line":"        # killed during cleanup"},{"line_number":71,"context_line":"        procs_launched \u003d self._launch_processes([l3_namespace, dhcp_namespace])"},{"line_number":72,"context_line":"        self.assertIsNot(procs_launched, 0)"},{"line_number":73,"context_line":"        procs_before \u003d self._get_num_spawned_procs()"},{"line_number":74,"context_line":"        self.assertEqual(procs_before, procs_launched)"},{"line_number":75,"context_line":""},{"line_number":76,"context_line":"        netns_cleanup.cleanup_network_namespaces(self.conf)"},{"line_number":77,"context_line":""}],"source_content_type":"text/x-python","patch_set":14,"id":"1a6eadb0_5c2616bb","line":74,"range":{"start_line":72,"start_character":0,"end_line":74,"end_character":54},"updated":"2016-12-14 10:34:56.000000000","message":"This might be race-y. You launch some processes and get the expected number, then you get the number of current processes while daemon might not be finished yet with spawning child processes, so the observed number of processes is not the same as expected number.\n\nYou should use something like:\n\n wait_until_true(\n     functools.partial(self.assertEqual, procs_before, procs_launched),\n     timeout\u003d15,\n     exception\u003dException(\"Didn\u0027t spawn expected amount of processes\")","commit_id":"d823c360987bd85bdb90327e5b10cb6b787c2920"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"ed8d34f153db4b3a68c577958d8bc8489d2f0fe3","unresolved":false,"context_lines":[{"line_number":69,"context_line":"        # launch processes in each namespace to make sure they\u0027re"},{"line_number":70,"context_line":"        # killed during cleanup"},{"line_number":71,"context_line":"        procs_launched \u003d self._launch_processes([l3_namespace, dhcp_namespace])"},{"line_number":72,"context_line":"        self.assertIsNot(procs_launched, 0)"},{"line_number":73,"context_line":"        procs_before \u003d self._get_num_spawned_procs()"},{"line_number":74,"context_line":"        self.assertEqual(procs_before, procs_launched)"},{"line_number":75,"context_line":""},{"line_number":76,"context_line":"        netns_cleanup.cleanup_network_namespaces(self.conf)"},{"line_number":77,"context_line":""}],"source_content_type":"text/x-python","patch_set":14,"id":"1a6eadb0_21aca933","line":74,"range":{"start_line":72,"start_character":0,"end_line":74,"end_character":54},"in_reply_to":"1a6eadb0_5c2616bb","updated":"2016-12-14 13:35:04.000000000","message":"Good catch. It\u0027s not happening now since the \u0027ps\u0027 command with rootwrap_daemon takes longer than the processes to spawn but if NUM_SUBPROCESSES would be higher then it might happen. Fixed now :)","commit_id":"d823c360987bd85bdb90327e5b10cb6b787c2920"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"8c22c87405ce8359bc8714165a64c0d84a0be302","unresolved":false,"context_lines":[{"line_number":73,"context_line":"        self.assertIsNot(procs_launched, 0)"},{"line_number":74,"context_line":"        common_utils.wait_until_true("},{"line_number":75,"context_line":"            lambda: self._get_num_spawned_procs() \u003d\u003d procs_launched,"},{"line_number":76,"context_line":"            timeout\u003d15,"},{"line_number":77,"context_line":"            exception\u003dException(\"Didn\u0027t spawn expected number of processes\"))"},{"line_number":78,"context_line":""},{"line_number":79,"context_line":"        netns_cleanup.cleanup_network_namespaces(self.conf)"}],"source_content_type":"text/x-python","patch_set":19,"id":"1a6eadb0_62da8819","line":76,"range":{"start_line":76,"start_character":20,"end_line":76,"end_character":23},"updated":"2016-12-18 07:52:39.000000000","message":"Lets leave this in the default \u002760\u0027, as this can cause false-positives.","commit_id":"5f3419013466d534ed2f5f37c528d4fc46d7e0fc"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"12eeccd5bf1ef9327d5ee4e77be403465e606beb","unresolved":false,"context_lines":[{"line_number":73,"context_line":"        self.assertIsNot(procs_launched, 0)"},{"line_number":74,"context_line":"        common_utils.wait_until_true("},{"line_number":75,"context_line":"            lambda: self._get_num_spawned_procs() \u003d\u003d procs_launched,"},{"line_number":76,"context_line":"            timeout\u003d15,"},{"line_number":77,"context_line":"            exception\u003dException(\"Didn\u0027t spawn expected number of processes\"))"},{"line_number":78,"context_line":""},{"line_number":79,"context_line":"        netns_cleanup.cleanup_network_namespaces(self.conf)"}],"source_content_type":"text/x-python","patch_set":19,"id":"1a6eadb0_02c61d16","line":76,"range":{"start_line":76,"start_character":20,"end_line":76,"end_character":23},"in_reply_to":"1a6eadb0_62da8819","updated":"2016-12-19 13:42:53.000000000","message":"False positives? If processes are not spawned within \u0027timeout\u0027 seconds, then an Exception would be thrown and then the test would fail, wouldn\u0027t it?","commit_id":"5f3419013466d534ed2f5f37c528d4fc46d7e0fc"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"8c22c87405ce8359bc8714165a64c0d84a0be302","unresolved":false,"context_lines":[{"line_number":91,"context_line":"        Launch processes in the specified namespaces."},{"line_number":92,"context_line":""},{"line_number":93,"context_line":"        This function will spawn processes inside the given namespaces:"},{"line_number":94,"context_line":"                - 6 processes listening on tcp ports (parent + 5 children)"},{"line_number":95,"context_line":"                - 1 process + 5 subprocesses listening on unix sockets"},{"line_number":96,"context_line":"                - 1 process + 5 subprocesses listening on udp6 sockets"},{"line_number":97,"context_line":""}],"source_content_type":"text/x-python","patch_set":19,"id":"1a6eadb0_22d090f7","line":94,"range":{"start_line":94,"start_character":43,"end_line":94,"end_character":46},"updated":"2016-12-18 07:52:39.000000000","message":"Why is it important to have specific processes listening to different protocols? Does changing the way the process work (listening to this and that port in this and that protocol) effect the way it should deal with SIGTERM/SIGKILL?\n\nThis distinction and multiple (un-needed?) configuration only serve to complicate the test logic here, and I\u0027m wondering if a lot of it can be removed in favor of a simpler process which either ignores SIGTERM or not.","commit_id":"5f3419013466d534ed2f5f37c528d4fc46d7e0fc"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"12eeccd5bf1ef9327d5ee4e77be403465e606beb","unresolved":false,"context_lines":[{"line_number":91,"context_line":"        Launch processes in the specified namespaces."},{"line_number":92,"context_line":""},{"line_number":93,"context_line":"        This function will spawn processes inside the given namespaces:"},{"line_number":94,"context_line":"                - 6 processes listening on tcp ports (parent + 5 children)"},{"line_number":95,"context_line":"                - 1 process + 5 subprocesses listening on unix sockets"},{"line_number":96,"context_line":"                - 1 process + 5 subprocesses listening on udp6 sockets"},{"line_number":97,"context_line":""}],"source_content_type":"text/x-python","patch_set":19,"id":"1a6eadb0_bde66842","line":94,"range":{"start_line":94,"start_character":43,"end_line":94,"end_character":46},"in_reply_to":"1a6eadb0_22d090f7","updated":"2016-12-19 13:42:53.000000000","message":"For example, radvd in l3 listens on a unix socket and there might be cases where processes make use of udp, ipv6, etc. As you mention, with regards to SIGTERM/SIGKILL it doesn\u0027t make a big difference. However, I wanted this test to be as complete as possible so that we can be confident that the cleanup will pick up ALL those and get rid of them properly.","commit_id":"5f3419013466d534ed2f5f37c528d4fc46d7e0fc"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"8c22c87405ce8359bc8714165a64c0d84a0be302","unresolved":false,"context_lines":[{"line_number":101,"context_line":"        to test the cleanup functionality which will issue a SIGKILL"},{"line_number":102,"context_line":"        to all remaining processes after the SIGTERM attempt"},{"line_number":103,"context_line":"        \"\"\""},{"line_number":104,"context_line":"        cmds \u003d [[\u0027python\u0027, process_spawn.__file__,"},{"line_number":105,"context_line":"                 \u0027-n\u0027, NUM_SUBPROCESSES,"},{"line_number":106,"context_line":"                 \u0027-f\u0027, n_const.IPv4,"},{"line_number":107,"context_line":"                 \u0027-p\u0027, n_const.PROTO_NAME_TCP,"}],"source_content_type":"text/x-python","patch_set":19,"id":"1a6eadb0_c28b5c1d","line":104,"range":{"start_line":104,"start_character":8,"end_line":104,"end_character":12},"updated":"2016-12-18 07:52:39.000000000","message":"nit: s/cmds/commands/g","commit_id":"5f3419013466d534ed2f5f37c528d4fc46d7e0fc"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"12eeccd5bf1ef9327d5ee4e77be403465e606beb","unresolved":false,"context_lines":[{"line_number":101,"context_line":"        to test the cleanup functionality which will issue a SIGKILL"},{"line_number":102,"context_line":"        to all remaining processes after the SIGTERM attempt"},{"line_number":103,"context_line":"        \"\"\""},{"line_number":104,"context_line":"        cmds \u003d [[\u0027python\u0027, process_spawn.__file__,"},{"line_number":105,"context_line":"                 \u0027-n\u0027, NUM_SUBPROCESSES,"},{"line_number":106,"context_line":"                 \u0027-f\u0027, n_const.IPv4,"},{"line_number":107,"context_line":"                 \u0027-p\u0027, n_const.PROTO_NAME_TCP,"}],"source_content_type":"text/x-python","patch_set":19,"id":"1a6eadb0_c22ee5a4","line":104,"range":{"start_line":104,"start_character":8,"end_line":104,"end_character":12},"in_reply_to":"1a6eadb0_c28b5c1d","updated":"2016-12-19 13:42:53.000000000","message":"Done","commit_id":"5f3419013466d534ed2f5f37c528d4fc46d7e0fc"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"8c22c87405ce8359bc8714165a64c0d84a0be302","unresolved":false,"context_lines":[{"line_number":126,"context_line":"        for netns in namespaces:"},{"line_number":127,"context_line":"            ip \u003d ip_lib.IPWrapper(namespace\u003dnetns)"},{"line_number":128,"context_line":"            for command in cmds:"},{"line_number":129,"context_line":"                proc_count +\u003d (NUM_SUBPROCESSES + 1)"},{"line_number":130,"context_line":"                # We need to pass the PATH env variable so that python"},{"line_number":131,"context_line":"                # interpreter runs under the same virtual environment."},{"line_number":132,"context_line":"                # Otherwise, it won\u0027t find the necessary packages such as"}],"source_content_type":"text/x-python","patch_set":19,"id":"1a6eadb0_a28d802c","line":129,"range":{"start_line":129,"start_character":47,"end_line":129,"end_character":51},"updated":"2016-12-18 07:52:39.000000000","message":"Why the +1 here?","commit_id":"5f3419013466d534ed2f5f37c528d4fc46d7e0fc"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"12eeccd5bf1ef9327d5ee4e77be403465e606beb","unresolved":false,"context_lines":[{"line_number":126,"context_line":"        for netns in namespaces:"},{"line_number":127,"context_line":"            ip \u003d ip_lib.IPWrapper(namespace\u003dnetns)"},{"line_number":128,"context_line":"            for command in cmds:"},{"line_number":129,"context_line":"                proc_count +\u003d (NUM_SUBPROCESSES + 1)"},{"line_number":130,"context_line":"                # We need to pass the PATH env variable so that python"},{"line_number":131,"context_line":"                # interpreter runs under the same virtual environment."},{"line_number":132,"context_line":"                # Otherwise, it won\u0027t find the necessary packages such as"}],"source_content_type":"text/x-python","patch_set":19,"id":"1a6eadb0_a25ac94e","line":129,"range":{"start_line":129,"start_character":47,"end_line":129,"end_character":51},"in_reply_to":"1a6eadb0_a28d802c","updated":"2016-12-19 13:42:53.000000000","message":"Each command will produce the process itself plus the number of subprocesses. I\u0027ll clarify it with a comment. Thanks :)","commit_id":"5f3419013466d534ed2f5f37c528d4fc46d7e0fc"}],"neutron/tests/unit/agent/linux/test_async_process.py":[{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"476c1b19f146f63c891f5dc7b75afd0858d07d14","unresolved":false,"context_lines":[{"line_number":195,"context_line":"                            kill_signal\u003dsignal.SIGKILL):"},{"line_number":196,"context_line":"        self.proc.run_as_root \u003d True"},{"line_number":197,"context_line":"        if exception_message:"},{"line_number":198,"context_line":"            exc \u003d utils.ProcessExecutionError(exception_message, returncode\u003d0)"},{"line_number":199,"context_line":"        else:"},{"line_number":200,"context_line":"            exc \u003d None"},{"line_number":201,"context_line":"        with mock.patch.object(utils, \u0027kill_process\u0027,"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_436e2d02","line":198,"updated":"2016-12-02 10:12:23.000000000","message":"Are these changes needed? It seems you didn\u0027t change the behavior.","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"3a031d9a8b2f97e0a57f6071619139c8400b6faa","unresolved":false,"context_lines":[{"line_number":195,"context_line":"                            kill_signal\u003dsignal.SIGKILL):"},{"line_number":196,"context_line":"        self.proc.run_as_root \u003d True"},{"line_number":197,"context_line":"        if exception_message:"},{"line_number":198,"context_line":"            exc \u003d utils.ProcessExecutionError(exception_message, returncode\u003d0)"},{"line_number":199,"context_line":"        else:"},{"line_number":200,"context_line":"            exc \u003d None"},{"line_number":201,"context_line":"        with mock.patch.object(utils, \u0027kill_process\u0027,"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_5eb5eceb","line":198,"in_reply_to":"3a71b18c_436e2d02","updated":"2016-12-04 19:51:17.000000000","message":"I just wanted to highlight that utils.kill_process returns a ProcessExecutionError exception but it inherits from RuntimeError so you\u0027re right. Reverted","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"}],"neutron/tests/unit/agent/linux/test_utils.py":[{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"476c1b19f146f63c891f5dc7b75afd0858d07d14","unresolved":false,"context_lines":[{"line_number":182,"context_line":"        self.assertEqual(actual_val, expect_val)"},{"line_number":183,"context_line":""},{"line_number":184,"context_line":""},{"line_number":185,"context_line":"class TestFindParentPid(base.BaseTestCase):"},{"line_number":186,"context_line":"    def test_returns_none_for_exit_code_1(self):"},{"line_number":187,"context_line":"        with mock.patch.object(utils, \u0027execute\u0027,"},{"line_number":188,"context_line":"                               side_effect\u003dutils.ProcessExecutionError("}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_06de0311","line":185,"updated":"2016-12-02 10:12:23.000000000","message":"You always mock execute, consider following:\n\n def setUp(self):\n     self.m_execute \u003d mock.patch.object(utils, \u0027execute\u0027).start()\n \n def test_returns_none_for_no_output(self):\n     self.m_execute.return_value \u003d \u0027\u0027\n     self.assertIsNone(utils.find_parent_pid(-1))","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"3a031d9a8b2f97e0a57f6071619139c8400b6faa","unresolved":false,"context_lines":[{"line_number":182,"context_line":"        self.assertEqual(actual_val, expect_val)"},{"line_number":183,"context_line":""},{"line_number":184,"context_line":""},{"line_number":185,"context_line":"class TestFindParentPid(base.BaseTestCase):"},{"line_number":186,"context_line":"    def test_returns_none_for_exit_code_1(self):"},{"line_number":187,"context_line":"        with mock.patch.object(utils, \u0027execute\u0027,"},{"line_number":188,"context_line":"                               side_effect\u003dutils.ProcessExecutionError("}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_de773c38","line":185,"in_reply_to":"3a71b18c_06de0311","updated":"2016-12-04 19:51:17.000000000","message":"Done","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"a746350a3ee3cd9f1cdb1130b41f44f9e0c92c92","unresolved":false,"context_lines":[{"line_number":182,"context_line":"        self.assertEqual(actual_val, expect_val)"},{"line_number":183,"context_line":""},{"line_number":184,"context_line":""},{"line_number":185,"context_line":"class TestFindParentPid(base.BaseTestCase):"},{"line_number":186,"context_line":"    def test_returns_none_for_exit_code_1(self):"},{"line_number":187,"context_line":"        with mock.patch.object(utils, \u0027execute\u0027,"},{"line_number":188,"context_line":"                               side_effect\u003dutils.ProcessExecutionError("}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_f92b68e9","line":185,"in_reply_to":"3a71b18c_06de0311","updated":"2016-12-02 10:31:32.000000000","message":"right, setUp(self) will help you with all the common stuff.\n\nbtw, doesn\u0027t he need to do:\n\nsef setUp(self):\n   super(TestFindParentPid, self).setUp() \n   self.m_execute \u003d mock.patch.object(utils, \u0027execute\u0027).start()\n\n\nOr we don\u0027t have setups in parent test classes?","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"3a031d9a8b2f97e0a57f6071619139c8400b6faa","unresolved":false,"context_lines":[{"line_number":182,"context_line":"        self.assertEqual(actual_val, expect_val)"},{"line_number":183,"context_line":""},{"line_number":184,"context_line":""},{"line_number":185,"context_line":"class TestFindParentPid(base.BaseTestCase):"},{"line_number":186,"context_line":"    def test_returns_none_for_exit_code_1(self):"},{"line_number":187,"context_line":"        with mock.patch.object(utils, \u0027execute\u0027,"},{"line_number":188,"context_line":"                               side_effect\u003dutils.ProcessExecutionError("}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_fe723848","line":185,"in_reply_to":"3a71b18c_f92b68e9","updated":"2016-12-04 19:51:17.000000000","message":"Yes, I included the super call","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"2da7dc2cf373c7ceb08bb274cc4ffc195fc0e361","unresolved":false,"context_lines":[{"line_number":209,"context_line":"                                   cmds\u003dNone):"},{"line_number":210,"context_line":"        def _find_parent_pid(x):"},{"line_number":211,"context_line":"            if not pids:"},{"line_number":212,"context_line":"                return None"},{"line_number":213,"context_line":"            ret \u003d pids.pop(0)"},{"line_number":214,"context_line":"            return ret"},{"line_number":215,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_a6fe2f36","line":212,"range":{"start_line":212,"start_character":22,"end_line":212,"end_character":27},"updated":"2016-12-02 10:23:44.000000000","message":"Nit: This is implicit","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"3a031d9a8b2f97e0a57f6071619139c8400b6faa","unresolved":false,"context_lines":[{"line_number":209,"context_line":"                                   cmds\u003dNone):"},{"line_number":210,"context_line":"        def _find_parent_pid(x):"},{"line_number":211,"context_line":"            if not pids:"},{"line_number":212,"context_line":"                return None"},{"line_number":213,"context_line":"            ret \u003d pids.pop(0)"},{"line_number":214,"context_line":"            return ret"},{"line_number":215,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_5e9a4c64","line":212,"range":{"start_line":212,"start_character":22,"end_line":212,"end_character":27},"in_reply_to":"3a71b18c_a6fe2f36","updated":"2016-12-04 19:51:17.000000000","message":"Done","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"2da7dc2cf373c7ceb08bb274cc4ffc195fc0e361","unresolved":false,"context_lines":[{"line_number":223,"context_line":"                               side_effect\u003d_find_parent_pid), \\"},{"line_number":224,"context_line":"                mock.patch.object(utils, \u0027pid_invoked_with_cmdline\u0027,"},{"line_number":225,"context_line":"                                  **pid_invoked_with_cmdline):"},{"line_number":226,"context_line":"                    actual \u003d utils.find_fork_top_parent(mock_pid)"},{"line_number":227,"context_line":"        if expected is _marker:"},{"line_number":228,"context_line":"            expected \u003d mock_pid"},{"line_number":229,"context_line":"        self.assertEqual(expected, actual)"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_590d3c36","line":226,"range":{"start_line":226,"start_character":56,"end_line":226,"end_character":64},"updated":"2016-12-02 10:23:44.000000000","message":"can you just pass _marker here and remove L216 and L227-L228 ?","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"3a031d9a8b2f97e0a57f6071619139c8400b6faa","unresolved":false,"context_lines":[{"line_number":223,"context_line":"                               side_effect\u003d_find_parent_pid), \\"},{"line_number":224,"context_line":"                mock.patch.object(utils, \u0027pid_invoked_with_cmdline\u0027,"},{"line_number":225,"context_line":"                                  **pid_invoked_with_cmdline):"},{"line_number":226,"context_line":"                    actual \u003d utils.find_fork_top_parent(mock_pid)"},{"line_number":227,"context_line":"        if expected is _marker:"},{"line_number":228,"context_line":"            expected \u003d mock_pid"},{"line_number":229,"context_line":"        self.assertEqual(expected, actual)"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_1e1374b9","line":226,"range":{"start_line":226,"start_character":56,"end_line":226,"end_character":64},"in_reply_to":"3a71b18c_590d3c36","updated":"2016-12-04 19:51:17.000000000","message":"Done","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"2da7dc2cf373c7ceb08bb274cc4ffc195fc0e361","unresolved":false,"context_lines":[{"line_number":232,"context_line":"        self._test_find_fork_top_parent()"},{"line_number":233,"context_line":""},{"line_number":234,"context_line":"    def test_returns_own_pid_nofork(self):"},{"line_number":235,"context_line":"        self._test_find_fork_top_parent(pids\u003d[\u00272\u0027, \u00273\u0027], cmds\u003d[False, False])"},{"line_number":236,"context_line":""},{"line_number":237,"context_line":"    def test_returns_first_parent_pid_fork(self):"},{"line_number":238,"context_line":"        self._test_find_fork_top_parent(expected\u003d\u00272\u0027,"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_59729cae","line":235,"range":{"start_line":235,"start_character":57,"end_line":235,"end_character":76},"updated":"2016-12-02 10:23:44.000000000","message":"Is this needed? seems like the behavior will be the same without","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"3a031d9a8b2f97e0a57f6071619139c8400b6faa","unresolved":false,"context_lines":[{"line_number":232,"context_line":"        self._test_find_fork_top_parent()"},{"line_number":233,"context_line":""},{"line_number":234,"context_line":"    def test_returns_own_pid_nofork(self):"},{"line_number":235,"context_line":"        self._test_find_fork_top_parent(pids\u003d[\u00272\u0027, \u00273\u0027], cmds\u003d[False, False])"},{"line_number":236,"context_line":""},{"line_number":237,"context_line":"    def test_returns_first_parent_pid_fork(self):"},{"line_number":238,"context_line":"        self._test_find_fork_top_parent(expected\u003d\u00272\u0027,"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_1eb7f4d8","line":235,"range":{"start_line":235,"start_character":57,"end_line":235,"end_character":76},"in_reply_to":"3a71b18c_59729cae","updated":"2016-12-04 19:51:17.000000000","message":"Not needed, I did it for clarity but as it seems to be clear enough I remove it","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"2da7dc2cf373c7ceb08bb274cc4ffc195fc0e361","unresolved":false,"context_lines":[{"line_number":254,"context_line":"            exc \u003d None"},{"line_number":255,"context_line":"        with mock.patch.object(utils, \u0027execute\u0027,"},{"line_number":256,"context_line":"                               side_effect\u003dexc) as mock_execute:"},{"line_number":257,"context_line":"            actual \u003d utils.kill_process(pid, kill_signal, run_as_root\u003dTrue)"},{"line_number":258,"context_line":""},{"line_number":259,"context_line":"        self.assertEqual(expected, actual)"},{"line_number":260,"context_line":"        mock_execute.assert_called_with([\u0027kill\u0027, \u0027-%d\u0027 % kill_signal, pid],"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_b9e81012","line":257,"range":{"start_line":257,"start_character":12,"end_line":257,"end_character":18},"updated":"2016-12-02 10:23:44.000000000","message":"Nit: It\u0027s a convention to use \u0027observed\u0027","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"3a031d9a8b2f97e0a57f6071619139c8400b6faa","unresolved":false,"context_lines":[{"line_number":254,"context_line":"            exc \u003d None"},{"line_number":255,"context_line":"        with mock.patch.object(utils, \u0027execute\u0027,"},{"line_number":256,"context_line":"                               side_effect\u003dexc) as mock_execute:"},{"line_number":257,"context_line":"            actual \u003d utils.kill_process(pid, kill_signal, run_as_root\u003dTrue)"},{"line_number":258,"context_line":""},{"line_number":259,"context_line":"        self.assertEqual(expected, actual)"},{"line_number":260,"context_line":"        mock_execute.assert_called_with([\u0027kill\u0027, \u0027-%d\u0027 % kill_signal, pid],"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_3e93d050","line":257,"range":{"start_line":257,"start_character":12,"end_line":257,"end_character":18},"in_reply_to":"3a71b18c_b9e81012","updated":"2016-12-04 19:51:17.000000000","message":"Done","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"2da7dc2cf373c7ceb08bb274cc4ffc195fc0e361","unresolved":false,"context_lines":[{"line_number":291,"context_line":"            self.assertEqual(utils.find_child_pids(-1), [\u0027123\u0027, \u0027185\u0027])"},{"line_number":292,"context_line":""},{"line_number":293,"context_line":"    def test_returns_list_of_child_process_ids_recursively(self):"},{"line_number":294,"context_line":"        with mock.patch.object(utils, \u0027execute\u0027, side_effect\u003diter("},{"line_number":295,"context_line":"                [\u0027 123 \\n 185\\n\u0027, \u0027 40 \\n\u0027, \u0027\\n\u0027, \u002741\\n\u0027, \u0027\\n\u0027])):"},{"line_number":296,"context_line":"            actual \u003d utils.find_child_pids(-1, True)"},{"line_number":297,"context_line":"            self.assertEqual(actual, [\u0027123\u0027, \u0027185\u0027, \u002740\u0027, \u002741\u0027])"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_794cb842","line":294,"range":{"start_line":294,"start_character":61,"end_line":294,"end_character":66},"updated":"2016-12-02 10:23:44.000000000","message":"Is this needed?","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"3a031d9a8b2f97e0a57f6071619139c8400b6faa","unresolved":false,"context_lines":[{"line_number":291,"context_line":"            self.assertEqual(utils.find_child_pids(-1), [\u0027123\u0027, \u0027185\u0027])"},{"line_number":292,"context_line":""},{"line_number":293,"context_line":"    def test_returns_list_of_child_process_ids_recursively(self):"},{"line_number":294,"context_line":"        with mock.patch.object(utils, \u0027execute\u0027, side_effect\u003diter("},{"line_number":295,"context_line":"                [\u0027 123 \\n 185\\n\u0027, \u0027 40 \\n\u0027, \u0027\\n\u0027, \u002741\\n\u0027, \u0027\\n\u0027])):"},{"line_number":296,"context_line":"            actual \u003d utils.find_child_pids(-1, True)"},{"line_number":297,"context_line":"            self.assertEqual(actual, [\u0027123\u0027, \u0027185\u0027, \u002740\u0027, \u002741\u0027])"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_5e840cd3","line":294,"range":{"start_line":294,"start_character":61,"end_line":294,"end_character":66},"in_reply_to":"3a71b18c_794cb842","updated":"2016-12-04 19:51:17.000000000","message":"Apparently not, for some unknown reason I needed first time I wrote it but now i have double checked and it works without it. Thanks :)","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"bf0917abf63488871166520cb66e5ed89cfb68da","unresolved":false,"context_lines":[{"line_number":15,"context_line":"import socket"},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"import mock"},{"line_number":18,"context_line":"import signal"},{"line_number":19,"context_line":"import six"},{"line_number":20,"context_line":"import testtools"},{"line_number":21,"context_line":""}],"source_content_type":"text/x-python","patch_set":14,"id":"1a6eadb0_3c495a60","line":18,"range":{"start_line":18,"start_character":0,"end_line":18,"end_character":13},"updated":"2016-12-14 10:34:56.000000000","message":"This should go to L16","commit_id":"d823c360987bd85bdb90327e5b10cb6b787c2920"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"ed8d34f153db4b3a68c577958d8bc8489d2f0fe3","unresolved":false,"context_lines":[{"line_number":15,"context_line":"import socket"},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"import mock"},{"line_number":18,"context_line":"import signal"},{"line_number":19,"context_line":"import six"},{"line_number":20,"context_line":"import testtools"},{"line_number":21,"context_line":""}],"source_content_type":"text/x-python","patch_set":14,"id":"1a6eadb0_c148558a","line":18,"range":{"start_line":18,"start_character":0,"end_line":18,"end_character":13},"in_reply_to":"1a6eadb0_3c495a60","updated":"2016-12-14 13:35:04.000000000","message":"Done","commit_id":"d823c360987bd85bdb90327e5b10cb6b787c2920"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"8c22c87405ce8359bc8714165a64c0d84a0be302","unresolved":false,"context_lines":[{"line_number":209,"context_line":""},{"line_number":210,"context_line":""},{"line_number":211,"context_line":"class TestFindForkTopParent(base.BaseTestCase):"},{"line_number":212,"context_line":"    def _test_find_fork_top_parent(self, expected\u003d_marker, pids\u003dNone,"},{"line_number":213,"context_line":"                                   cmds\u003dNone):"},{"line_number":214,"context_line":"        def _find_parent_pid(x):"},{"line_number":215,"context_line":"            if not pids:"}],"source_content_type":"text/x-python","patch_set":19,"id":"1a6eadb0_6248c8cd","line":212,"range":{"start_line":212,"start_character":8,"end_line":212,"end_character":34},"updated":"2016-12-18 07:52:39.000000000","message":"Can the arguments in the function be renamed into something more indicative of their purpose?","commit_id":"5f3419013466d534ed2f5f37c528d4fc46d7e0fc"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"12eeccd5bf1ef9327d5ee4e77be403465e606beb","unresolved":false,"context_lines":[{"line_number":209,"context_line":""},{"line_number":210,"context_line":""},{"line_number":211,"context_line":"class TestFindForkTopParent(base.BaseTestCase):"},{"line_number":212,"context_line":"    def _test_find_fork_top_parent(self, expected\u003d_marker, pids\u003dNone,"},{"line_number":213,"context_line":"                                   cmds\u003dNone):"},{"line_number":214,"context_line":"        def _find_parent_pid(x):"},{"line_number":215,"context_line":"            if not pids:"}],"source_content_type":"text/x-python","patch_set":19,"id":"1a6eadb0_e6fe8c37","line":212,"range":{"start_line":212,"start_character":8,"end_line":212,"end_character":34},"in_reply_to":"1a6eadb0_6248c8cd","updated":"2016-12-19 13:42:53.000000000","message":"Done","commit_id":"5f3419013466d534ed2f5f37c528d4fc46d7e0fc"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"8c22c87405ce8359bc8714165a64c0d84a0be302","unresolved":false,"context_lines":[{"line_number":212,"context_line":"    def _test_find_fork_top_parent(self, expected\u003d_marker, pids\u003dNone,"},{"line_number":213,"context_line":"                                   cmds\u003dNone):"},{"line_number":214,"context_line":"        def _find_parent_pid(x):"},{"line_number":215,"context_line":"            if not pids:"},{"line_number":216,"context_line":"                return"},{"line_number":217,"context_line":"            ret \u003d pids.pop(0)"},{"line_number":218,"context_line":"            return ret"},{"line_number":219,"context_line":""},{"line_number":220,"context_line":"        pid_invoked_with_cmdline \u003d {}"},{"line_number":221,"context_line":"        if cmds:"}],"source_content_type":"text/x-python","patch_set":19,"id":"1a6eadb0_e2fcd874","line":218,"range":{"start_line":215,"start_character":12,"end_line":218,"end_character":22},"updated":"2016-12-18 07:52:39.000000000","message":"if pids:\n     return pids.pop(0)\n\nThis is a \"cleaner\" (subjective-wise) code that does exactly what you did, with fewer lines of code (since \u0027None\u0027 is implicitly returned if the function flow didn\u0027t reach a \u0027return\u0027 statement).\n\nAlso, you can do:\n\n return pids.pop(0) if pids else None\n\nbut that\u0027s an overkill (though it\u0027s even nicer :P)","commit_id":"5f3419013466d534ed2f5f37c528d4fc46d7e0fc"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"12eeccd5bf1ef9327d5ee4e77be403465e606beb","unresolved":false,"context_lines":[{"line_number":212,"context_line":"    def _test_find_fork_top_parent(self, expected\u003d_marker, pids\u003dNone,"},{"line_number":213,"context_line":"                                   cmds\u003dNone):"},{"line_number":214,"context_line":"        def _find_parent_pid(x):"},{"line_number":215,"context_line":"            if not pids:"},{"line_number":216,"context_line":"                return"},{"line_number":217,"context_line":"            ret \u003d pids.pop(0)"},{"line_number":218,"context_line":"            return ret"},{"line_number":219,"context_line":""},{"line_number":220,"context_line":"        pid_invoked_with_cmdline \u003d {}"},{"line_number":221,"context_line":"        if cmds:"}],"source_content_type":"text/x-python","patch_set":19,"id":"1a6eadb0_3d409807","line":218,"range":{"start_line":215,"start_character":12,"end_line":218,"end_character":22},"in_reply_to":"1a6eadb0_e2fcd874","updated":"2016-12-19 13:42:53.000000000","message":"Done","commit_id":"5f3419013466d534ed2f5f37c528d4fc46d7e0fc"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"8c22c87405ce8359bc8714165a64c0d84a0be302","unresolved":false,"context_lines":[{"line_number":268,"context_line":"        self._test_kill_process(\u00271\u0027, None, \u0027No such process\u0027)"},{"line_number":269,"context_line":""},{"line_number":270,"context_line":"    def test_kill_process_raises_exception_for_execute_exception(self):"},{"line_number":271,"context_line":"        with testtools.ExpectedException(utils.ProcessExecutionError):"},{"line_number":272,"context_line":"            self._test_kill_process(\u00271\u0027, None, \u0027Invalid\u0027)"},{"line_number":273,"context_line":""},{"line_number":274,"context_line":"    def test_kill_process_with_different_signal(self):"}],"source_content_type":"text/x-python","patch_set":19,"id":"1a6eadb0_82eec4b2","line":271,"range":{"start_line":271,"start_character":13,"end_line":271,"end_character":69},"updated":"2016-12-18 07:52:39.000000000","message":"self.assertRaises(utils.ProcessExecutionError, self._test_kill_process, my_arg1, my_arg2)\n\nWill accomplish the same and is more consistent iirc with the rest of the test code.\n\nLikewise for a few other appearances in your patch.","commit_id":"5f3419013466d534ed2f5f37c528d4fc46d7e0fc"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"12eeccd5bf1ef9327d5ee4e77be403465e606beb","unresolved":false,"context_lines":[{"line_number":268,"context_line":"        self._test_kill_process(\u00271\u0027, None, \u0027No such process\u0027)"},{"line_number":269,"context_line":""},{"line_number":270,"context_line":"    def test_kill_process_raises_exception_for_execute_exception(self):"},{"line_number":271,"context_line":"        with testtools.ExpectedException(utils.ProcessExecutionError):"},{"line_number":272,"context_line":"            self._test_kill_process(\u00271\u0027, None, \u0027Invalid\u0027)"},{"line_number":273,"context_line":""},{"line_number":274,"context_line":"    def test_kill_process_with_different_signal(self):"}],"source_content_type":"text/x-python","patch_set":19,"id":"1a6eadb0_c676f0d7","line":271,"range":{"start_line":271,"start_character":13,"end_line":271,"end_character":69},"in_reply_to":"1a6eadb0_82eec4b2","updated":"2016-12-19 13:42:53.000000000","message":"Done","commit_id":"5f3419013466d534ed2f5f37c528d4fc46d7e0fc"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"9ba567fb1637aee92153e04d9082280b12308051","unresolved":false,"context_lines":[{"line_number":218,"context_line":""},{"line_number":219,"context_line":"        pid_invoked_with_cmdline \u003d {}"},{"line_number":220,"context_line":"        if pid_invoked_with_cmdline_retvals:"},{"line_number":221,"context_line":"            pid_invoked_with_cmdline[\u0027side_effect\u0027] \u003d \\"},{"line_number":222,"context_line":"                pid_invoked_with_cmdline_retvals"},{"line_number":223,"context_line":"        else:"},{"line_number":224,"context_line":"            pid_invoked_with_cmdline[\u0027return_value\u0027] \u003d False"}],"source_content_type":"text/x-python","patch_set":20,"id":"1a6eadb0_c3509d61","line":221,"range":{"start_line":221,"start_character":53,"end_line":221,"end_character":55},"updated":"2016-12-19 14:41:00.000000000","message":"Unless importing or using nested mock, it\u0027s recommended to use brackets:\n\n variable \u003d (\n     value)","commit_id":"ed1b50991ebb8211610382bea4af76cdd0f06665"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"1995e055d1af45f2d9d304d2e080df7613f7b794","unresolved":false,"context_lines":[{"line_number":218,"context_line":""},{"line_number":219,"context_line":"        pid_invoked_with_cmdline \u003d {}"},{"line_number":220,"context_line":"        if pid_invoked_with_cmdline_retvals:"},{"line_number":221,"context_line":"            pid_invoked_with_cmdline[\u0027side_effect\u0027] \u003d \\"},{"line_number":222,"context_line":"                pid_invoked_with_cmdline_retvals"},{"line_number":223,"context_line":"        else:"},{"line_number":224,"context_line":"            pid_invoked_with_cmdline[\u0027return_value\u0027] \u003d False"}],"source_content_type":"text/x-python","patch_set":20,"id":"1a6eadb0_05d8d51c","line":221,"range":{"start_line":221,"start_character":53,"end_line":221,"end_character":55},"in_reply_to":"1a6eadb0_c3509d61","updated":"2016-12-19 16:40:14.000000000","message":"Done","commit_id":"ed1b50991ebb8211610382bea4af76cdd0f06665"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"9ba567fb1637aee92153e04d9082280b12308051","unresolved":false,"context_lines":[{"line_number":270,"context_line":"        self._test_kill_process(\u00271\u0027, None, \u0027No such process\u0027)"},{"line_number":271,"context_line":""},{"line_number":272,"context_line":"    def test_kill_process_raises_exception_for_execute_exception(self):"},{"line_number":273,"context_line":"        self.assertRaises(utils.ProcessExecutionError, self._test_kill_process,"},{"line_number":274,"context_line":"                          \u00271\u0027, None, \u0027Invalid\u0027)"},{"line_number":275,"context_line":""},{"line_number":276,"context_line":"    def test_kill_process_with_different_signal(self):"},{"line_number":277,"context_line":"        self._test_kill_process(\u00271\u0027, None, kill_signal\u003dsignal.SIGTERM)"}],"source_content_type":"text/x-python","patch_set":20,"id":"1a6eadb0_e392f9f5","line":274,"range":{"start_line":273,"start_character":0,"end_line":274,"end_character":47},"updated":"2016-12-19 14:41:00.000000000","message":"I personally find the previous implementation better :) But maybe that\u0027s just me.","commit_id":"ed1b50991ebb8211610382bea4af76cdd0f06665"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"1995e055d1af45f2d9d304d2e080df7613f7b794","unresolved":false,"context_lines":[{"line_number":270,"context_line":"        self._test_kill_process(\u00271\u0027, None, \u0027No such process\u0027)"},{"line_number":271,"context_line":""},{"line_number":272,"context_line":"    def test_kill_process_raises_exception_for_execute_exception(self):"},{"line_number":273,"context_line":"        self.assertRaises(utils.ProcessExecutionError, self._test_kill_process,"},{"line_number":274,"context_line":"                          \u00271\u0027, None, \u0027Invalid\u0027)"},{"line_number":275,"context_line":""},{"line_number":276,"context_line":"    def test_kill_process_with_different_signal(self):"},{"line_number":277,"context_line":"        self._test_kill_process(\u00271\u0027, None, kill_signal\u003dsignal.SIGTERM)"}],"source_content_type":"text/x-python","patch_set":20,"id":"1a6eadb0_e54839cf","line":274,"range":{"start_line":273,"start_character":0,"end_line":274,"end_character":47},"in_reply_to":"1a6eadb0_e392f9f5","updated":"2016-12-19 16:40:14.000000000","message":"actually me too, i revert it :) (what a mess!)","commit_id":"ed1b50991ebb8211610382bea4af76cdd0f06665"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"302dd12940692fb5b7153c3d6195d9a5094b94e3","unresolved":false,"context_lines":[{"line_number":270,"context_line":"        self._test_kill_process(\u00271\u0027, None, \u0027No such process\u0027)"},{"line_number":271,"context_line":""},{"line_number":272,"context_line":"    def test_kill_process_raises_exception_for_execute_exception(self):"},{"line_number":273,"context_line":"        self.assertRaises(utils.ProcessExecutionError, self._test_kill_process,"},{"line_number":274,"context_line":"                          \u00271\u0027, None, \u0027Invalid\u0027)"},{"line_number":275,"context_line":""},{"line_number":276,"context_line":"    def test_kill_process_with_different_signal(self):"},{"line_number":277,"context_line":"        self._test_kill_process(\u00271\u0027, None, kill_signal\u003dsignal.SIGTERM)"}],"source_content_type":"text/x-python","patch_set":20,"id":"1a6eadb0_49e587a6","line":274,"range":{"start_line":273,"start_character":0,"end_line":274,"end_character":47},"in_reply_to":"1a6eadb0_e54839cf","updated":"2016-12-19 16:49:23.000000000","message":"+1!","commit_id":"ed1b50991ebb8211610382bea4af76cdd0f06665"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"01c5b247f5c5057c802abea4d8b3f7e4195c3f84","unresolved":false,"context_lines":[{"line_number":249,"context_line":""},{"line_number":250,"context_line":""},{"line_number":251,"context_line":"class TestKillProcess(base.BaseTestCase):"},{"line_number":252,"context_line":"    def _test_kill_process(self, pid, exception_message\u003dNone,"},{"line_number":253,"context_line":"                           kill_signal\u003dsignal.SIGKILL):"},{"line_number":254,"context_line":"        if exception_message:"},{"line_number":255,"context_line":"            exc \u003d utils.ProcessExecutionError(exception_message, returncode\u003d0)"}],"source_content_type":"text/x-python","patch_set":24,"id":"1a6eadb0_6f9c036a","line":252,"updated":"2016-12-19 17:20:50.000000000","message":"Smart pylint found you providing expected \u003d None and function returning None, uh?! ;)","commit_id":"eb5cb29fc0038005dee6a202cc48587cda1d11f5"}],"neutron/tests/unit/cmd/test_netns_cleanup.py":[{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"476c1b19f146f63c891f5dc7b75afd0858d07d14","unresolved":false,"context_lines":[{"line_number":19,"context_line":"from neutron.cmd import netns_cleanup as util"},{"line_number":20,"context_line":"from neutron.tests import base"},{"line_number":21,"context_line":""},{"line_number":22,"context_line":"NETSTAT_SAMPLE1 \u003d (\"\"\""},{"line_number":23,"context_line":"Active Internet connections (only servers)"},{"line_number":24,"context_line":"Proto Recv-Q Send-Q Local Address           Foreign Address         State\\"},{"line_number":25,"context_line":"       PID/Program name"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_46363b53","line":22,"range":{"start_line":22,"start_character":8,"end_line":22,"end_character":15},"updated":"2016-12-02 10:12:23.000000000","message":"Maybe instead of sample some descriptive name would help reading code. Like NETSTAT_LISTENING_PROCESSES, NETSTAT_FAILURE, NETSTAT_NO_PROCESSES","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"3a031d9a8b2f97e0a57f6071619139c8400b6faa","unresolved":false,"context_lines":[{"line_number":19,"context_line":"from neutron.cmd import netns_cleanup as util"},{"line_number":20,"context_line":"from neutron.tests import base"},{"line_number":21,"context_line":""},{"line_number":22,"context_line":"NETSTAT_SAMPLE1 \u003d (\"\"\""},{"line_number":23,"context_line":"Active Internet connections (only servers)"},{"line_number":24,"context_line":"Proto Recv-Q Send-Q Local Address           Foreign Address         State\\"},{"line_number":25,"context_line":"       PID/Program name"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_9e6ea42d","line":22,"range":{"start_line":22,"start_character":8,"end_line":22,"end_character":15},"in_reply_to":"3a71b18c_1964a447","updated":"2016-12-04 19:51:17.000000000","message":"Done","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"a746350a3ee3cd9f1cdb1130b41f44f9e0c92c92","unresolved":false,"context_lines":[{"line_number":19,"context_line":"from neutron.cmd import netns_cleanup as util"},{"line_number":20,"context_line":"from neutron.tests import base"},{"line_number":21,"context_line":""},{"line_number":22,"context_line":"NETSTAT_SAMPLE1 \u003d (\"\"\""},{"line_number":23,"context_line":"Active Internet connections (only servers)"},{"line_number":24,"context_line":"Proto Recv-Q Send-Q Local Address           Foreign Address         State\\"},{"line_number":25,"context_line":"       PID/Program name"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_1964a447","line":22,"range":{"start_line":22,"start_character":8,"end_line":22,"end_character":15},"in_reply_to":"3a71b18c_46363b53","updated":"2016-12-02 10:31:32.000000000","message":"+1","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"3a031d9a8b2f97e0a57f6071619139c8400b6faa","unresolved":false,"context_lines":[{"line_number":19,"context_line":"from neutron.cmd import netns_cleanup as util"},{"line_number":20,"context_line":"from neutron.tests import base"},{"line_number":21,"context_line":""},{"line_number":22,"context_line":"NETSTAT_SAMPLE1 \u003d (\"\"\""},{"line_number":23,"context_line":"Active Internet connections (only servers)"},{"line_number":24,"context_line":"Proto Recv-Q Send-Q Local Address           Foreign Address         State\\"},{"line_number":25,"context_line":"       PID/Program name"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_be69a027","line":22,"range":{"start_line":22,"start_character":8,"end_line":22,"end_character":15},"in_reply_to":"3a71b18c_46363b53","updated":"2016-12-04 19:51:17.000000000","message":"Done","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"0219940d9af7071de4c10307633b1c713d0f20ee","unresolved":false,"context_lines":[{"line_number":202,"context_line":"        with mock.patch(\u0027neutron.agent.linux.ip_lib.IPWrapper\u0027) as ip_wrap:"},{"line_number":203,"context_line":"            ip_wrap.return_value.netns.execute.return_value \u003d netstat_output"},{"line_number":204,"context_line":"            actual_val \u003d util.find_listen_pids_namespace(mock.ANY)"},{"line_number":205,"context_line":"            self.assertEqual(actual_val, expect_val)"},{"line_number":206,"context_line":""},{"line_number":207,"context_line":"    def test_find_listen_pids_namespace_correct_output(self):"},{"line_number":208,"context_line":"        expect_val \u003d set([\u00271347\u0027, \u00271279\u0027, \u00271349\u0027, \u00271353\u0027])"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_798af8c0","line":205,"range":{"start_line":205,"start_character":29,"end_line":205,"end_character":51},"updated":"2016-12-02 10:38:16.000000000","message":"You should switch the order and consider using \"expected, observed\"","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"3a031d9a8b2f97e0a57f6071619139c8400b6faa","unresolved":false,"context_lines":[{"line_number":202,"context_line":"        with mock.patch(\u0027neutron.agent.linux.ip_lib.IPWrapper\u0027) as ip_wrap:"},{"line_number":203,"context_line":"            ip_wrap.return_value.netns.execute.return_value \u003d netstat_output"},{"line_number":204,"context_line":"            actual_val \u003d util.find_listen_pids_namespace(mock.ANY)"},{"line_number":205,"context_line":"            self.assertEqual(actual_val, expect_val)"},{"line_number":206,"context_line":""},{"line_number":207,"context_line":"    def test_find_listen_pids_namespace_correct_output(self):"},{"line_number":208,"context_line":"        expect_val \u003d set([\u00271347\u0027, \u00271279\u0027, \u00271349\u0027, \u00271353\u0027])"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_de781cf5","line":205,"range":{"start_line":205,"start_character":29,"end_line":205,"end_character":51},"in_reply_to":"3a71b18c_798af8c0","updated":"2016-12-04 19:51:17.000000000","message":"Done.\nI got it from here [1] and most of the assertEqual calls in that file are in the form \"observed, expected\" though but I\u0027ll stick to your suggestion\n[1] https://github.com/openstack/neutron/blob/master/neutron/tests/unit/agent/linux/test_utils.py#L181","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"d7e83bf0834459217dbca6d3ff64377bea4f6536","unresolved":false,"context_lines":[{"line_number":212,"context_line":"    def test_find_listen_pids_namespace_no_procs(self):"},{"line_number":213,"context_line":"        expect_val \u003d set()"},{"line_number":214,"context_line":"        self._test_find_listen_pids_namespace_helper(expect_val,"},{"line_number":215,"context_line":"                                                     NETSTAT_SAMPLE2)"},{"line_number":216,"context_line":"        self._test_find_listen_pids_namespace_helper(expect_val,"},{"line_number":217,"context_line":"                                                     NETSTAT_SAMPLE3)"},{"line_number":218,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_91c6ce47","line":215,"updated":"2016-12-02 09:40:02.000000000","message":"I\u0027m splitting this into two different tests in my next PS.\n- test_find_listen_pids_namespace_no_procs \n- test_find_listen_pids_namespace_no_namespace","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"3a031d9a8b2f97e0a57f6071619139c8400b6faa","unresolved":false,"context_lines":[{"line_number":212,"context_line":"    def test_find_listen_pids_namespace_no_procs(self):"},{"line_number":213,"context_line":"        expect_val \u003d set()"},{"line_number":214,"context_line":"        self._test_find_listen_pids_namespace_helper(expect_val,"},{"line_number":215,"context_line":"                                                     NETSTAT_SAMPLE2)"},{"line_number":216,"context_line":"        self._test_find_listen_pids_namespace_helper(expect_val,"},{"line_number":217,"context_line":"                                                     NETSTAT_SAMPLE3)"},{"line_number":218,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_1ec8d421","line":215,"in_reply_to":"3a71b18c_91c6ce47","updated":"2016-12-04 19:51:17.000000000","message":"Done","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"0219940d9af7071de4c10307633b1c713d0f20ee","unresolved":false,"context_lines":[{"line_number":216,"context_line":"        self._test_find_listen_pids_namespace_helper(expect_val,"},{"line_number":217,"context_line":"                                                     NETSTAT_SAMPLE3)"},{"line_number":218,"context_line":""},{"line_number":219,"context_line":"    def _test__kill_listen_processes_helper(self, pids, parents, childs,"},{"line_number":220,"context_line":"                                            kills_expected, force):"},{"line_number":221,"context_line":"        def _get_element(dict, x):"},{"line_number":222,"context_line":"            if not dict:"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_7903d842","line":219,"range":{"start_line":219,"start_character":65,"end_line":219,"end_character":71},"updated":"2016-12-02 10:38:16.000000000","message":"Do you use childs because it\u0027s shorter than children ? :)","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"3a031d9a8b2f97e0a57f6071619139c8400b6faa","unresolved":false,"context_lines":[{"line_number":216,"context_line":"        self._test_find_listen_pids_namespace_helper(expect_val,"},{"line_number":217,"context_line":"                                                     NETSTAT_SAMPLE3)"},{"line_number":218,"context_line":""},{"line_number":219,"context_line":"    def _test__kill_listen_processes_helper(self, pids, parents, childs,"},{"line_number":220,"context_line":"                                            kills_expected, force):"},{"line_number":221,"context_line":"        def _get_element(dict, x):"},{"line_number":222,"context_line":"            if not dict:"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_3e64b047","line":219,"range":{"start_line":219,"start_character":65,"end_line":219,"end_character":71},"in_reply_to":"3a71b18c_7903d842","updated":"2016-12-04 19:51:17.000000000","message":"Done","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"0219940d9af7071de4c10307633b1c713d0f20ee","unresolved":false,"context_lines":[{"line_number":218,"context_line":""},{"line_number":219,"context_line":"    def _test__kill_listen_processes_helper(self, pids, parents, childs,"},{"line_number":220,"context_line":"                                            kills_expected, force):"},{"line_number":221,"context_line":"        def _get_element(dict, x):"},{"line_number":222,"context_line":"            if not dict:"},{"line_number":223,"context_line":"                return []"},{"line_number":224,"context_line":"            return dict[x]"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_19f2e46f","line":221,"range":{"start_line":221,"start_character":25,"end_line":221,"end_character":29},"updated":"2016-12-02 10:38:16.000000000","message":"This is a Python keyword you\u0027re shadowing, Maybe dct ?","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"3a031d9a8b2f97e0a57f6071619139c8400b6faa","unresolved":false,"context_lines":[{"line_number":218,"context_line":""},{"line_number":219,"context_line":"    def _test__kill_listen_processes_helper(self, pids, parents, childs,"},{"line_number":220,"context_line":"                                            kills_expected, force):"},{"line_number":221,"context_line":"        def _get_element(dict, x):"},{"line_number":222,"context_line":"            if not dict:"},{"line_number":223,"context_line":"                return []"},{"line_number":224,"context_line":"            return dict[x]"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_1e61b439","line":221,"range":{"start_line":221,"start_character":25,"end_line":221,"end_character":29},"in_reply_to":"3a71b18c_19f2e46f","updated":"2016-12-04 19:51:17.000000000","message":"Ups!\nDone","commit_id":"93e292eeae74bd23551f58d545ba87be7cedceb0"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"bf0917abf63488871166520cb66e5ed89cfb68da","unresolved":false,"context_lines":[{"line_number":14,"context_line":"#    under the License."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"import mock"},{"line_number":17,"context_line":"import signal"},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"from neutron.cmd import netns_cleanup as util"},{"line_number":20,"context_line":"from neutron.tests import base"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a6eadb0_1c63bedd","line":17,"range":{"start_line":17,"start_character":0,"end_line":17,"end_character":13},"updated":"2016-12-14 10:34:56.000000000","message":"This should go to L15","commit_id":"d823c360987bd85bdb90327e5b10cb6b787c2920"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"ed8d34f153db4b3a68c577958d8bc8489d2f0fe3","unresolved":false,"context_lines":[{"line_number":14,"context_line":"#    under the License."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"import mock"},{"line_number":17,"context_line":"import signal"},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"from neutron.cmd import netns_cleanup as util"},{"line_number":20,"context_line":"from neutron.tests import base"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a6eadb0_bc21bca1","line":17,"range":{"start_line":17,"start_character":0,"end_line":17,"end_character":13},"in_reply_to":"1a6eadb0_1c63bedd","updated":"2016-12-14 13:35:04.000000000","message":"Done","commit_id":"d823c360987bd85bdb90327e5b10cb6b787c2920"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"8c22c87405ce8359bc8714165a64c0d84a0be302","unresolved":false,"context_lines":[{"line_number":223,"context_line":"    def _test__kill_listen_processes_helper(self, pids, parents, children,"},{"line_number":224,"context_line":"                                            kills_expected, force):"},{"line_number":225,"context_line":"        def _get_element(dct, x):"},{"line_number":226,"context_line":"            if not dct:"},{"line_number":227,"context_line":"                return []"},{"line_number":228,"context_line":"            return dct[x]"},{"line_number":229,"context_line":""},{"line_number":230,"context_line":"        def _find_childs(x, recursive):"},{"line_number":231,"context_line":"            return _get_element(children, x)"}],"source_content_type":"text/x-python","patch_set":19,"id":"1a6eadb0_a21020ad","line":228,"range":{"start_line":226,"start_character":12,"end_line":228,"end_character":25},"updated":"2016-12-18 07:52:39.000000000","message":"Replace with:\n\n return dct.get(x, [])","commit_id":"5f3419013466d534ed2f5f37c528d4fc46d7e0fc"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"12eeccd5bf1ef9327d5ee4e77be403465e606beb","unresolved":false,"context_lines":[{"line_number":223,"context_line":"    def _test__kill_listen_processes_helper(self, pids, parents, children,"},{"line_number":224,"context_line":"                                            kills_expected, force):"},{"line_number":225,"context_line":"        def _get_element(dct, x):"},{"line_number":226,"context_line":"            if not dct:"},{"line_number":227,"context_line":"                return []"},{"line_number":228,"context_line":"            return dct[x]"},{"line_number":229,"context_line":""},{"line_number":230,"context_line":"        def _find_childs(x, recursive):"},{"line_number":231,"context_line":"            return _get_element(children, x)"}],"source_content_type":"text/x-python","patch_set":19,"id":"1a6eadb0_e65a0c50","line":228,"range":{"start_line":226,"start_character":12,"end_line":228,"end_character":25},"in_reply_to":"1a6eadb0_a21020ad","updated":"2016-12-19 13:42:53.000000000","message":"Done","commit_id":"5f3419013466d534ed2f5f37c528d4fc46d7e0fc"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"8c22c87405ce8359bc8714165a64c0d84a0be302","unresolved":false,"context_lines":[{"line_number":268,"context_line":"        pids \u003d [\u00274\u0027, \u00275\u0027, \u00276\u0027]"},{"line_number":269,"context_line":"        parents \u003d {\u00274\u0027: \u00271\u0027, \u00275\u0027: \u00272\u0027, \u00276\u0027: \u00273\u0027}"},{"line_number":270,"context_line":"        children \u003d {\u00271\u0027: [\u00274\u0027], \u00272\u0027: [\u00275\u0027], \u00273\u0027: [\u00276\u0027, \u00278\u0027, \u00277\u0027]}"},{"line_number":271,"context_line":"        kills_expected \u003d [(\u00271\u0027, signal.SIGKILL),"},{"line_number":272,"context_line":"                          (\u00272\u0027, signal.SIGKILL),"},{"line_number":273,"context_line":"                          (\u00273\u0027, signal.SIGKILL),"},{"line_number":274,"context_line":"                          (\u00274\u0027, signal.SIGKILL),"}],"source_content_type":"text/x-python","patch_set":19,"id":"1a6eadb0_4222ec02","line":271,"range":{"start_line":271,"start_character":8,"end_line":271,"end_character":22},"updated":"2016-12-18 07:52:39.000000000","message":"Surely the construction of this list can be simplified with a list comprehension :)","commit_id":"5f3419013466d534ed2f5f37c528d4fc46d7e0fc"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"9ba567fb1637aee92153e04d9082280b12308051","unresolved":false,"context_lines":[{"line_number":275,"context_line":"                               return_value\u003d1) as mock_kill_listen:"},{"line_number":276,"context_line":"            with mock.patch(\u0027neutron.common.utils.wait_until_true\u0027)\\"},{"line_number":277,"context_line":"                    as wait_until_true_mock:"},{"line_number":278,"context_line":"                wait_until_true_mock.side_effect \u003d \\"},{"line_number":279,"context_line":"                    Exception(util.SIGTERM_TIMEOUT_EXCEPTION)"},{"line_number":280,"context_line":"                namespace \u003d mock.ANY"},{"line_number":281,"context_line":"                util.kill_listen_processes(namespace)"}],"source_content_type":"text/x-python","patch_set":20,"id":"1a6eadb0_e3a91926","line":278,"range":{"start_line":278,"start_character":51,"end_line":278,"end_character":52},"updated":"2016-12-19 14:41:00.000000000","message":"Bracket","commit_id":"ed1b50991ebb8211610382bea4af76cdd0f06665"},{"author":{"_account_id":23804,"name":"Daniel Alvarez","email":"dalvarez@redhat.com","username":"dalvarez"},"change_message_id":"1995e055d1af45f2d9d304d2e080df7613f7b794","unresolved":false,"context_lines":[{"line_number":275,"context_line":"                               return_value\u003d1) as mock_kill_listen:"},{"line_number":276,"context_line":"            with mock.patch(\u0027neutron.common.utils.wait_until_true\u0027)\\"},{"line_number":277,"context_line":"                    as wait_until_true_mock:"},{"line_number":278,"context_line":"                wait_until_true_mock.side_effect \u003d \\"},{"line_number":279,"context_line":"                    Exception(util.SIGTERM_TIMEOUT_EXCEPTION)"},{"line_number":280,"context_line":"                namespace \u003d mock.ANY"},{"line_number":281,"context_line":"                util.kill_listen_processes(namespace)"}],"source_content_type":"text/x-python","patch_set":20,"id":"1a6eadb0_e5767905","line":278,"range":{"start_line":278,"start_character":51,"end_line":278,"end_character":52},"in_reply_to":"1a6eadb0_e3a91926","updated":"2016-12-19 16:40:14.000000000","message":"Done","commit_id":"ed1b50991ebb8211610382bea4af76cdd0f06665"}]}
