-
Notifications
You must be signed in to change notification settings - Fork 185
[action] [PR:647] Fix incorrect string formatting for PCIe device name #648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Provide a general summary of your changes in the Title above --> #### Description <!-- Describe your changes in detail --> The pcie_dev string was incorrectly using an f-string-style format without the f prefix or .format() usage, resulting in the placeholder being treated as a literal string. As a result, the PCIe device name was not being correctly computed and logged, which affects DPU detach warnings and related debugging. #### Motivation and Context <!-- Why is this change required? What problem does it solve? If this pull request closes/resolves an open Issue, make sure you include the text "fixes #xxxx", "closes #xxxx" or "resolves #xxxx" here --> PCIe device name not logged correctly during DPU detachment scenarios. This change fixes the formatting using the str.format() method, ensuring the PCIe device address is constructed accurately. As a result, the correct device name will now appear in logs, aiding in proper debugging and tracking. #### How Has This Been Tested? <!-- Please describe in detail how you tested your changes. Include details of your testing environment, and the tests you ran to see how your change affects other areas of the code, etc. --> Tested and verified in my local testbed tests/test_DaemonPcied.py::TestDaemonPcied::test_check_pcie_devices_detaching PASSED Also, to manually simulate a pass scenario and verify correct PCIe device name logging, I temporarily moved the `pcie_dev` variable declaration into the `else` block (where `result["result"] != "Failed"`) and added a log statement there. This allowed me to observe the formatted device string during normal (non-failure) conditions. After making the changes, I restarted the `pcied` process using `supervisorctl restart pcied` and inspected the logs. Logs Before Fix : ``` 2025 Jul 19 07:51:58.815665 VM0100 WARNING pmon#pcied[24]: PCIe Device: 0000:{int(result['bus'], 16):02x}:{int(result['dev'], 16):02x}.{int(result['fn'], 16)} is in detaching mode, skipping warning. ``` Logs After Fix : ``` 2025 Jul 19 10:01:03.399852 VM0100 WARNING pmon#pcied[24]: PCIe Device: 0000:00:00.0 is in detaching mode, skipping warning. 2025 Jul 19 10:01:03.401242 VM0100 WARNING pmon#pcied[24]: PCIe Device: 0000:00:01.0 is in detaching mode, skipping warning. 2025 Jul 19 10:01:03.402128 VM0100 WARNING pmon#pcied[24]: PCIe Device: 0000:00:01.1 is in detaching mode, skipping warning. 2025 Jul 19 10:01:03.402868 VM0100 WARNING pmon#pcied[24]: PCIe Device: 0000:00:01.2 is in detaching mode, skipping warning. 2025 Jul 19 10:01:03.405879 VM0100 WARNING pmon#pcied[24]: PCIe Device: 0000:00:01.3 is in detaching mode, skipping warning. 2025 Jul 19 10:01:03.407156 VM0100 WARNING pmon#pcied[24]: PCIe Device: 0000:00:01.4 is in detaching mode, skipping warning. 2025 Jul 19 10:01:03.407883 VM0100 WARNING pmon#pcied[24]: PCIe Device: 0000:00:01.5 is in detaching mode, skipping warning. 2025 Jul 19 10:01:03.408606 VM0100 WARNING pmon#pcied[24]: PCIe Device: 0000:00:01.6 is in detaching mode, skipping warning. 2025 Jul 19 10:01:03.409271 VM0100 WARNING pmon#pcied[24]: PCIe Device: 0000:00:01.7 is in detaching mode, skipping warning. 2025 Jul 19 10:01:03.410031 VM0100 WARNING pmon#pcied[24]: PCIe Device: 0000:00:02.0 is in detaching mode, skipping warning. 2025 Jul 19 10:01:03.410746 VM0100 WARNING pmon#pcied[24]: PCIe Device: 0000:00:04.0 is in detaching mode, skipping warning. 2025 Jul 19 10:01:03.411066 VM0100 WARNING pmon#pcied[24]: PCIe Device: 0000:00:1f.0 is in detaching mode, skipping warning. 2025 Jul 19 10:01:03.411395 VM0100 WARNING pmon#pcied[24]: PCIe Device: 0000:00:1f.2 is in detaching mode, skipping warning. 2025 Jul 19 10:01:03.411697 VM0100 WARNING pmon#pcied[24]: PCIe Device: 0000:00:1f.3 is in detaching mode, skipping warning. 2025 Jul 19 10:01:03.411982 VM0100 WARNING pmon#pcied[24]: PCIe Device: 0000:01:00.0 is in detaching mode, skipping warning. 2025 Jul 19 10:01:03.412671 VM0100 WARNING pmon#pcied[24]: PCIe Device: 0000:02:01.0 is in detaching mode, skipping warning. 2025 Jul 19 10:01:03.412980 VM0100 WARNING pmon#pcied[24]: PCIe Device: 0000:02:02.0 is in detaching mode, skipping warning. 2025 Jul 19 10:01:03.413283 VM0100 WARNING pmon#pcied[24]: PCIe Device: 0000:03:00.0 is in detaching mode, skipping warning. 2025 Jul 19 10:01:03.413671 VM0100 WARNING pmon#pcied[24]: PCIe Device: 0000:04:00.0 is in detaching mode, skipping warning. 2025 Jul 19 10:01:03.414050 VM0100 WARNING pmon#pcied[24]: PCIe Device: 0000:05:00.0 is in detaching mode, skipping warning. 2025 Jul 19 10:01:03.414386 VM0100 WARNING pmon#pcied[24]: PCIe Device: 0000:06:00.0 is in detaching mode, skipping warning. 2025 Jul 19 10:01:03.414679 VM0100 WARNING pmon#pcied[24]: PCIe Device: 0000:07:00.0 is in detaching mode, skipping warning. 2025 Jul 19 10:01:03.414962 VM0100 WARNING pmon#pcied[24]: PCIe Device: 0000:08:00.0 is in detaching mode, skipping warning. 2025 Jul 19 10:01:03.415338 VM0100 WARNING pmon#pcied[24]: PCIe Device: 0000:09:00.0 is in detaching mode, skipping warning. ``` #### Additional Information (Optional)
Original PR: #647 |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The pcie_dev string was incorrectly using an f-string-style format without the f prefix or .format() usage, resulting in the placeholder being treated as a literal string. As a result, the PCIe device name was not being correctly computed and logged, which affects DPU detach warnings and related debugging.
Motivation and Context
PCIe device name not logged correctly during DPU detachment scenarios. This change fixes the formatting using the str.format() method, ensuring the PCIe device address is constructed accurately. As a result, the correct device name will now appear in logs, aiding in proper debugging and tracking.
How Has This Been Tested?
Tested and verified in my local testbed
tests/test_DaemonPcied.py::TestDaemonPcied::test_check_pcie_devices_detaching PASSED
Also, to manually simulate a pass scenario and verify correct PCIe device name logging, I temporarily moved the
pcie_dev
variable declaration into theelse
block (whereresult["result"] != "Failed"
) and added a log statement there. This allowed me to observe the formatted device string during normal (non-failure) conditions.After making the changes, I restarted the
pcied
process usingsupervisorctl restart pcied
and inspected the logs.Logs Before Fix :
Logs After Fix :
Additional Information (Optional)