From patchwork Wed Nov 6 01:25:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: majianpeng X-Patchwork-Id: 3144591 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D1C869F407 for ; Wed, 6 Nov 2013 01:25:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 00352205C1 for ; Wed, 6 Nov 2013 01:25:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1EE71205BB for ; Wed, 6 Nov 2013 01:25:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755763Ab3KFBZO (ORCPT ); Tue, 5 Nov 2013 20:25:14 -0500 Received: from mail-pb0-f44.google.com ([209.85.160.44]:59007 "EHLO mail-pb0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755636Ab3KFBZN (ORCPT ); Tue, 5 Nov 2013 20:25:13 -0500 Received: by mail-pb0-f44.google.com with SMTP id rp8so2155868pbb.17 for ; Tue, 05 Nov 2013 17:25:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:reply-to:subject:mime-version:message-id :content-type:content-transfer-encoding; bh=lOQJazrpU/5bT2Z1uEX3TwfTwI/rJvTZyxWESv9UKcM=; b=hQaiejuyhvcQ3FFbYYsck+iBe2jo7btQ+kjW0ZtKQ5p3y+tCNoGea3lds651kJZwTm uVQxZrjxrxLqUOURxKKdyeL8TgJtm/xqT14OUWr20OBnw85JnueMJ/gTSRLypWp4HtZy xy33NlAaMJJAljldgEvm2G03ICNBoMd963+n09n6C26cuqCAieEPqAmiMZIMNK/rythl 6uTNkh4yt6nNm1y2Lgg57GzInIdjBZudYNJhj/kTk1sTFNVOJSehmrOUIgNddNGZN6vx 8n0uiJxbU8OYWRiUtPWMPT/Q0sW+YWQz25Vi5ghmKImt+x+7OCdu4IaSLw+tlny313I6 Hchg== X-Received: by 10.66.118.71 with SMTP id kk7mr1344278pab.14.1383701112781; Tue, 05 Nov 2013 17:25:12 -0800 (PST) Received: from majianpeng ([218.242.10.182]) by mx.google.com with ESMTPSA id ka3sm37412105pbc.32.2013.11.05.17.25.07 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 05 Nov 2013 17:25:11 -0800 (PST) Date: Wed, 6 Nov 2013 09:25:09 +0800 From: majianpeng To: sage Cc: ceph-devel Reply-To: majianpeng Subject: [PATCH] mkcephfs: Don't transfer absolute path of mkcephfs to other hosts. X-Priority: 3 X-GUID: 3E9D0193-F61C-47A6-BE34-50B82EC05AF2 X-Has-Attach: no X-Mailer: Foxmail 7.0.1.93[cn] Mime-Version: 1.0 Message-ID: <201311060925048528111@gmail.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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 exec 'mkcephfs -a -c ceph.conf',it will transfer absolute path of mkcephfs to other hosts.But for different hosts, the path of mkcephfs may different.It will make the command error.The error message is "bash: ./mkcephfs: No such file or directory". So we should transfer the name mkcephfs to other hosts.It those hosts,it will automaicly search by PATH. Signed-off-by: Jianpeng Ma --- src/mkcephfs.in | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) -- 1.8.4 diff --git a/src/mkcephfs.in b/src/mkcephfs.in index 2838568..c5e41d9 100644 --- a/src/mkcephfs.in +++ b/src/mkcephfs.in @@ -455,6 +455,7 @@ fi ### do everything via ssh ### if [ $allhosts -eq 1 ]; then + localhost=$hostname verify_conf @@ -498,10 +499,18 @@ if [ $allhosts -eq 1 ]; then fi if [ $mkfs -eq 1 ] && [ "$type" = "osd" ]; then - do_root_cmd "$0 -d $rdir --prepare-osdfs $name" + if [ $localhost = $host ]; then + do_root_cmd "$0 -d $rdir --prepare-osdfs $name" + else + do_root_cmd "$(basename $0) -d $rdir --prepare-osdfs $name" + fi fi - do_root_cmd "$0 -d $rdir --init-daemon $name" + if [ $localhost = $host ]; then + do_root_cmd "$0 -d $rdir --init-daemon $name" + else + do_root_cmd "$(basename $0) -d $rdir --init-daemon $name" + fi # collect the key if [ -n "$ssh" ]; then @@ -544,7 +553,11 @@ if [ $allhosts -eq 1 ]; then fi fi - do_root_cmd "$0 -d $rdir --init-daemon $name" + if [ $localhost = $host ]; then + do_root_cmd "$0 -d $rdir --init-daemon $name" + else + do_root_cmd "$(basename $0) -d $rdir --init-daemon $name" + fi if [ -n "$ssh" ]; then #cleanup no longer need rdir