)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"84c3d70e37e88a5846400175adffc431a6274d0b","unresolved":true,"context_lines":[{"line_number":24,"context_line":""},{"line_number":25,"context_line":"This patch only adds the shared helpers and their unit tests; migrating"},{"line_number":26,"context_line":"the individual drivers to use them will follow in later patches."},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"Partial-Bug: #2152545"},{"line_number":29,"context_line":"Generated-By: Claude Code (claude-opus-4-8)"},{"line_number":30,"context_line":"Change-Id: I810742dfa79a369f441b6f6cf7234ae88330afe4"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"e765cb68_d7a7d420","line":27,"updated":"2026-07-27 16:08:13.000000000","message":"thanks for starting on this.\nnext cycle we are considerign a more invasieve rewite of the pci enumartion and discoveray functionatliy but paying down this initall technial debt will make that converstaion eaiser to progress.","commit_id":"8afcdd8772353241802cdae89bb10eb750a4a5d1"},{"author":{"_account_id":39344,"name":"Gihong Lee","display_name":"gamio","email":"gh9231@gmail.com","username":"gamio"},"change_message_id":"61bf3035197b515b5b38dc2f88acfffae31f790d","unresolved":false,"context_lines":[{"line_number":24,"context_line":""},{"line_number":25,"context_line":"This patch only adds the shared helpers and their unit tests; migrating"},{"line_number":26,"context_line":"the individual drivers to use them will follow in later patches."},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"Partial-Bug: #2152545"},{"line_number":29,"context_line":"Generated-By: Claude Code (claude-opus-4-8)"},{"line_number":30,"context_line":"Change-Id: I810742dfa79a369f441b6f6cf7234ae88330afe4"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"abcceb95_fead39f1","line":27,"in_reply_to":"e765cb68_d7a7d420","updated":"2026-07-28 12:20:50.000000000","message":"Thanks, happy to help pay this down.","commit_id":"8afcdd8772353241802cdae89bb10eb750a4a5d1"},{"author":{"_account_id":34452,"name":"Joan Gilabert","display_name":"jgilaber","email":"jgilaber@redhat.com","username":"jgilaber"},"change_message_id":"121ff942c00f05f28cd1fe861009599ea7b9cd1e","unresolved":true,"context_lines":[{"line_number":13,"context_line":""},{"line_number":14,"context_line":"Introduce shared implementations in the accelerator common utils:"},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"* lspci_privileged(cmd\u003d(\u0027lspci\u0027, \u0027-nnn\u0027, \u0027-D\u0027)) wraps the privileged"},{"line_number":17,"context_line":"  lspci call and takes an optional command, so callers that need a"},{"line_number":18,"context_line":"  different invocation (e.g. xilinx\u0027s per-device \u0027lspci -k -s\u0027) can"},{"line_number":19,"context_line":"  reuse it."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"a7f1144c_ba53ab4d","line":16,"updated":"2026-07-28 13:45:40.000000000","message":"nit: this has been changed in code to `-nn`, but not updated here. And the same is true about the parameters for the `get_pci_devices`","commit_id":"901bbfa50717e63ae50c11ff43d7111069c1b5e7"},{"author":{"_account_id":39344,"name":"Gihong Lee","display_name":"gamio","email":"gh9231@gmail.com","username":"gamio"},"change_message_id":"24ac1064f69c44748983c5bcb16877fa40712a4b","unresolved":false,"context_lines":[{"line_number":13,"context_line":""},{"line_number":14,"context_line":"Introduce shared implementations in the accelerator common utils:"},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"* lspci_privileged(cmd\u003d(\u0027lspci\u0027, \u0027-nnn\u0027, \u0027-D\u0027)) wraps the privileged"},{"line_number":17,"context_line":"  lspci call and takes an optional command, so callers that need a"},{"line_number":18,"context_line":"  different invocation (e.g. xilinx\u0027s per-device \u0027lspci -k -s\u0027) can"},{"line_number":19,"context_line":"  reuse it."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"a8040e96_44a1338c","line":16,"in_reply_to":"a7f1144c_ba53ab4d","updated":"2026-07-28 14:11:16.000000000","message":"Done, updated the commit messages to match the predicate-based design.","commit_id":"901bbfa50717e63ae50c11ff43d7111069c1b5e7"}],"/PATCHSET_LEVEL":[{"author":{"_account_id":34452,"name":"Joan Gilabert","display_name":"jgilaber","email":"jgilaber@redhat.com","username":"jgilaber"},"change_message_id":"121ff942c00f05f28cd1fe861009599ea7b9cd1e","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":3,"id":"76aab6e1_d35bdabb","updated":"2026-07-28 13:45:40.000000000","message":"lgtm","commit_id":"901bbfa50717e63ae50c11ff43d7111069c1b5e7"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"7b6885ce597409e041a2071ac2d979442874c8ff","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":5,"id":"c6c0dd1d_24ad2f22","updated":"2026-07-28 15:28:15.000000000","message":"ill leave this up for a few days for others to review but this looks reasonable to me. i also want to review the next patch as well but i think this will result in quite a nice cleanup.","commit_id":"40fedd89604bc6e31c4d5c615278eea6e2fd2aa0"},{"author":{"_account_id":39344,"name":"Gihong Lee","display_name":"gamio","email":"gh9231@gmail.com","username":"gamio"},"change_message_id":"364a73e43499a1ad5d3a91f302a6c327dcd31ba1","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":5,"id":"31f7ca98_af2479d9","in_reply_to":"c6c0dd1d_24ad2f22","updated":"2026-07-29 14:41:19.000000000","message":"Thanks. Fixed the privsep contract in this revision. Ready for another look whenever you have time.","commit_id":"40fedd89604bc6e31c4d5c615278eea6e2fd2aa0"}],"cyborg/accelerator/common/utils.py":[{"author":{"_account_id":28006,"name":"teim-ci","display_name":"teim-ci","email":"ci@seanmooney.info","username":"ci-sean-mooney","status":"this is a third-party ci account run by sean-k-mooney on irc\nhosted at zuul.teim.app"},"tag":"autogenerated:zuul:automatic-ci","change_message_id":"4e9b71dd708ae1e9836601c8556ae55ae87166c1","unresolved":false,"context_lines":[{"line_number":152,"context_line":"    return processutils.execute(*cmd)[0]"},{"line_number":153,"context_line":""},{"line_number":154,"context_line":""},{"line_number":155,"context_line":"def get_pci_devices(pci_flags, vendor_id\u003dNone, match\u003dany):"},{"line_number":156,"context_line":"    device_for_vendor_out \u003d []"},{"line_number":157,"context_line":"    all_device_out \u003d []"},{"line_number":158,"context_line":"    lspci_out \u003d lspci_privileged().split(\u0027\\n\u0027)"}],"source_content_type":"text/x-python","patch_set":2,"id":"2a14bf0d_9159c1de","line":155,"updated":"2026-07-26 14:35:43.000000000","message":"The shared get_pci_devices() always calls lspci_privileged() with no arguments, so it permanently uses the default (\u0027lspci\u0027, \u0027-nnn\u0027, \u0027-D\u0027). The SSD driver\u0027s existing lspci_privileged() uses \u0027lspci -nn -D\u0027 (two n\u0027s, not three). Since get_pci_devices does not expose a cmd parameter, migrating the S...\n\n**Severity**: SUGGESTION | **Confidence**: 0.8\n\n**Benefit**: When the SSD driver is migrated to use the shared get_pci_devices (as planned in the commit message), the lspci output will switch from -nn to -nnn format. This changes the verbosity of PCI class/device names in the output, which could affect downstream parsing of SSD device info. The SSD driver...\n\n**Recommendation**:\nAdd an optional cmd parameter to get_pci_devices (e.g. def get_pci_devices(pci_flags, vendor_id\u003dNone, match\u003dany, cmd\u003dNone)) and pass it through to lspci_privileged when provided, so all drivers including SSD can reuse the shared function while preserving their current lspci invocation. Alternatively, document this limitation explicitly so the SSD migration patch addresses it.","commit_id":"8afcdd8772353241802cdae89bb10eb750a4a5d1"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"84c3d70e37e88a5846400175adffc431a6274d0b","unresolved":true,"context_lines":[{"line_number":152,"context_line":"    return processutils.execute(*cmd)[0]"},{"line_number":153,"context_line":""},{"line_number":154,"context_line":""},{"line_number":155,"context_line":"def get_pci_devices(pci_flags, vendor_id\u003dNone, match\u003dany):"},{"line_number":156,"context_line":"    device_for_vendor_out \u003d []"},{"line_number":157,"context_line":"    all_device_out \u003d []"},{"line_number":158,"context_line":"    lspci_out \u003d lspci_privileged().split(\u0027\\n\u0027)"}],"source_content_type":"text/x-python","patch_set":2,"id":"7561371f_22c24d10","line":155,"range":{"start_line":155,"start_character":47,"end_line":155,"end_character":52},"updated":"2026-07-27 16:08:13.000000000","message":"match is a keyword in python 3.10 and later\n\n\n\n```suggestion\ndef get_pci_devices(pci_flags, vendor_id\u003dNone, predicate\u003dany):\n```","commit_id":"8afcdd8772353241802cdae89bb10eb750a4a5d1"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"84c3d70e37e88a5846400175adffc431a6274d0b","unresolved":true,"context_lines":[{"line_number":152,"context_line":"    return processutils.execute(*cmd)[0]"},{"line_number":153,"context_line":""},{"line_number":154,"context_line":""},{"line_number":155,"context_line":"def get_pci_devices(pci_flags, vendor_id\u003dNone, match\u003dany):"},{"line_number":156,"context_line":"    device_for_vendor_out \u003d []"},{"line_number":157,"context_line":"    all_device_out \u003d []"},{"line_number":158,"context_line":"    lspci_out \u003d lspci_privileged().split(\u0027\\n\u0027)"}],"source_content_type":"text/x-python","patch_set":2,"id":"399b9f3e_b779f648","line":155,"in_reply_to":"2a14bf0d_9159c1de","updated":"2026-07-27 16:08:13.000000000","message":"so we do not want this to be configurable in general, however -nnn is not a valid parmater\n\nthere is -n and -nn\n\ni think -nnn woudl be parsed as both `lspci -n -nn -D`\nor internally if its usign getopt it woudl coudn the ns and set the levle ot 3 but that is not something lspci actully implent.\n\nwe shodul jsut use `-nn` since tha tis the behvior we actully want and what is documented by lspci\n\n\nhttps://man7.org/linux/man-pages/man8/lspci.8.html","commit_id":"8afcdd8772353241802cdae89bb10eb750a4a5d1"},{"author":{"_account_id":39344,"name":"Gihong Lee","display_name":"gamio","email":"gh9231@gmail.com","username":"gamio"},"change_message_id":"61bf3035197b515b5b38dc2f88acfffae31f790d","unresolved":false,"context_lines":[{"line_number":152,"context_line":"    return processutils.execute(*cmd)[0]"},{"line_number":153,"context_line":""},{"line_number":154,"context_line":""},{"line_number":155,"context_line":"def get_pci_devices(pci_flags, vendor_id\u003dNone, match\u003dany):"},{"line_number":156,"context_line":"    device_for_vendor_out \u003d []"},{"line_number":157,"context_line":"    all_device_out \u003d []"},{"line_number":158,"context_line":"    lspci_out \u003d lspci_privileged().split(\u0027\\n\u0027)"}],"source_content_type":"text/x-python","patch_set":2,"id":"affdf696_0d2c95f2","line":155,"in_reply_to":"399b9f3e_b779f648","updated":"2026-07-28 12:20:50.000000000","message":"I changed the default to `-nn`.","commit_id":"8afcdd8772353241802cdae89bb10eb750a4a5d1"},{"author":{"_account_id":39344,"name":"Gihong Lee","display_name":"gamio","email":"gh9231@gmail.com","username":"gamio"},"change_message_id":"61bf3035197b515b5b38dc2f88acfffae31f790d","unresolved":false,"context_lines":[{"line_number":152,"context_line":"    return processutils.execute(*cmd)[0]"},{"line_number":153,"context_line":""},{"line_number":154,"context_line":""},{"line_number":155,"context_line":"def get_pci_devices(pci_flags, vendor_id\u003dNone, match\u003dany):"},{"line_number":156,"context_line":"    device_for_vendor_out \u003d []"},{"line_number":157,"context_line":"    all_device_out \u003d []"},{"line_number":158,"context_line":"    lspci_out \u003d lspci_privileged().split(\u0027\\n\u0027)"}],"source_content_type":"text/x-python","patch_set":2,"id":"2aad5965_6d1bf2c5","line":155,"range":{"start_line":155,"start_character":47,"end_line":155,"end_character":52},"in_reply_to":"7561371f_22c24d10","updated":"2026-07-28 12:20:50.000000000","message":"Done. Renamed to a predicate based API as you suggested.","commit_id":"8afcdd8772353241802cdae89bb10eb750a4a5d1"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"84c3d70e37e88a5846400175adffc431a6274d0b","unresolved":true,"context_lines":[{"line_number":153,"context_line":""},{"line_number":154,"context_line":""},{"line_number":155,"context_line":"def get_pci_devices(pci_flags, vendor_id\u003dNone, match\u003dany):"},{"line_number":156,"context_line":"    device_for_vendor_out \u003d []"},{"line_number":157,"context_line":"    all_device_out \u003d []"},{"line_number":158,"context_line":"    lspci_out \u003d lspci_privileged().split(\u0027\\n\u0027)"},{"line_number":159,"context_line":"    for pci in lspci_out:"},{"line_number":160,"context_line":"        if match(x in pci for x in pci_flags):"},{"line_number":161,"context_line":"            all_device_out.append(pci)"},{"line_number":162,"context_line":"            if vendor_id and vendor_id in pci:"},{"line_number":163,"context_line":"                device_for_vendor_out.append(pci)"},{"line_number":164,"context_line":"    return device_for_vendor_out if vendor_id else all_device_out"}],"source_content_type":"text/x-python","patch_set":2,"id":"c1012a41_d87d6d4c","line":164,"range":{"start_line":156,"start_character":0,"end_line":164,"end_character":65},"updated":"2026-07-27 16:08:13.000000000","message":"i think in general this could be expess more compoabley wiht a cleaner interface if we model this as a generator expression that thats as set of composable predicates\n\nsomething like this\n\n```\nfrom collections import abc\nfrom oslo_concurrency import processutils\n\nimport cyborg.privsep\n\n\n@cyborg.privsep.sys_admin_pctxt.entrypoint\ndef lspci_privileged(cmd\u003d(\u0027lspci\u0027, \u0027-nn\u0027, \u0027-D\u0027)):\n    return processutils.execute(*cmd)[0]\n\n\ndef has_flags(\n    flags: abc.Iterable[str],\n    reducer: abc.Callable[[abc.Iterable[bool]], bool] \u003d any,\n) -\u003e abc.Callable[[str], bool]:\n    \"\"\"Return a predicate checking if a line matches flags using a reducer (any/all).\"\"\"\n    return lambda line: reducer(flag in line for flag in flags)\n\n\ndef has_vendor(vendor_id: str) -\u003e abc.Callable[[str], bool]:\n    \"\"\"Return a predicate checking if a vendor ID exists in a line.\"\"\"\n    return lambda line: vendor_id in line\n\n\ndef get_pci_devices(\n    *predicates: abc.Callable[[str], bool]\n) -\u003e abc.Iterator[str]:\n    \"\"\"Yield PCI lines that satisfy all provided predicate functions.\n\n    Example:\n        \u003e\u003e\u003e # Stream Intel (8086) devices matching all specified flags (AND reducer)\n        \u003e\u003e\u003e intel_network_devices \u003d get_pci_devices(\n        ...     has_vendor(\"8086\"),\n        ...     has_flags([\"Ethernet\", \"Controller\"], reducer\u003dall),\n        ... )\n        \u003e\u003e\u003e for device in intel_network_devices:\n        ...     print(device)\n\n        \u003e\u003e\u003e # Stream devices that match either NVIDIA or 3D controller flags (OR reducer)\n        \u003e\u003e\u003e nvidia_or_gpus \u003d get_pci_devices(\n        ...     has_flags([\"NVIDIA\", \"3D controller\"], reducer\u003dany),\n        ... )\n\n        \u003e\u003e\u003e # Stream all PCI devices unconditionally\n        \u003e\u003e\u003e all_devices \u003d get_pci_devices()\n    \"\"\"\n    for pci in lspci_privileged().splitlines():\n        if all(predicate(pci) for predicate in predicates):\n            yield pci\n```","commit_id":"8afcdd8772353241802cdae89bb10eb750a4a5d1"},{"author":{"_account_id":39344,"name":"Gihong Lee","display_name":"gamio","email":"gh9231@gmail.com","username":"gamio"},"change_message_id":"61bf3035197b515b5b38dc2f88acfffae31f790d","unresolved":false,"context_lines":[{"line_number":153,"context_line":""},{"line_number":154,"context_line":""},{"line_number":155,"context_line":"def get_pci_devices(pci_flags, vendor_id\u003dNone, match\u003dany):"},{"line_number":156,"context_line":"    device_for_vendor_out \u003d []"},{"line_number":157,"context_line":"    all_device_out \u003d []"},{"line_number":158,"context_line":"    lspci_out \u003d lspci_privileged().split(\u0027\\n\u0027)"},{"line_number":159,"context_line":"    for pci in lspci_out:"},{"line_number":160,"context_line":"        if match(x in pci for x in pci_flags):"},{"line_number":161,"context_line":"            all_device_out.append(pci)"},{"line_number":162,"context_line":"            if vendor_id and vendor_id in pci:"},{"line_number":163,"context_line":"                device_for_vendor_out.append(pci)"},{"line_number":164,"context_line":"    return device_for_vendor_out if vendor_id else all_device_out"}],"source_content_type":"text/x-python","patch_set":2,"id":"abfa8593_b4127d87","line":164,"range":{"start_line":156,"start_character":0,"end_line":164,"end_character":65},"in_reply_to":"c1012a41_d87d6d4c","updated":"2026-07-28 12:20:50.000000000","message":"Adopted your suggestion. Added `has_flags` and `has_vendor` predicates, and `get_pci_devices` now takes `*predicates` and yields.","commit_id":"8afcdd8772353241802cdae89bb10eb750a4a5d1"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"35cd2c447b7edb60ac75bfcdc3f4b7848b4421d3","unresolved":true,"context_lines":[{"line_number":148,"context_line":""},{"line_number":149,"context_line":""},{"line_number":150,"context_line":"@cyborg.privsep.sys_admin_pctxt.entrypoint"},{"line_number":151,"context_line":"def lspci_privileged(cmd\u003d(\u0027lspci\u0027, \u0027-nn\u0027, \u0027-D\u0027)):"},{"line_number":152,"context_line":"    return processutils.execute(*cmd)[0]"},{"line_number":153,"context_line":""},{"line_number":154,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"64444a90_fa84f750","line":151,"updated":"2026-07-28 16:53:15.000000000","message":"sorry missed this we do not allow privdage function with wid contract liek this\n\ni.e. where you are basiclly just passing any comands to processutils.execute(*cmd)","commit_id":"40fedd89604bc6e31c4d5c615278eea6e2fd2aa0"},{"author":{"_account_id":39344,"name":"Gihong Lee","display_name":"gamio","email":"gh9231@gmail.com","username":"gamio"},"change_message_id":"364a73e43499a1ad5d3a91f302a6c327dcd31ba1","unresolved":false,"context_lines":[{"line_number":148,"context_line":""},{"line_number":149,"context_line":""},{"line_number":150,"context_line":"@cyborg.privsep.sys_admin_pctxt.entrypoint"},{"line_number":151,"context_line":"def lspci_privileged(cmd\u003d(\u0027lspci\u0027, \u0027-nn\u0027, \u0027-D\u0027)):"},{"line_number":152,"context_line":"    return processutils.execute(*cmd)[0]"},{"line_number":153,"context_line":""},{"line_number":154,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"d62d1912_9a921938","line":151,"in_reply_to":"64444a90_fa84f750","updated":"2026-07-29 14:41:19.000000000","message":"`lspci_privileged()` now runs a fixed \u0027lspci -nn -D\u0027 with no command parameter, so nothing arbitrary is passed to execute.","commit_id":"40fedd89604bc6e31c4d5c615278eea6e2fd2aa0"}]}
