Fix incorrect string formatting for PCIe device name #647
+1
−1
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)