Commit a913484
committed
Managing NVMe subsystem I/O policies in Linux:
1. get_nvme_subsystem_io_policy(subsystem): This function reads the
current I/O policy for a specified NVMe subsystem from the
/sys/class/nvme-subsystem/<subsystem>/iopolicy file and returns it
as a string. It uses the process.run() function to execute the
cat command with sudo privileges and ignores the command's status.
2. change_nvme_subsystem_io_policy(subsystem, io_policy):
This function changes the I/O policy of an NVMe subsystem to the
specified policy. It first checks if the current policy matches the
desired policy and returns True if they are the same. If not,
it executes the echo command to set the new policy. The function
raises a NvmeException if the command fails and returns True
if the policy was changed successfully.
Both functions use the process.run() function from the process module
to execute shell commands with sudo privileges and ignore their status.
The get_nvme_subsystem_io_policy() function does not take any action
if the current policy matches the desired policy, while the
change_nvme_subsystem_io_policy() function raises an exception or
returns True based on the outcome of the policy change.
Signed-off-by: Maram Srimannarayana Murthy <[email protected]>1 parent 10f12f0 commit a913484
1 file changed
+38
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
529 | 529 | | |
530 | 530 | | |
531 | 531 | | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
0 commit comments