From patchwork Fri Jun 28 23:26:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 2802791 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 BF8C7BF4A1 for ; Fri, 28 Jun 2013 23:30:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DFF6B20218 for ; Fri, 28 Jun 2013 23:30:21 +0000 (UTC) Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by mail.kernel.org (Postfix) with ESMTP id 0F73F20140 for ; Fri, 28 Jun 2013 23:30:20 +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 r5SNQWOS025601; Fri, 28 Jun 2013 19:26:33 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r5SNQVc2022963 for ; Fri, 28 Jun 2013 19:26:31 -0400 Received: from ether.msp.redhat.com (ether.msp.redhat.com [10.15.80.119]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r5SNQU6t021618 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 28 Jun 2013 19:26:30 -0400 Received: from ether.msp.redhat.com (localhost.localdomain [127.0.0.1]) by ether.msp.redhat.com (8.14.1/8.14.1) with ESMTP id r5SNQTUr006361; Fri, 28 Jun 2013 18:26:29 -0500 Received: (from bmarzins@localhost) by ether.msp.redhat.com (8.14.1/8.14.1/Submit) id r5SNQSec006360; Fri, 28 Jun 2013 18:26:28 -0500 From: Benjamin Marzinski To: device-mapper development Date: Fri, 28 Jun 2013 18:26:16 -0500 Message-Id: <1372461981-6333-4-git-send-email-bmarzins@redhat.com> In-Reply-To: <1372461981-6333-1-git-send-email-bmarzins@redhat.com> References: <1372461981-6333-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-loop: dm-devel@redhat.com Cc: Christophe Varoqui Subject: [dm-devel] [PATCH 3/8] Fix multipath rename from user_friendly_name to wwid 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=-8.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 multipath was selecting an alias for a device on reload, if it didn't have an explicit alias, and user_friendly_names wasn't set, multipath would use the existing alias, if one existed. This made it impossible to turn off user_friendly_names, and then reconfigure to change the device names back to wwids. Instead, multipath should just use the wwid as an alias, if that's what it's configured to do, regardless of the existing name. Signed-off-by: Benjamin Marzinski --- libmultipath/devmapper.c | 45 --------------------------------------------- libmultipath/devmapper.h | 1 - libmultipath/propsel.c | 2 -- 3 files changed, 48 deletions(-) diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c index 67481c4..1f3b64c 100644 --- a/libmultipath/devmapper.c +++ b/libmultipath/devmapper.c @@ -917,51 +917,6 @@ out: return r; } -extern char * -dm_get_name(char *uuid) -{ - struct dm_task *dmt; - struct dm_info info; - char *prefixed_uuid, *name = NULL; - const char *nametmp; - - dmt = dm_task_create(DM_DEVICE_INFO); - if (!dmt) - return NULL; - - prefixed_uuid = MALLOC(UUID_PREFIX_LEN + strlen(uuid) + 1); - if (!prefixed_uuid) { - condlog(0, "cannot create prefixed uuid : %s", - strerror(errno)); - goto freeout; - } - sprintf(prefixed_uuid, UUID_PREFIX "%s", uuid); - if (!dm_task_set_uuid(dmt, prefixed_uuid)) - goto freeout; - - if (!dm_task_run(dmt)) - goto freeout; - - if (!dm_task_get_info(dmt, &info) || !info.exists) - goto freeout; - - nametmp = dm_task_get_name(dmt); - if (nametmp && strlen(nametmp)) { - name = MALLOC(strlen(nametmp) + 1); - if (name) - strcpy(name, nametmp); - } else { - condlog(2, "%s: no device-mapper name found", uuid); - } - -freeout: - if (prefixed_uuid) - FREE(prefixed_uuid); - dm_task_destroy(dmt); - - return name; -} - int dm_geteventnr (char *name) { diff --git a/libmultipath/devmapper.h b/libmultipath/devmapper.h index bf8ee91..d27fe7f 100644 --- a/libmultipath/devmapper.h +++ b/libmultipath/devmapper.h @@ -40,7 +40,6 @@ int dm_remove_partmaps (const char * mapname, int need_sync); int dm_get_uuid(char *name, char *uuid); int dm_get_info (char * mapname, struct dm_info ** dmi); int dm_rename (char * old, char * new); -char * dm_get_name(char * uuid); int dm_reassign(const char * mapname); int dm_reassign_table(const char *name, char *old, char *new); int dm_setgeometry(struct multipath *mpp); diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c index a7e1fc2..8ba3b44 100644 --- a/libmultipath/propsel.c +++ b/libmultipath/propsel.c @@ -263,8 +263,6 @@ select_alias (struct multipath * mp) conf->bindings_file, mp->alias_prefix, conf->bindings_read_only); } if (mp->alias == NULL) - mp->alias = dm_get_name(mp->wwid); - if (mp->alias == NULL) mp->alias = STRDUP(mp->wwid); }