From af916aa87dff326f65f15398341611b9e5c9087f Mon Sep 17 00:00:00 2001 From: Maram Srimannarayana Murthy Date: Thu, 27 Nov 2025 22:24:49 +0530 Subject: [PATCH 1/5] Updated regex for slot_ibm to include optional -R\d+ segment. This allows matching both standard and extended slot formats: Standard: U50EE.001.WZS00TL-P3-C14 Extended: U50EE.001.WZS00TL-P3-C14-R1 Change ensures compatibility with newer hardware naming conventions that include resource identifiers after the slot number. Backward Compatibility: Existing slot formats without -R remain fully supported. No impact on current parsing logic for standard slot names. Testing Impact: Verified regex against both formats to ensure correct matching. Additional unit tests recommended for extended slot names to prevent regressions. Signed-off-by: Maram Srimannarayana Murthy --- avocado/utils/pci.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/avocado/utils/pci.py b/avocado/utils/pci.py index 60c3eaf8c8..567e2b9d05 100644 --- a/avocado/utils/pci.py +++ b/avocado/utils/pci.py @@ -201,7 +201,7 @@ def get_slot_from_sysfs(full_pci_address): if not os.path.isfile(f"/proc/device-tree/{devspec}/ibm,loc-code"): return None slot = genio.read_file(f"/proc/device-tree/{devspec}/ibm,loc-code") - slot_ibm = re.match(r"((\w+)[.])+(\w+)-[PC(\d+)-]*C(\d+)", slot) + slot_ibm = re.match(r"((\w+)[.])+(\w+)-[PC(\d+)-]*C(\d+)(?:-R\d+)?", slot) if slot_ibm: return slot_ibm.group() slot_openpower = re.match(r"(\w+)[\s]*(\w+)(\d*)", slot) From d55e4400a93afd2972b57608f4fd2c05e2f815de Mon Sep 17 00:00:00 2001 From: Maram Srimannarayana Murthy Date: Tue, 3 Mar 2026 18:19:06 +0530 Subject: [PATCH 2/5] Added example of return slots formats in doc string --- avocado/utils/pci.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/avocado/utils/pci.py b/avocado/utils/pci.py index 567e2b9d05..0da913e10d 100644 --- a/avocado/utils/pci.py +++ b/avocado/utils/pci.py @@ -191,7 +191,8 @@ def get_slot_from_sysfs(full_pci_address): :param full_pci_address: Full PCI address including domain (0000:03:00.0) :return: Removed port related details using re, only returns till - physical slot of the adapter. + physical slot of the adapter + Examples: U78CD.001.FZHAK92-P2-C3, U50EE.001.WZS0011-P3-C20-R1. """ if not os.path.isfile(f"/sys/bus/pci/devices/{full_pci_address}/devspec"): return None From 1a4aa73358a02be09f0eefe89f96dca867092ec3 Mon Sep 17 00:00:00 2001 From: Maram Srimannarayana Murthy Date: Tue, 3 Mar 2026 18:43:48 +0530 Subject: [PATCH 3/5] Updated exmples of physical slot formats and added signature to commit Signed-off-by: Maram Srimannarayana Murthy --- avocado/utils/pci.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/avocado/utils/pci.py b/avocado/utils/pci.py index 0da913e10d..e645010296 100644 --- a/avocado/utils/pci.py +++ b/avocado/utils/pci.py @@ -192,7 +192,8 @@ def get_slot_from_sysfs(full_pci_address): :return: Removed port related details using re, only returns till physical slot of the adapter - Examples: U78CD.001.FZHAK92-P2-C3, U50EE.001.WZS0011-P3-C20-R1. + Examples: U78CD.001.FZHAK92-P2-C3 + U50EE.001.WZS0011-P3-C20-R1 """ if not os.path.isfile(f"/sys/bus/pci/devices/{full_pci_address}/devspec"): return None From 916d4f5d80276162cfdc42e20ffd08c2eee2fa08 Mon Sep 17 00:00:00 2001 From: Maram Srimannarayana Murthy Date: Tue, 3 Mar 2026 18:58:19 +0530 Subject: [PATCH 4/5] Updated exmples of physical slot formats in function description U78CC.001.FZHAK92-P2-C3 which is exisitng format U50EE.001.WZS0011-P3-C20-R1 which is new format We are maitatining both the formats as both formats are required. Both are returning expected output without any issues. Signed-off-by: Maram Srimannarayana Murthy --- avocado/utils/pci.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/avocado/utils/pci.py b/avocado/utils/pci.py index e645010296..71980c5ddc 100644 --- a/avocado/utils/pci.py +++ b/avocado/utils/pci.py @@ -192,8 +192,8 @@ def get_slot_from_sysfs(full_pci_address): :return: Removed port related details using re, only returns till physical slot of the adapter - Examples: U78CD.001.FZHAK92-P2-C3 - U50EE.001.WZS0011-P3-C20-R1 + Examples: U78CC.001.FZHAK92-P2-C3 + U50EE.001.WZS0011-P3-C20-R2 """ if not os.path.isfile(f"/sys/bus/pci/devices/{full_pci_address}/devspec"): return None From f56023079c3c8835238ca33ce8aa8a39e15654d1 Mon Sep 17 00:00:00 2001 From: Maram Srimannarayana Murthy Date: Mon, 27 Apr 2026 23:37:41 +0530 Subject: [PATCH 5/5] docs: Fix Sphinx docstring formatting in get_slot_from_sysfs Fixed 'Unexpected indentation' error in ReadTheDocs build by properly formatting the Examples section in reStructuredText format using double colon (::) and proper indentation. Error was: /home/docs/.../avocado/utils/pci.py:docstring of avocado.utils.pci.get_slot_from_sysfs:10: ERROR: Unexpected indentation. Signed-off-by: Maram Srimannarayana Murthy --- avocado/utils/pci.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/avocado/utils/pci.py b/avocado/utils/pci.py index 71980c5ddc..8bf99ecc88 100644 --- a/avocado/utils/pci.py +++ b/avocado/utils/pci.py @@ -191,9 +191,11 @@ def get_slot_from_sysfs(full_pci_address): :param full_pci_address: Full PCI address including domain (0000:03:00.0) :return: Removed port related details using re, only returns till - physical slot of the adapter - Examples: U78CC.001.FZHAK92-P2-C3 - U50EE.001.WZS0011-P3-C20-R2 + physical slot of the adapter. + Examples:: + + U78CC.001.FZHAK92-P2-C3 + U50EE.001.WZS0011-P3-C20-R2 """ if not os.path.isfile(f"/sys/bus/pci/devices/{full_pci_address}/devspec"): return None