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 <[email protected]>
---
 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 {
-- 
2.5.5

--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel

Reply via email to