From patchwork Fri Jul 4 06:20:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 4478131 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0BC17BEEAA for ; Fri, 4 Jul 2014 06:25:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 348832025B for ; Fri, 4 Jul 2014 06:25:55 +0000 (UTC) Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com [209.132.183.37]) by mail.kernel.org (Postfix) with ESMTP id 3893F20254 for ; Fri, 4 Jul 2014 06:25:54 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s646KInx030200; Fri, 4 Jul 2014 02:20:18 -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 s646KGtY004913 for ; Fri, 4 Jul 2014 02:20:16 -0400 Received: from mx1.redhat.com (ext-mx12.extmail.prod.ext.phx2.redhat.com [10.5.110.17]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s646KFND009214; Fri, 4 Jul 2014 02:20:15 -0400 Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s646KDQn014454 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=FAIL); Fri, 4 Jul 2014 02:20:14 -0400 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 35921ABE3; Fri, 4 Jul 2014 06:20:13 +0000 (UTC) From: Hannes Reinecke To: Christophe Varoqui Date: Fri, 4 Jul 2014 08:20:11 +0200 Message-Id: <1404454811-21073-1-git-send-email-hare@suse.de> X-RedHat-Spam-Score: -7.31 (BAYES_00, DCC_REPUT_00_12, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.17 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com Subject: [dm-devel] [PATCH] multipath: add option '-i' to ignore wwids file 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-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When called from udev the multipath program is used to check if a device should be handled by multipath. Any new device, however, will not be present in /etc/multipath/wwids, and the check will always fail. This patch implements the option '-i' to multipath to skip checking the wwids file for these scenarios. Signed-off-by: Hannes Reinecke --- libmultipath/config.h | 1 + multipath/main.c | 18 +++++++++++------- multipath/multipath.8 | 5 ++++- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/libmultipath/config.h b/libmultipath/config.h index ac7c58e..ca17f39 100644 --- a/libmultipath/config.h +++ b/libmultipath/config.h @@ -106,6 +106,7 @@ struct config { int max_fds; int force_reload; int queue_without_daemon; + int ignore_wwids; int checker_timeout; int daemon; #ifdef USE_SYSTEMD diff --git a/multipath/main.c b/multipath/main.c index 157475e..fd6262f 100644 --- a/multipath/main.c +++ b/multipath/main.c @@ -84,7 +84,7 @@ usage (char * progname) { fprintf (stderr, VERSION_STRING); fprintf (stderr, "Usage:\n"); - fprintf (stderr, " %s [-a|-c|-w|-W] [-d] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname); + fprintf (stderr, " %s [-a|-c|-w|-W] [-d] [-r] [-i] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname); fprintf (stderr, " %s -l|-ll|-f [-v lvl] [-b fil] [dev]\n", progname); fprintf (stderr, " %s -F [-v lvl]\n", progname); fprintf (stderr, " %s -t\n", progname); @@ -103,6 +103,7 @@ usage (char * progname) " -d dry run, do not create or update devmaps\n" \ " -t dump internal hardware table\n" \ " -r force devmap reload\n" \ + " -i ignore wwids file\n" \ " -B treat the bindings file as read only\n" \ " -p policy failover|multibus|group_by_serial|group_by_prio\n" \ " -b fil bindings file location\n" \ @@ -307,12 +308,12 @@ configure (void) } condlog(3, "scope limited to %s", refwwid); if (conf->cmd == CMD_VALID_PATH) { - if (check_wwids_file(refwwid, 0) == 0){ - printf("%s is a valid multipath device path\n", conf->dev); + if (conf->ignore_wwids || + check_wwids_file(refwwid, 0) == 0) r = 0; - } - else - printf("%s is not a valid multipath device path\n", conf->dev); + + printf("%s %s a valid multipath device path\n", + conf->dev, r == 0 ? "is" : "is not"); goto out; } } @@ -445,7 +446,7 @@ main (int argc, char *argv[]) if (load_config(DEFAULT_CONFIGFILE, udev)) exit(1); - while ((arg = getopt(argc, argv, ":adchl::FfM:v:p:b:BrtqwW")) != EOF ) { + while ((arg = getopt(argc, argv, ":adchl::FfM:v:p:b:BritqwW")) != EOF ) { switch(arg) { case 1: printf("optarg : %s\n",optarg); break; @@ -503,6 +504,9 @@ main (int argc, char *argv[]) case 'r': conf->force_reload = 1; break; + case 'i': + conf->ignore_wwids = 1; + break; case 't': r = dump_config(); goto out_free_config; diff --git a/multipath/multipath.8 b/multipath/multipath.8 index b6479b1..13e2e89 100644 --- a/multipath/multipath.8 +++ b/multipath/multipath.8 @@ -8,7 +8,7 @@ multipath \- Device mapper target autoconfig .RB [\| \-b\ \c .IR bindings_file \|] .RB [\| \-d \|] -.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r | \-a | \-w | \-W \|] +.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r | \|-i | \-a | \-w | \-W \|] .RB [\| \-p\ \c .BR failover | multibus | group_by_serial | group_by_prio | group_by_node_name \|] .RB [\| device \|] @@ -55,6 +55,9 @@ print internal hardware table to stdout .B \-r force devmap reload .TP +.B \-i +ignore wwids file when processing devices +.TP .B \-B treat the bindings file as read only .TP