From patchwork Fri Sep 3 03:46:13 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: bmarzins@sourceware.org X-Patchwork-Id: 152061 Received: from mx01.colomx.prod.int.phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o833n74Z016345 for ; Fri, 3 Sep 2010 03:49:42 GMT Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx01.colomx.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o833kUC2024647; Thu, 2 Sep 2010 23:46:34 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o833kSr0009883 for ; Thu, 2 Sep 2010 23:46:28 -0400 Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.10]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o833kNw4018160 for ; Thu, 2 Sep 2010 23:46:23 -0400 Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by mx1.redhat.com (8.13.8/8.13.8) with SMTP id o833kDcB021178 for ; Thu, 2 Sep 2010 23:46:13 -0400 Received: (qmail 9344 invoked by uid 9475); 3 Sep 2010 03:46:13 -0000 Date: 3 Sep 2010 03:46:13 -0000 Message-ID: <20100903034613.9341.qmail@sourceware.org> From: bmarzins@sourceware.org To: dm-cvs@sourceware.org, dm-devel@redhat.com X-RedHat-Spam-Score: -2.31 (RCVD_IN_DNSWL_MED,T_RP_MATCHES_RCVD) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 X-Scanned-By: MIMEDefang 2.67 on 10.5.110.10 X-loop: dm-devel@redhat.com Subject: [dm-devel] multipath-tools ./multipath.conf.defaults libm ... X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development 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-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Fri, 03 Sep 2010 03:49:43 +0000 (UTC) --- multipath-tools/multipath.conf.defaults 2010/08/24 21:51:10 1.5.4.23 +++ multipath-tools/multipath.conf.defaults 2010/09/03 03:46:11 1.5.4.24 @@ -150,6 +150,19 @@ # path_checker tur # } # device { +# vendor "HP" +# product "LOGICAL VOLUME.*" +# getuid_callout "/sbin/cciss_id /dev/%n" +# features "0" +# hardware_handler "0" +# path_grouping_policy multibus +# failback immediate +# rr_weight uniform +# no_path_retry 12 +# rr_min_io 1000 +# path_checker cciss_tur +# } +# device { # vendor "DDN" # product "SAN DataDirector" # getuid_callout "/sbin/scsi_id -g -u -s /block/%n" --- multipath-tools/libmultipath/discovery.c 2010/08/11 23:05:50 1.32.2.15 +++ multipath-tools/libmultipath/discovery.c 2010/09/03 03:46:12 1.32.2.16 @@ -250,8 +250,10 @@ declare_sysfs_get_str(model, "%s/block/%s/device/model", 1); declare_sysfs_get_str(rev, "%s/block/%s/device/rev", 1); declare_sysfs_get_str(dev, "%s/block/%s/dev", 1); -declare_sysfs_get_str(bustype, "%s/block/%s/device/bus", 1); declare_sysfs_get_str(state, "%s/block/%s/device/state", 0); +declare_sysfs_get_str(cciss_vendor, "%s/block/%s/vendor", 1); +declare_sysfs_get_str(cciss_model, "%s/block/%s/model", 1); +declare_sysfs_get_str(cciss_rev, "%s/block/%s/rev", 1); int sysfs_get_timeout (char * sysfs_path, char * dev, unsigned int *timeout) @@ -475,6 +477,24 @@ } static int +sysfs_get_driver (char *sysfs_path, char * dev, char *driver) +{ + char path[FILE_NAME_SIZE]; + char buff[SYSFS_NAME_LEN]; + + if (safe_sprintf(path, "%s/block/%s/device/driver", sysfs_path, dev)) { + condlog(0, "driver path too small"); + return 1; + } + if (sysfs_get_link(path, buff, SYSFS_NAME_LEN) < 0) { + condlog(0, "can't get driver link: %s", strerror(errno)); + return 1; + } + basename(buff, driver); + return 0; +} + +static int sysfs_get_bus (char * sysfs_path, struct path * pp) { struct sysfs_device *sdev; @@ -517,8 +537,8 @@ while (loop--) { sdev = sysfs_open_device_path(attr_buff); if(!strncmp(pp->dev,"cciss",5)) - sysfs_get_bustype(sysfs_path,pp->dev, - sdev->bus,5); + sysfs_get_driver(sysfs_path, pp->dev, + sdev->bus); if (strlen(sdev->bus)) break; @@ -529,8 +549,8 @@ #else sdev = sysfs_open_device_path(attr_buff); if(!strncmp(pp->dev,"cciss",5)) - sysfs_get_bustype(sysfs_path, pp->dev, - sdev->bus,5); + sysfs_get_driver(sysfs_path, pp->dev, + sdev->bus); #endif if (!strncmp(sdev->bus, "scsi", 4)) @@ -692,20 +712,33 @@ static int cciss_sysfs_pathinfo (struct path * curpath) { + unsigned int controller, lun; + char dev_path[FILE_NAME_SIZE]; + + if (sscanf(curpath->dev, "cciss!c%ud%u", &controller, &lun) != 2) { + condlog(0, "invalid cciss device name : '%s'", curpath->dev); + return 1; + } + + if(safe_sprintf(dev_path, "%s/device/cciss%u/c%ud%u", curpath->dev, + controller, controller, lun)) { + condlog(0, "dev_path too small"); + return 1; + } - if (sysfs_get_vendor(sysfs_path, curpath->dev, + if (sysfs_get_cciss_vendor(sysfs_path, dev_path, curpath->vendor_id, SCSI_VENDOR_SIZE)) return 1; condlog(3, "vendor = %s", curpath->vendor_id); - if (sysfs_get_model(sysfs_path, curpath->dev, + if (sysfs_get_cciss_model(sysfs_path, dev_path, curpath->product_id, SCSI_PRODUCT_SIZE)) return 1; condlog(3, "product = %s", curpath->product_id); - if (sysfs_get_rev(sysfs_path, curpath->dev, + if (sysfs_get_cciss_rev(sysfs_path, dev_path, curpath->rev, SCSI_REV_SIZE)) return 1; --- multipath-tools/libmultipath/discovery.h 2010/06/23 16:28:07 1.14.2.4 +++ multipath-tools/libmultipath/discovery.h 2010/09/03 03:46:12 1.14.2.5 @@ -30,7 +30,6 @@ int sysfs_get_model (char * sysfs_path, char * dev, char * buff, int len); int sysfs_get_rev (char * sysfs_path, char * dev, char * buff, int len); int sysfs_get_dev (char * sysfs_path, char * dev, char * buff, int len); -int sysfs_get_bustype (char * sysfs_path, char * dev, char * buff, int len); int sysfs_get_state (char * sysfs_path, char * dev, char * buff, int len); int sysfs_get_size (char * sysfs_path, char * dev, unsigned long long *); int sysfs_get_timeout (char * sysfs_path, char * dev, unsigned int *timeout); --- multipath-tools/libmultipath/hwtable.c 2010/08/24 21:51:10 1.20.2.30 +++ multipath-tools/libmultipath/hwtable.c 2010/09/03 03:46:12 1.20.2.31 @@ -185,6 +185,22 @@ .minio = DEFAULT_MINIO, .checker_name = READSECTOR0, }, + { + /* HP Smart Array */ + .vendor = "HP", + .product = "LOGICAL VOLUME.*", + .getuid = "/sbin/cciss_id /dev/%n", + .getprio = NULL, + .features = DEFAULT_FEATURES, + .hwhandler = DEFAULT_HWHANDLER, + .selector = DEFAULT_SELECTOR, + .pgpolicy = MULTIBUS, + .pgfailback = FAILBACK_UNDEF, + .rr_weight = RR_WEIGHT_NONE, + .no_path_retry = 12, + .minio = DEFAULT_MINIO, + .checker_name = CCISS_TUR, + }, /* * DDN controller family *