From patchwork Mon Dec 4 13:13:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guan Junxiong X-Patchwork-Id: 10091141 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A7D4A60329 for ; Mon, 4 Dec 2017 17:08:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E3362880F for ; Mon, 4 Dec 2017 17:08:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 82B0A28D53; Mon, 4 Dec 2017 17:08:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E8D502880F for ; Mon, 4 Dec 2017 17:08:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C0C6661479; Mon, 4 Dec 2017 17:08:07 +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 B6C5265E8A; Mon, 4 Dec 2017 17:08:06 +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 0E7241808872; Mon, 4 Dec 2017 17:08:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vB4H84NS026416 for ; Mon, 4 Dec 2017 12:08:04 -0500 Received: by smtp.corp.redhat.com (Postfix) id D703F7089E; Mon, 4 Dec 2017 17:08:04 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CF2FA7089D for ; Mon, 4 Dec 2017 17:08:02 +0000 (UTC) Received: from huawei.com (unknown [45.249.212.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5580D6A7D0 for ; Mon, 4 Dec 2017 17:08:00 +0000 (UTC) Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id BD9114679DA38; Mon, 4 Dec 2017 21:14:12 +0800 (CST) Received: from huawei.com (10.169.94.217) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.361.1; Mon, 4 Dec 2017 21:14:07 +0800 From: Guan Junxiong To: , Date: Mon, 4 Dec 2017 21:13:57 +0800 Message-ID: <1512393237-18356-1-git-send-email-guanjunxiong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.169.94.217] X-CFilter-Loop: Reflected X-Greylist: Delayed for 03:53:33 by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 04 Dec 2017 17:08:01 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 04 Dec 2017 17:08:01 +0000 (UTC) for IP:'45.249.212.32' DOMAIN:'[45.249.212.32]' HELO:'huawei.com' FROM:'guanjunxiong@huawei.com' RCPT:'' X-RedHat-Spam-Score: 1.272 * (RDNS_NONE, SPF_HELO_PASS, SPF_PASS) 45.249.212.32 [45.249.212.32] 45.249.212.32 [45.249.212.32] X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: dm-devel@redhat.com Cc: guanjunxiong@huawei.com, niuhaoxin@huawei.com, shenhong09@huawei.com Subject: [dm-devel] [PATCH v2] multipath-tools: output more topology info for NVMe discovery X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 04 Dec 2017 17:08:08 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP From: Jie Yang Assign sg_id.channel to controller id of the NVMe/NVMf target and assign sg_id.lun to namespace ID of the target. Signed-off-by: Jie Yang Reviewed-by: Guan Junxiong --- 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(-) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index cadf461..4b31dde 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -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"));