* [PATCH] mkcephfs: Don't transfer absolute path of mkcephfs to other hosts.
@ 2013-11-06 1:25 majianpeng
2013-11-06 2:20 ` Yunchuan Wen
0 siblings, 1 reply; 2+ messages in thread
From: majianpeng @ 2013-11-06 1:25 UTC (permalink / raw)
To: sage; +Cc: ceph-devel
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 <majianpeng@gmail.com>
---
src/mkcephfs.in | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
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
--
1.8.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mkcephfs: Don't transfer absolute path of mkcephfs to other hosts.
2013-11-06 1:25 [PATCH] mkcephfs: Don't transfer absolute path of mkcephfs to other hosts majianpeng
@ 2013-11-06 2:20 ` Yunchuan Wen
0 siblings, 0 replies; 2+ messages in thread
From: Yunchuan Wen @ 2013-11-06 2:20 UTC (permalink / raw)
To: majianpeng; +Cc: sage, ceph-devel, Li Wang
Hi Jianpeng,
I think this patch will work in the situation that 'mkcephfs' has
been added to the $PATH of other hosts, but what about that 'mkcephfs'
have been deployed to the same path in all cluster nodes, but NOT
added to $PATH, then the original version will work, but now it not
gotta work.
So my suggestion is, first check if the path $0 is valid or not on
other hosts by using something like ' if [ -f $0 ]', if so, just go as
now it is. Otherwise, remove other name components of the path, and
try to use it.
2013/11/6 majianpeng <majianpeng@gmail.com>:
> 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 <majianpeng@gmail.com>
> ---
> src/mkcephfs.in | 19 ++++++++++++++++---
> 1 file changed, 16 insertions(+), 3 deletions(-)
>
> 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
> --
> 1.8.4
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-11-06 2:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-06 1:25 [PATCH] mkcephfs: Don't transfer absolute path of mkcephfs to other hosts majianpeng
2013-11-06 2:20 ` Yunchuan Wen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.