From patchwork Thu Jan 17 14:59:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 1996821 Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by patchwork2.kernel.org (Postfix) with ESMTP id 39DA3DF2E1 for ; Thu, 17 Jan 2013 15:02:43 +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 r0HExcLI013851; Thu, 17 Jan 2013 09:59:40 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r0HExbAr003510 for ; Thu, 17 Jan 2013 09:59:37 -0500 Received: from mx1.redhat.com (ext-mx11.extmail.prod.ext.phx2.redhat.com [10.5.110.16]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r0HExbNp029675 for ; Thu, 17 Jan 2013 09:59:37 -0500 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 r0HExa7L031037 for ; Thu, 17 Jan 2013 09:59:36 -0500 Received: from relay1.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id AB104A50E4; Thu, 17 Jan 2013 15:59:35 +0100 (CET) From: Hannes Reinecke To: Christophe Varoqui Date: Thu, 17 Jan 2013 15:59:24 +0100 Message-Id: <1358434773-2002-3-git-send-email-hare@suse.de> In-Reply-To: <1358434773-2002-1-git-send-email-hare@suse.de> References: <1358434773-2002-1-git-send-email-hare@suse.de> X-RedHat-Spam-Score: -7.301 (BAYES_00, DCC_REPUT_00_12, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.16 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com Subject: [dm-devel] [PATCH 02/11] Provide correct persistent symlinks for user_friendly_names 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 When the option 'user_friendly_names' is set we should provide both symlinks, the persistent one and that one generated for user_friendly_names. Signed-off-by: Hannes Reinecke --- kpartx/kpartx.rules | 4 ++++ kpartx/kpartx_id | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/kpartx/kpartx.rules b/kpartx/kpartx.rules index ba5c6cb..8640094 100644 --- a/kpartx/kpartx.rules +++ b/kpartx/kpartx.rules @@ -18,10 +18,14 @@ OPTIONS="link_priority=50" # Create persistent links for multipath tables ENV{DM_UUID}=="mpath-*", \ SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_NAME}" +ENV{DM_MPATH}=="?*", ENV{DM_PART}!="?*", \ + SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_MPATH}" # Create persistent links for partitions ENV{DM_PART}=="?*", \ SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_NAME}-part$env{DM_PART}" +ENV{DM_MPATH}=="?*", ENV{DM_PART}=="?*", \ + SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_MPATH}-part$env{DM_PART}" # Create dm tables for partitions ENV{DM_STATE}!="SUSPENDED", ENV{DM_UUID}=="mpath-*", \ diff --git a/kpartx/kpartx_id b/kpartx/kpartx_id index fa21b5b..afb589c 100644 --- a/kpartx/kpartx_id +++ b/kpartx/kpartx_id @@ -55,6 +55,9 @@ if [ "$dmtbl" = "part" ] ; then # The name of the kpartx table is the name of the parent table dmname=$($DMSETUP info -c --noheadings -o name -u $dmuuid) echo "DM_NAME=$dmname" + if [ "$dmname" != ${dmuuid#mpath-} ] ; then + echo "DM_MPATH=${dmuuid#mpath-}" + fi # We need the dependencies of the parent table to figure out # the type if the parent is a multipath table case "$dmuuid" in @@ -63,7 +66,9 @@ if [ "$dmtbl" = "part" ] ; then ;; esac elif [ "$dmtbl" = "mpath" ] ; then - dmname=$tblname + if [ -n "$DM_NAME" -a "$DM_NAME" != "$dmuuid" ] ; then + echo "DM_MPATH=$dmuuid" + fi # We need the dependencies of the table to figure out the type dmdeps=$($DMSETUP deps -u $UUID) elif [ "$dmtbl" = "dmraid" ] ; then