Skip to content

Commit

Permalink
pmdasmart: fix logic error causing nvme-cli check to be ignored
Browse files Browse the repository at this point in the history
The fetch logic for NVME metrics in the SMART PMDA check for
command-not-found on the first invocation (of several) - but
continues to issue the following commands with no checks.  A
fail-fast/short-circuit path is added to prevent this and in
so doing solve a QA failure in qa/1397.
  • Loading branch information
natoscott committed Jun 20, 2023
1 parent 177b3d6 commit 9dce584
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/pmdas/smart/smart_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ nvme_device_refresh_data(const char *name, struct nvme_device_info *nvme_device_
// Make use of redirected stderr to stdout to check if nvme-cli is
// installed and and disable if not
nvmecli_support = 0;
continue;
break;
}

if (strstr(buffer, "Power State")) {
Expand All @@ -726,6 +726,10 @@ nvme_device_refresh_data(const char *name, struct nvme_device_info *nvme_device_
}
pclose(pf);

/* Short-circuit here, only the first invocation checks for nvme-cli */
if (!nvmecli_support)
return 0;

/*
smart.nvme_info.apste_state
*/
Expand Down

0 comments on commit 9dce584

Please sign in to comment.