[PATCH v2 20/20] libmultipath/foreign/nvme: fix ouput for "%n" wildcard

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The output for "%n" ("name") is broken: it omits the NSID,
and thus it isn't unique per namespace; and it duplicates the
NQN. Change the format to "$NQN:nsid.$NSID".

Real-world example:
nqn.1992-08.com.netapp:sn.7c6b997ca1f611e8abb200a09890f5bf:subsystem.netapp-nvme-svm-subsystem:nsid.1

Signed-off-by: Martin Wilck <mwilck@xxxxxxxx>
---
 libmultipath/foreign/nvme.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libmultipath/foreign/nvme.c b/libmultipath/foreign/nvme.c
index 838e450e..f0e82937 100644
--- a/libmultipath/foreign/nvme.c
+++ b/libmultipath/foreign/nvme.c
@@ -148,10 +148,11 @@ static int snprint_nvme_map(const struct gen_multipath *gmp,
 		return snprintf(buff, len, "%s",
 				udev_device_get_sysname(nvm->udev));
 	case 'n':
-		return snprintf(buff, len, "%s:NQN:%s",
-				udev_device_get_sysname(nvm->subsys),
+		return snprintf(buff, len, "%s:nsid.%s",
 				udev_device_get_sysattr_value(nvm->subsys,
-							      "subsysnqn"));
+							      "subsysnqn"),
+				udev_device_get_sysattr_value(nvm->udev,
+							      "nsid"));
 	case 'w':
 		return snprintf(buff, len, "%s",
 				udev_device_get_sysattr_value(nvm->udev,
-- 
2.19.2

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel



[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux