Skip to contentSkip to conversation

multipath-tools: output more topology info for NVMe discovery

PATCH In review Guan Junxiong 2 participants 2 messages Dec 4, 2017 – Jan 13, 2018 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 multipath-tools: output more topology info for NVMe discovery

From: Jie Yang <[email protected]>

Assign sg_id.channel to controller id of the NVMe/NVMf target and assign sg_id.lun to namespace ID of the target.

---

change since V1:
patch 2/2 --> path V2 becuase this is an independent patch

 libmultipath/discovery.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
libmultipath/discovery.c +3 -1
index cadf461..4b31dde 100644
@@ -1206,12 +1206,14 @@ nvme_sysfs_pathinfo (struct path * pp, vector hwtable)
 		   &pp->sg_id.scsi_id) != 2)
 		return 1;
 	pp->sg_id.channel = 0;
-	pp->sg_id.lun = 0;
+	pp->sg_id.lun = atoi(udev_device_get_sysattr_value(pp->udev, "nsid"));
 
 	parent = udev_device_get_parent(pp->udev);
 	if (!parent)
 		return 1;
 
+	pp->sg_id.channel = atoi(udev_device_get_sysattr_value(parent, "cntlid"));
+
 	snprintf(pp->vendor_id, SCSI_VENDOR_SIZE, "NVME");
 	snprintf(pp->product_id, SCSI_PRODUCT_SIZE, "%s",
 		 udev_device_get_sysattr_value(parent, "model"));
Signature · 1 line
2.6.4.windows.1
#1 lore raw

Merged.
Thanks.

Quoted 45 lines · Guan Junxiong

From: Jie Yang <[email protected]>

Assign sg_id.channel to controller id of the NVMe/NVMf target and assign sg_id.lun to namespace ID of the target.

---

change since V1:
patch 2/2 --> path V2 becuase this is an independent patch

 libmultipath/discovery.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
libmultipath/discovery.c +3 -1
index cadf461..4b31dde 100644
@@ -1206,12 +1206,14 @@ nvme_sysfs_pathinfo (struct path * pp, vector
 hwtable)
                   &pp->sg_id.scsi_id) != 2)
                return 1;
        pp->sg_id.channel = 0;
-       pp->sg_id.lun = 0;
+       pp->sg_id.lun = atoi(udev_device_get_sysattr_value(pp->udev,
 "nsid"));
 
        parent = udev_device_get_parent(pp->udev);
        if (!parent)
                return 1;
 
+       pp->sg_id.channel = atoi(udev_device_get_sysattr_value(parent,
 "cntlid"));
+
        snprintf(pp->vendor_id, SCSI_VENDOR_SIZE, "NVME");
        snprintf(pp->product_id, SCSI_PRODUCT_SIZE, "%s",
                 udev_device_get_sysattr_value(parent, "model"));

--
2.6.4.windows.1