diff mbox

some bugs when cluster name is not ‘ceph'

Message ID tencent_2FAE500D23138B8C713B9511@qq.com (mailing list archive)
State New, archived
Headers show

Commit Message

=?utf-8?B?eXk=?= July 16, 2014, 4:37 p.m. UTC
Hi, we found some bugs when cluster name is not ‘ceph' in version 0.80.1,
-----

-----------
Best regards,
yy,
eXtreme Spring Network Technology Limited. Co.

Comments

Alfredo Deza July 17, 2014, 7:43 p.m. UTC | #1
On Wed, Jul 16, 2014 at 12:37 PM, yy <yy@xspring.net> wrote:
> Hi, we found some bugs when cluster name is not ‘ceph' in version 0.80.1,
> -----
> diff --git a/src/ceph-disk b/src/ceph-disk
> index f79e341..153e344 100755
> --- a/src/ceph-disk
> +++ b/src/ceph-disk
> @@ -1611,6 +1611,8 @@ def start_daemon(
>                  [
>                      svc,
>                      'ceph',
> +                    '-c',
> +                    '/etc/ceph/{cluster}.conf'.format(cluster=cluster),
>                      'start',
>                      'osd.{osd_id}'.format(osd_id=osd_id),
>                      ],
> diff --git a/src/ceph_common.sh b/src/ceph_common.sh
> index 01781b7..8d14a3c 100644
> --- a/src/ceph_common.sh
> +++ b/src/ceph_common.sh
> @@ -49,13 +49,13 @@ check_host() {
>      get_conf user "" "user"
>
>      #echo host for $name is $host, i am $hostname
> -
> -    if [ -e "/var/lib/ceph/$type/ceph-$id/upstart" ]; then
> +    cluster=$1

Are we always passing `$1` here? What happens when `check_host` is
called with no arguments? It seems to
me that we should default to `ceph` but reading this, doesn't look like we do.


> +    if [ -e "/var/lib/ceph/$type/$cluster-$id/upstart" ]; then
>         return 1
>      fi
>
>      # sysvinit managed instance in standard location?
> -    if [ -e "/var/lib/ceph/$type/ceph-$id/sysvinit" ]; then
> +    if [ -e "/var/lib/ceph/$type/$cluster-$id/sysvinit" ]; then
>         host="$hostname"
>         echo "=== $type.$id === "
>         return 0
> diff --git a/src/init-ceph.in b/src/init-ceph.in
> index 846bd57..24c52d9 100644
> --- a/src/init-ceph.in
> +++ b/src/init-ceph.in
> @@ -189,7 +189,7 @@ for name in $what; do
>      num=$id
>      name="$type.$id"
>
> -    check_host || continue
> +    check_host $cluster|| continue
>
>      binary="$BINDIR/ceph-$type"
>      cmd="$binary -i $id"
> @@ -231,7 +231,7 @@ for name in $what; do
>      cmd="$cmd -c $conf"
>
>      if echo $name | grep -q ^osd; then
> -       get_conf osd_data "/var/lib/ceph/osd/ceph-$id" "osd data"
> +       get_conf osd_data "/var/lib/ceph/osd/$cluster-$id" "osd data"
>         get_conf fs_path "$osd_data" "fs path"  # mount point defaults so osd data
>          get_conf fs_devs "" "devs"
>         if [ -z "$fs_devs" ]; then
> @@ -323,7 +323,7 @@ for name in $what; do
>                 if [ "${update_crush:-1}" = "1" -o "${update_crush:-1}" = "true" ]; then
>                     # update location in crush
>                     get_conf osd_location_hook "$BINDIR/ceph-crush-location" "osd crush location hook"
> -                   osd_location=`$osd_location_hook --cluster ceph --id $id --type osd`
> +                   osd_location=`$osd_location_hook --cluster $cluster --id $id --type osd`
>                     get_conf osd_weight "" "osd crush initial weight"
>                     defaultweight="$(df -P -k $osd_data/. | tail -1 | awk '{ print sprintf("%.2f",$2/1073741824) }')"
>                     get_conf osd_keyring "$osd_data/keyring" "keyring"
> @@ -354,7 +354,7 @@ for name in $what; do
>                 get_conf mon_data "/var/lib/ceph/mon/ceph-$id" "mon data"
>                 if [ "$mon_data" = "/var/lib/ceph/mon/ceph-$id" -a "$asok" = "/var/run/ceph/ceph-mon.$id.asok" ]; then
>                     echo Starting ceph-create-keys on $host...
> -                   cmd2="$SBINDIR/ceph-create-keys -i $id 2> /dev/null &"
> +                   cmd2="$SBINDIR/ceph-create-keys --cluster $cluster -i $id 2> /dev/null &"
>                     do_cmd "$cmd2"
>                 fi
>             fi
>
> -----------
> Best regards,
> yy,
> eXtreme Spring Network Technology Limited. Co.
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/src/ceph-disk b/src/ceph-disk
index f79e341..153e344 100755
--- a/src/ceph-disk
+++ b/src/ceph-disk
@@ -1611,6 +1611,8 @@  def start_daemon(
                 [
                     svc,
                     'ceph',
+                    '-c',
+                    '/etc/ceph/{cluster}.conf'.format(cluster=cluster),
                     'start',
                     'osd.{osd_id}'.format(osd_id=osd_id),
                     ],
diff --git a/src/ceph_common.sh b/src/ceph_common.sh
index 01781b7..8d14a3c 100644
--- a/src/ceph_common.sh
+++ b/src/ceph_common.sh
@@ -49,13 +49,13 @@  check_host() {
     get_conf user "" "user"
 
     #echo host for $name is $host, i am $hostname
-
-    if [ -e "/var/lib/ceph/$type/ceph-$id/upstart" ]; then
+    cluster=$1
+    if [ -e "/var/lib/ceph/$type/$cluster-$id/upstart" ]; then
 	return 1
     fi
 
     # sysvinit managed instance in standard location?
-    if [ -e "/var/lib/ceph/$type/ceph-$id/sysvinit" ]; then
+    if [ -e "/var/lib/ceph/$type/$cluster-$id/sysvinit" ]; then
 	host="$hostname"
 	echo "=== $type.$id === "
 	return 0
diff --git a/src/init-ceph.in b/src/init-ceph.in
index 846bd57..24c52d9 100644
--- a/src/init-ceph.in
+++ b/src/init-ceph.in
@@ -189,7 +189,7 @@  for name in $what; do
     num=$id
     name="$type.$id"
 
-    check_host || continue
+    check_host $cluster|| continue
 
     binary="$BINDIR/ceph-$type"
     cmd="$binary -i $id"
@@ -231,7 +231,7 @@  for name in $what; do
     cmd="$cmd -c $conf"
 
     if echo $name | grep -q ^osd; then
-	get_conf osd_data "/var/lib/ceph/osd/ceph-$id" "osd data"
+	get_conf osd_data "/var/lib/ceph/osd/$cluster-$id" "osd data"
 	get_conf fs_path "$osd_data" "fs path"  # mount point defaults so osd data
         get_conf fs_devs "" "devs"
 	if [ -z "$fs_devs" ]; then
@@ -323,7 +323,7 @@  for name in $what; do
 		if [ "${update_crush:-1}" = "1" -o "${update_crush:-1}" = "true" ]; then
 		    # update location in crush
 		    get_conf osd_location_hook "$BINDIR/ceph-crush-location" "osd crush location hook"
-		    osd_location=`$osd_location_hook --cluster ceph --id $id --type osd`
+		    osd_location=`$osd_location_hook --cluster $cluster --id $id --type osd`
 		    get_conf osd_weight "" "osd crush initial weight"
 		    defaultweight="$(df -P -k $osd_data/. | tail -1 | awk '{ print sprintf("%.2f",$2/1073741824) }')"
 		    get_conf osd_keyring "$osd_data/keyring" "keyring"
@@ -354,7 +354,7 @@  for name in $what; do
 		get_conf mon_data "/var/lib/ceph/mon/ceph-$id" "mon data"
 		if [ "$mon_data" = "/var/lib/ceph/mon/ceph-$id" -a "$asok" = "/var/run/ceph/ceph-mon.$id.asok" ]; then
 		    echo Starting ceph-create-keys on $host...
-		    cmd2="$SBINDIR/ceph-create-keys -i $id 2> /dev/null &"
+		    cmd2="$SBINDIR/ceph-create-keys --cluster $cluster -i $id 2> /dev/null &"
 		    do_cmd "$cmd2"
 		fi
 	    fi