Blame SOURCES/0022-RH-make-parse_vpd_pg83-match-scsi_id-output.patch

e65fa3
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
e65fa3
From: Benjamin Marzinski <bmarzins@redhat.com>
e65fa3
Date: Thu, 25 Mar 2021 13:05:10 -0500
e65fa3
Subject: [PATCH] RH: make parse_vpd_pg83 match scsi_id output
e65fa3
e65fa3
Red Hat sets ID_SERIAL based on the result of scsi_id, instead of using
e65fa3
the result of sg_inq and 55-scsi-sg3_id.rules. Make parse_vpd_pg83 match
e65fa3
that.
e65fa3
e65fa3
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
e65fa3
---
e65fa3
 libmultipath/discovery.c | 18 ++----------------
e65fa3
 tests/vpd.c              |  6 ++++++
e65fa3
 2 files changed, 8 insertions(+), 16 deletions(-)
e65fa3
e65fa3
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
e65fa3
index f25fe9e3..6fb81c28 100644
e65fa3
--- a/libmultipath/discovery.c
e65fa3
+++ b/libmultipath/discovery.c
e65fa3
@@ -1136,12 +1136,9 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len,
e65fa3
 				naa_prio = 7;
e65fa3
 				break;
e65fa3
 			case 2:
e65fa3
-				/* IEEE Extended: Prio 6 */
e65fa3
-				naa_prio = 6;
e65fa3
-				break;
e65fa3
 			case 3:
e65fa3
-				/* IEEE Locally assigned: Prio 1 */
e65fa3
-				naa_prio = 1;
e65fa3
+				/* IEEE Extended or Locally assigned: Prio 6 */
e65fa3
+				naa_prio = 6;
e65fa3
 				break;
e65fa3
 			default:
e65fa3
 				/* Default: no priority */
e65fa3
@@ -1160,17 +1157,6 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len,
e65fa3
 				vpd = d;
e65fa3
 			}
e65fa3
 			break;
e65fa3
-		case 0x8:
e65fa3
-			/* SCSI Name: Prio 3 */
e65fa3
-			if (memcmp(d + 4, "eui.", 4) &&
e65fa3
-			    memcmp(d + 4, "naa.", 4) &&
e65fa3
-			    memcmp(d + 4, "iqn.", 4))
e65fa3
-				break;
e65fa3
-			if (prio < 3) {
e65fa3
-				prio = 3;
e65fa3
-				vpd = d;
e65fa3
-			}
e65fa3
-			break;
e65fa3
 		case 0x1:
e65fa3
 			/* T-10 Vendor ID: Prio 2 */
e65fa3
 			if (prio < 2) {
e65fa3
diff --git a/tests/vpd.c b/tests/vpd.c
e65fa3
index 8e730d37..7bf7990f 100644
e65fa3
--- a/tests/vpd.c
e65fa3
+++ b/tests/vpd.c
e65fa3
@@ -230,11 +230,13 @@ static const char * const str_prefix[] = {
e65fa3
 	[STR_IQN] = "iqn.",
e65fa3
 };
e65fa3
 
e65fa3
+#if 0
e65fa3
 static const char byte0[] = {
e65fa3
 	[STR_EUI] = '2',
e65fa3
 	[STR_NAA] = '3',
e65fa3
 	[STR_IQN] = '8',
e65fa3
 };
e65fa3
+#endif
e65fa3
 
e65fa3
 /**
e65fa3
  * create_scsi_string_desc() - create a SCSI name string descriptor.
e65fa3
@@ -659,6 +661,7 @@ make_test_vpd_naa(2, 18);
e65fa3
 make_test_vpd_naa(2, 17);
e65fa3
 make_test_vpd_naa(2, 16);
e65fa3
 
e65fa3
+#if 0
e65fa3
 /* SCSI Name string: EUI64, WWID size: 17 */
e65fa3
 make_test_vpd_str(0, 20, 18)
e65fa3
 make_test_vpd_str(0, 20, 17)
e65fa3
@@ -694,6 +697,7 @@ make_test_vpd_str(18, 20, 18)
e65fa3
 make_test_vpd_str(18, 20, 17)
e65fa3
 make_test_vpd_str(18, 20, 16)
e65fa3
 make_test_vpd_str(18, 20, 15)
e65fa3
+#endif
e65fa3
 
e65fa3
 static int test_vpd(void)
e65fa3
 {
e65fa3
@@ -767,6 +771,7 @@ static int test_vpd(void)
e65fa3
 		cmocka_unit_test(test_vpd_naa_2_18),
e65fa3
 		cmocka_unit_test(test_vpd_naa_2_17),
e65fa3
 		cmocka_unit_test(test_vpd_naa_2_16),
e65fa3
+/*
e65fa3
 		cmocka_unit_test(test_vpd_str_0_20_18),
e65fa3
 		cmocka_unit_test(test_vpd_str_0_20_17),
e65fa3
 		cmocka_unit_test(test_vpd_str_0_20_16),
e65fa3
@@ -791,6 +796,7 @@ static int test_vpd(void)
e65fa3
 		cmocka_unit_test(test_vpd_str_18_20_17),
e65fa3
 		cmocka_unit_test(test_vpd_str_18_20_16),
e65fa3
 		cmocka_unit_test(test_vpd_str_18_20_15),
e65fa3
+*/
e65fa3
 	};
e65fa3
 	return cmocka_run_group_tests(tests, setup, teardown);
e65fa3
 }