From nobody Mon May 6 02:11:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1547822592681600.7167061914255; Fri, 18 Jan 2019 06:43:12 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AB14287645; Fri, 18 Jan 2019 14:43:10 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6B91060851; Fri, 18 Jan 2019 14:43:10 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 10C793F7D0; Fri, 18 Jan 2019 14:43:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0IEgiZn030447 for ; Fri, 18 Jan 2019 09:42:44 -0500 Received: by smtp.corp.redhat.com (Postfix) id 478421048115; Fri, 18 Jan 2019 14:42:44 +0000 (UTC) Received: from unknown0050b6a41c42.attlocal.net.com (ovpn-116-100.phx2.redhat.com [10.3.116.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id F38331019627 for ; Fri, 18 Jan 2019 14:42:43 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Fri, 18 Jan 2019 09:42:34 -0500 Message-Id: <20190118144237.4434-2-jferlan@redhat.com> In-Reply-To: <20190118144237.4434-1-jferlan@redhat.com> References: <20190118144237.4434-1-jferlan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 1/4] util: Modify virStorageFileGetSCSIKey return X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 18 Jan 2019 14:43:11 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Alter the "real" code to return -2 on virCommandRun failure. Alter the comments and function header to describe the function and it's returns. Signed-off-by: John Ferlan Reviewed-by: J=C3=A1n Tomko --- src/util/virstoragefile.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index bd4b0274df..2511511d14 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -1425,9 +1425,24 @@ int virStorageFileGetLVMKey(const char *path, } #endif =20 + #ifdef WITH_UDEV -int virStorageFileGetSCSIKey(const char *path, - char **key) +/* virStorageFileGetSCSIKey + * @path: Path to the SCSI device + * @key: Unique key to be returned + * + * Using a udev specific function, query the @path to get and return a + * unique @key for the caller to use. + * + * Returns: + * 0 On success, with the @key filled in or @key=3DNULL if the + * returned string was empty. + * -1 When WITH_UDEV is undefined and a system error is reported + * -2 When WITH_UDEV is defined, but calling virCommandRun fails + */ +int +virStorageFileGetSCSIKey(const char *path, + char **key) { int status; virCommandPtr cmd =3D virCommandNewArgList("/lib/udev/scsi_id", @@ -1436,7 +1451,7 @@ int virStorageFileGetSCSIKey(const char *path, "--device", path, NULL ); - int ret =3D -1; + int ret =3D -2; =20 *key =3D NULL; =20 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 02:11:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1547822571719199.49830207068862; Fri, 18 Jan 2019 06:42:51 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5B571C0587EC; Fri, 18 Jan 2019 14:42:49 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BE63D1048115; Fri, 18 Jan 2019 14:42:48 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2BC591803395; Fri, 18 Jan 2019 14:42:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0IEgiin030453 for ; Fri, 18 Jan 2019 09:42:44 -0500 Received: by smtp.corp.redhat.com (Postfix) id BADB21048115; Fri, 18 Jan 2019 14:42:44 +0000 (UTC) Received: from unknown0050b6a41c42.attlocal.net.com (ovpn-116-100.phx2.redhat.com [10.3.116.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 740171019627 for ; Fri, 18 Jan 2019 14:42:44 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Fri, 18 Jan 2019 09:42:35 -0500 Message-Id: <20190118144237.4434-3-jferlan@redhat.com> In-Reply-To: <20190118144237.4434-1-jferlan@redhat.com> References: <20190118144237.4434-1-jferlan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 2/4] storage: Rework virStorageBackendSCSISerial X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 18 Jan 2019 14:42:50 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Alter the code to use the virStorageFileGetSCSIKey helper to fetch the unique key for the SCSI disk. Alter the logic to follow the former code which would return a duplicate of @dev when either the virCommandRun succeeded, but returned an empty string or when WITH_UDEV was not true. Signed-off-by: John Ferlan Reviewed-by: J=C3=A1n Tomko --- src/storage/storage_util.c | 34 ++++++++-------------------------- 1 file changed, 8 insertions(+), 26 deletions(-) diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index a84ee5b600..aa1af434de 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -3758,36 +3758,18 @@ virStorageBackendRefreshLocal(virStoragePoolObjPtr = pool) static char * virStorageBackendSCSISerial(const char *dev) { + int rc; char *serial =3D NULL; -#ifdef WITH_UDEV - virCommandPtr cmd =3D virCommandNewArgList( - "/lib/udev/scsi_id", - "--replace-whitespace", - "--whitelisted", - "--device", dev, - NULL - ); - - /* Run the program and capture its output */ - virCommandSetOutputBuffer(cmd, &serial); - if (virCommandRun(cmd, NULL) < 0) - goto cleanup; -#endif =20 - if (serial && STRNEQ(serial, "")) { - char *nl =3D strchr(serial, '\n'); - if (nl) - *nl =3D '\0'; - } else { - VIR_FREE(serial); - ignore_value(VIR_STRDUP(serial, dev)); - } + rc =3D virStorageFileGetSCSIKey(dev, &serial); + if (rc =3D=3D 0 && serial) + return serial; =20 -#ifdef WITH_UDEV - cleanup: - virCommandFree(cmd); -#endif + if (rc =3D=3D -2) + return NULL; =20 + virResetLastError(); + ignore_value(VIR_STRDUP(serial, dev)); return serial; } =20 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 02:11:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1547822613374493.9522792070803; Fri, 18 Jan 2019 06:43:33 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 16FA881129; Fri, 18 Jan 2019 14:43:31 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C6134608C4; Fri, 18 Jan 2019 14:43:30 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 748413F7D5; Fri, 18 Jan 2019 14:43:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0IEgjxr030461 for ; Fri, 18 Jan 2019 09:42:45 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3D02B104810E; Fri, 18 Jan 2019 14:42:45 +0000 (UTC) Received: from unknown0050b6a41c42.attlocal.net.com (ovpn-116-100.phx2.redhat.com [10.3.116.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id E99BE1019627 for ; Fri, 18 Jan 2019 14:42:44 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Fri, 18 Jan 2019 09:42:36 -0500 Message-Id: <20190118144237.4434-4-jferlan@redhat.com> In-Reply-To: <20190118144237.4434-1-jferlan@redhat.com> References: <20190118144237.4434-1-jferlan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 3/4] util: Introduce virStorageFileGetNPIVKey X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 18 Jan 2019 14:43:32 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The vHBA/NPIV LUNs created via the udev processing of the VPORT_CREATE command end up using the same serial value as seen/generated by the /lib/udev/scsi_id as returned during virStorageFileGetSCSIKey. Therefore, in order to generate a unique enough key to be used when adding the LUN as a volume during virStoragePoolObjAddVol a more unique key needs to be generated for an NPIV volume. The problem is illustrated by the following example, where scsi_host5 is a vHBA used with the following LUNs: $ lsscsi -tg ... [5:0:4:0] disk fc:0x5006016844602198,0x101f00 /dev/sdh /dev/sg23 [5:0:5:0] disk fc:0x5006016044602198,0x102000 /dev/sdi /dev/sg24 ... Calling virStorageFileGetSCSIKey would return: /lib/udev/scsi_id --device /dev/sdh --whitelisted --replace-whitespace /dev= /sdh 350060160c460219850060160c4602198 /lib/udev/scsi_id --device /dev/sdh --whitelisted --replace-whitespace /dev= /sdi 350060160c460219850060160c4602198 Note that althrough /dev/sdh and /dev/sdi are separate LUNs, they end up with the same serial number used for the vol->key value. When virStoragePoolFCRefreshThread calls virStoragePoolObjAddVol the second LUN fails to be added with the following message getting logged: virHashAddOrUpdateEntry:341 : internal error: Duplicate key To resolve this, virStorageFileGetNPIVKey will use a similar call sequence as virStorageFileGetSCSIKey, except that it will add the "--export" option to the call. This results in more detailed output which needs to be parsed in order to formulate a unique enough key to be used. In order to be unique enough, the returned value will concatenate the target port as returned in the "ID_TARGET_PORT" field from the command to the "ID_SERIAL" value. Signed-off-by: John Ferlan Reviewed-by: J=C3=A1n Tomko --- src/libvirt_private.syms | 1 + src/util/virstoragefile.c | 80 +++++++++++++++++++++++++++++++++++++++ src/util/virstoragefile.h | 2 + 3 files changed, 83 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index c3d6306809..bdc2877a9f 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2861,6 +2861,7 @@ virStorageFileGetMetadata; virStorageFileGetMetadataFromBuf; virStorageFileGetMetadataFromFD; virStorageFileGetMetadataInternal; +virStorageFileGetNPIVKey; virStorageFileGetRelativeBackingPath; virStorageFileGetSCSIKey; virStorageFileGetUniqueIdentifier; diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 2511511d14..759d0625b6 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -1490,6 +1490,86 @@ int virStorageFileGetSCSIKey(const char *path, #endif =20 =20 +#ifdef WITH_UDEV +/* virStorageFileGetNPIVKey + * @path: Path to the NPIV device + * @key: Unique key to be returned + * + * Using a udev specific function, query the @path to get and return a + * unique @key for the caller to use. Unlike the GetSCSIKey method, an + * NPIV LUN is uniquely identified by it's ID_TARGET_PORT value. + * + * Returns: + * 0 On success, with the @key filled in or @key=3DNULL if the + * returned output string didn't have the data we need to + * formulate a unique key value + * -1 When WITH_UDEV is undefined and a system error is reported + * -2 When WITH_UDEV is defined, but calling virCommandRun fails + */ +int +virStorageFileGetNPIVKey(const char *path, + char **key) +{ + int status; + VIR_AUTOFREE(char *) outbuf =3D NULL; + const char *serial; + const char *port; + virCommandPtr cmd =3D virCommandNewArgList("/lib/udev/scsi_id", + "--replace-whitespace", + "--whitelisted", + "--export", + "--device", path, + NULL + ); + int ret =3D -2; + + *key =3D NULL; + + /* Run the program and capture its output */ + virCommandSetOutputBuffer(cmd, &outbuf); + if (virCommandRun(cmd, &status) < 0) + goto cleanup; + + /* Explicitly check status =3D=3D 0, rather than passing NULL + * to virCommandRun because we don't want to raise an actual + * error in this scenario, just return a NULL key. + */ + if (status =3D=3D 0 && *outbuf && + (serial =3D strstr(outbuf, "ID_SERIAL=3D")) && + (port =3D strstr(outbuf, "ID_TARGET_PORT=3D"))) { + char *serial_eq =3D strchr(serial, '=3D'); + char *serial_nl =3D strchr(serial, '\n'); + char *port_eq =3D strchr(port, '=3D'); + char *port_nl =3D strchr(port, '\n'); + + if (serial_eq) + serial =3D serial_eq + 1; + if (serial_nl) + *serial_nl =3D '\0'; + if (port_eq) + port =3D port_eq + 1; + if (port_nl) + *port_nl =3D '\0'; + + ignore_value(virAsprintf(key, "%s_PORT%s", serial, port)); + } + + ret =3D 0; + + cleanup: + virCommandFree(cmd); + + return ret; +} +#else +int virStorageFileGetNPIVKey(const char *path, + char **key ATTRIBUTE_UNUSED) +{ + virReportSystemError(ENOSYS, _("Unable to get NPIV key for %s"), path); + return -1; +} +#endif + /** * virStorageFileParseBackingStoreStr: * @str: backing store specifier string to parse diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index 1d6161a2c7..bc94bae676 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -391,6 +391,8 @@ int virStorageFileGetLVMKey(const char *path, char **key); int virStorageFileGetSCSIKey(const char *path, char **key); +int virStorageFileGetNPIVKey(const char *path, + char **key); =20 void virStorageAuthDefFree(virStorageAuthDefPtr def); virStorageAuthDefPtr virStorageAuthDefCopy(const virStorageAuthDef *src); --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 02:11:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1547822591226235.0794353821217; Fri, 18 Jan 2019 06:43:11 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5EE59C0528BD; Fri, 18 Jan 2019 14:43:09 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 27AB5104810E; Fri, 18 Jan 2019 14:43:09 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C4E66180339A; Fri, 18 Jan 2019 14:43:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0IEgj6h030468 for ; Fri, 18 Jan 2019 09:42:45 -0500 Received: by smtp.corp.redhat.com (Postfix) id B086D104810E; Fri, 18 Jan 2019 14:42:45 +0000 (UTC) Received: from unknown0050b6a41c42.attlocal.net.com (ovpn-116-100.phx2.redhat.com [10.3.116.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6AEE71019627 for ; Fri, 18 Jan 2019 14:42:45 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Fri, 18 Jan 2019 09:42:37 -0500 Message-Id: <20190118144237.4434-5-jferlan@redhat.com> In-Reply-To: <20190118144237.4434-1-jferlan@redhat.com> References: <20190118144237.4434-1-jferlan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 4/4] storage: Fetch a unique key for vHBA/NPIV LUNs X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 18 Jan 2019 14:43:10 +0000 (UTC) Content-Type: text/plain; charset="utf-8" https://bugzilla.redhat.com/show_bug.cgi?id=3D1657468 Commit be1bb6c95 changed the way volumes were stored from a forward linked list to a hash table. In doing so, it required that each vol object would have 3 unique values as keys into tables - key, name, and path. Due to how vHBA/NPIV LUNs are created/used this resulted in a failure to utilize all the LUN's found during processing. During virStorageBackendSCSINewLun processing fetch the key (or serial value) for NPIV LUN's using virStorageFileGetNPIVKey which will formulate a more unique key based on the serial value and the port for the LUN. Signed-off-by: John Ferlan Reviewed-by: J=C3=A1n Tomko --- src/storage/storage_util.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index aa1af434de..089eca01bf 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -3756,12 +3756,16 @@ virStorageBackendRefreshLocal(virStoragePoolObjPtr = pool) =20 =20 static char * -virStorageBackendSCSISerial(const char *dev) +virStorageBackendSCSISerial(const char *dev, + bool isNPIV) { int rc; char *serial =3D NULL; =20 - rc =3D virStorageFileGetSCSIKey(dev, &serial); + if (isNPIV) + rc =3D virStorageFileGetNPIVKey(dev, &serial); + else + rc =3D virStorageFileGetSCSIKey(dev, &serial); if (rc =3D=3D 0 && serial) return serial; =20 @@ -3859,7 +3863,10 @@ virStorageBackendSCSINewLun(virStoragePoolObjPtr poo= l, VIR_STORAGE_VOL_READ_NOER= ROR)) < 0) goto cleanup; =20 - if (!(vol->key =3D virStorageBackendSCSISerial(vol->target.path))) + vol->key =3D virStorageBackendSCSISerial(vol->target.path, + (def->source.adapter.type =3D= =3D + VIR_STORAGE_ADAPTER_TYPE_FC_HO= ST)); + if (!vol->key) goto cleanup; =20 def->capacity +=3D vol->target.capacity; --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list