Skip to content

Commit 859b61f

Browse files
awz1234igaw
authored andcommitted
plugins/amzn: Handle EC2 local storage controller devices
When nvme_get_nsid() fails for EC2 local storage devices, check if it's a controller device by attempting controller identification. If successful, use NVME_NSID_ALL to get metrics for the controller device. Signed-off-by: Zhen Wang <[email protected]>
1 parent dbd54e2 commit 859b61f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

plugins/amzn/amzn-nvme.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -517,8 +517,14 @@ static int get_stats(int argc, char **argv, struct command *cmd,
517517
if (!strncmp((char *)ctrl.mn, AMZN_NVME_LOCAL_STORAGE_PREFIX,
518518
strlen(AMZN_NVME_LOCAL_STORAGE_PREFIX))) {
519519
if (nvme_get_nsid(dev_fd(dev), &args.nsid) < 0) {
520-
rc = -errno;
521-
goto done;
520+
struct nvme_id_ctrl test_ctrl;
521+
522+
if (nvme_identify_ctrl(dev_fd(dev), &test_ctrl) == 0) {
523+
args.nsid = NVME_NSID_ALL;
524+
} else {
525+
rc = -errno;
526+
goto done;
527+
}
522528
}
523529
args.len = sizeof(log);
524530
} else {

0 commit comments

Comments
 (0)