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

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