From patchwork Tue Jul 5 08:12:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 9213779 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 B74736088F for ; Tue, 5 Jul 2016 08:16:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A863828903 for ; Tue, 5 Jul 2016 08:16:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 95D922894E; Tue, 5 Jul 2016 08:16:29 +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 mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 41B3528903 for ; Tue, 5 Jul 2016 08:16:28 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u658ChLf007060; Tue, 5 Jul 2016 04:12:43 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u658Cgp0023458 for ; Tue, 5 Jul 2016 04:12:42 -0400 Received: from localhost.localdomain (unused [10.10.51.89] (may be forged)) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u658CdBu024633; Tue, 5 Jul 2016 04:12:41 -0400 From: Mike Christie To: dm-devel@redhat.com, christophe.varoqui@opensvc.com Date: Tue, 5 Jul 2016 03:12:30 -0500 Message-Id: <1467706353-16878-2-git-send-email-mchristi@redhat.com> In-Reply-To: <1467706353-16878-1-git-send-email-mchristi@redhat.com> References: <1467706353-16878-1-git-send-email-mchristi@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-loop: dm-devel@redhat.com Cc: Mike Christie Subject: [dm-devel] [PATCH 1/4] multipath-tools: add rbd discovery detection 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: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Virus-Scanned: ClamAV using ClamSMTP rbd is a block device interface for Ceph. It does not support any SCSI commands, so this patch adds bus detection and virtual vendor/product pathinfo. Signed-off-by: Mike Christie --- libmultipath/checkers.h | 1 + libmultipath/discovery.c | 22 ++++++++++++++++++++++ libmultipath/structs.h | 1 + 3 files changed, 24 insertions(+) diff --git a/libmultipath/checkers.h b/libmultipath/checkers.h index a935b3f..ea59c94 100644 --- a/libmultipath/checkers.h +++ b/libmultipath/checkers.h @@ -84,6 +84,7 @@ enum path_check_state { #define EMC_CLARIION "emc_clariion" #define READSECTOR0 "readsector0" #define CCISS_TUR "cciss_tur" +#define RBD "rbd" #define DEFAULT_CHECKER DIRECTIO diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index 126a54f..31bb02d 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -1136,6 +1136,23 @@ scsi_sysfs_pathinfo (struct path * pp) } static int +rbd_sysfs_pathinfo (struct path * pp) +{ + sprintf(pp->vendor_id, "Ceph"); + sprintf(pp->product_id, "RBD"); + + condlog(3, "%s: vendor = %s product = %s", pp->dev, pp->vendor_id, + pp->product_id); + /* + * set the hwe configlet pointer + */ + pp->hwe = find_hwe(conf->hwtable, pp->vendor_id, pp->product_id, NULL); + + /* should we fake host / bus / target / lun so print looks nice */ + return 0; +} + +static int ccw_sysfs_pathinfo (struct path * pp) { struct udev_device *parent; @@ -1337,6 +1354,8 @@ sysfs_pathinfo(struct path * pp) pp->bus = SYSFS_BUS_CCW; if (!strncmp(pp->dev,"sd", 2)) pp->bus = SYSFS_BUS_SCSI; + if (!strncmp(pp->dev,"rbd", 3)) + pp->bus = SYSFS_BUS_RBD; if (pp->bus == SYSFS_BUS_UNDEF) return 0; @@ -1349,6 +1368,9 @@ sysfs_pathinfo(struct path * pp) } else if (pp->bus == SYSFS_BUS_CCISS) { if (cciss_sysfs_pathinfo(pp)) return 1; + } else if (pp->bus == SYSFS_BUS_RBD) { + if (rbd_sysfs_pathinfo(pp)) + return 1; } return 0; } diff --git a/libmultipath/structs.h b/libmultipath/structs.h index ab7dc25..84e56dc 100644 --- a/libmultipath/structs.h +++ b/libmultipath/structs.h @@ -52,6 +52,7 @@ enum sysfs_buses { SYSFS_BUS_IDE, SYSFS_BUS_CCW, SYSFS_BUS_CCISS, + SYSFS_BUS_RBD, }; enum pathstates {