From 60d3312dc2a7616f31a31b4cb6a247fbde7ecde5 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 9 Jan 2018 16:28:44 -0600 Subject: [PATCH 1/3] init-ceph: drop crush location update OSD.cc does this on its own; no need for this script to be involved. Signed-off-by: Sage Weil --- src/init-ceph.in | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/src/init-ceph.in b/src/init-ceph.in index 26704d62e67..e8c0ada2b3a 100755 --- a/src/init-ceph.in +++ b/src/init-ceph.in @@ -418,27 +418,6 @@ for name in $what; do fi fi - if [ "$type" = "osd" ]; then - get_conf update_crush "" "osd crush update on start" - case "${update_crush:-1}" in 1|[Tt][Rr][Uu][Ee]) - # update location in crush - get_conf osd_location_hook "$BINDIR/ceph-crush-location" "osd crush location hook" - if [ ! -e "$osd_location_hook" ]; then - EXIT_STATUS=2 - continue - fi - 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("%.4f",$2/1073741824) }')" - get_conf osd_keyring "$osd_data/keyring" "keyring" - do_cmd_okfail "timeout 30 $BINDIR/ceph -c $conf --name=osd.$id --keyring=$osd_keyring osd crush create-or-move -- $id ${osd_weight:-${defaultweight:-1}} $osd_location" - if [ "$ERR" != "0" ]; then - EXIT_STATUS=$ERR - continue - fi - esac - fi - echo Starting Ceph $name on $host... if [ ! -d $run_dir ]; then # assume /var/run exists From 3904bc0187baa6d8eca9351ebd93afe9ddf6e64b Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 9 Jan 2018 16:35:04 -0600 Subject: [PATCH 2/3] doc/rados/operations/crush-map: drop ceph-crush-location reference Explain how to write a location hook; do not reference the old sample one. Signed-off-by: Sage Weil --- doc/rados/operations/crush-map.rst | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/doc/rados/operations/crush-map.rst b/doc/rados/operations/crush-map.rst index 0262f78a8b1..2b14aded12e 100644 --- a/doc/rados/operations/crush-map.rst +++ b/doc/rados/operations/crush-map.rst @@ -71,16 +71,15 @@ Custom location hooks --------------------- A customized location hook can be used to generate a more complete -crush location on startup. The sample ``ceph-crush-location`` utility -will generate a CRUSH location string for a given daemon. The -location is based on, in order of preference: +crush location on startup. The crush location is based on, in order +of preference: #. A ``crush location`` option in ceph.conf. #. A default of ``root=default host=HOSTNAME`` where the hostname is generated with the ``hostname -s`` command. This is not useful by itself, as the OSD itself has the exact same -behavior. However, the script can be modified to provide additional +behavior. However, a script can be written to provide additional location fields (for example, the rack or datacenter), and then the hook enabled via the config option:: @@ -89,10 +88,17 @@ hook enabled via the config option:: This hook is passed several arguments (below) and should output a single line to stdout with the CRUSH location description.:: - $ ceph-crush-location --cluster CLUSTER --id ID --type TYPE + --cluster CLUSTER --id ID --type TYPE where the cluster name is typically 'ceph', the id is the daemon -identifier (the OSD number), and the daemon type is typically ``osd``. +identifier (e.g., the OSD number or daemon identifier), and the daemon +type is ``osd``, ``mds``, or similar. + +For example, a simple hook that additionally specified a rack location +based on a hypothetical file ``/etc/rack`` might be:: + + #!/bin/sh + echo "host=$(hostname -s) rack=$(cat /etc/rack) root=default" CRUSH structure From fb3220ff3e4319edd6cb188d497b18acd3627c61 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 9 Jan 2018 16:38:12 -0600 Subject: [PATCH 3/3] ceph-crush-location: remove This script is pointless. It is equivalent to the built-in default behavior, which makes it only useful as a sample for what a location hook's output should be. The documentation has been updated to provide that. Signed-off-by: Sage Weil --- PendingReleaseNotes | 6 ++- alpine/APKBUILD.in | 1 - ceph.spec.in | 1 - debian/ceph-common.install | 1 - src/CMakeLists.txt | 4 -- src/ceph-crush-location.in | 80 -------------------------------------- 6 files changed, 5 insertions(+), 88 deletions(-) delete mode 100755 src/ceph-crush-location.in diff --git a/PendingReleaseNotes b/PendingReleaseNotes index b48eb44cf70..1b30751de3b 100644 --- a/PendingReleaseNotes +++ b/PendingReleaseNotes @@ -1,4 +1,4 @@ -13.0.0 +13.0.1 ------ * The RBD C API's rbd_discard method now enforces a maximum length of @@ -25,6 +25,10 @@ mds_session_timeout, mds_session_autoclose, and mds_max_file_size are now obsolete. +* The sample ``crush-location-hook`` script has been removed. Its output is + equivalent to the built-in default behavior, so it has been replaced with an + example in the CRUSH documentation. + >= 12.2.2 diff --git a/alpine/APKBUILD.in b/alpine/APKBUILD.in index e82dd20a50c..47d2d586a54 100644 --- a/alpine/APKBUILD.in +++ b/alpine/APKBUILD.in @@ -216,7 +216,6 @@ common() { ceph-dencoder \ ceph-rbdnamer \ ceph-syn \ - ceph-crush-location \ cephfs-data-scan \ cephfs-journal-tool \ cephfs-table-tool \ diff --git a/ceph.spec.in b/ceph.spec.in index 0b0a506969e..03f3f302f15 100644 --- a/ceph.spec.in +++ b/ceph.spec.in @@ -1066,7 +1066,6 @@ fi %{_bindir}/ceph-dencoder %{_bindir}/ceph-rbdnamer %{_bindir}/ceph-syn -%{_bindir}/ceph-crush-location %{_bindir}/cephfs-data-scan %{_bindir}/cephfs-journal-tool %{_bindir}/cephfs-table-tool diff --git a/debian/ceph-common.install b/debian/ceph-common.install index 11e24f49472..afba9d90240 100755 --- a/debian/ceph-common.install +++ b/debian/ceph-common.install @@ -10,7 +10,6 @@ usr/bin/ceph-conf usr/bin/ceph-dencoder usr/bin/ceph-rbdnamer usr/bin/ceph-syn -usr/bin/ceph-crush-location usr/bin/cephfs-data-scan usr/bin/cephfs-journal-tool usr/bin/cephfs-table-tool diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6337805198e..f202c12e071 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -926,9 +926,6 @@ endif() configure_file(${CMAKE_SOURCE_DIR}/src/ceph.in ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph @ONLY) -configure_file(${CMAKE_SOURCE_DIR}/src/ceph-crush-location.in - ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph-crush-location @ONLY) - configure_file(${CMAKE_SOURCE_DIR}/src/init-ceph.in ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/init-ceph @ONLY) @@ -944,7 +941,6 @@ endif() install(PROGRAMS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph - ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph-crush-location ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ceph-post-file ${CMAKE_SOURCE_DIR}/src/ceph-run ${CMAKE_SOURCE_DIR}/src/ceph-rest-api diff --git a/src/ceph-crush-location.in b/src/ceph-crush-location.in deleted file mode 100755 index a8c22a8dcf6..00000000000 --- a/src/ceph-crush-location.in +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/sh -# -# Generate a CRUSH location for the given entity -# -# The CRUSH location consists of a list of key=value pairs, separated -# by spaces, all on a single line. This describes where in CRUSH -# hierarhcy this entity should be placed. -# -# Arguments: -# --cluster name of the cluster (see /etc/ceph/$cluster.conf) -# --type daemon/entity type -# --id id (osd number, mds name, client name) -# - -# if we start up as ./ceph-crush-location, assume everything else is -# in the current directory too. -if [ `dirname $0` = "." ] && [ $PWD != "/usr/bin" ]; then - BINDIR=. - SBINDIR=. - LIBDIR=. - ETCDIR=. -else - BINDIR=@bindir@ - SBINDIR=@prefix@/sbin - LIBDIR=@libdir@/ceph - ETCDIR=@sysconfdir@/ceph -fi - -usage_exit() { - echo "usage: $0 [--cluster ] --id --type " - exit -} - -cluster="ceph" -type="" -id="" -while [ $# -ge 1 ]; do - case $1 in - --cluster | -C) - shift - cluster="$1" - shift - ;; - --id | -i) - shift - id="$1" - shift - ;; - --type | -t) - shift - type="$1" - shift - ;; - *) - echo "unrecognized option '$1'" - usage_exit - ;; - esac -done - -if [ -z "$type" ]; then - echo "must specify entity type" - usage_exit -fi - -if [ -z "$id" ]; then - echo "must specify id" - usage_exit -fi - -# try a generic location -location="$($BINDIR/ceph-conf --cluster=${cluster:-ceph} --name=$type.$id --lookup crush_location || :)" -if [ -n "$location" ]; then - echo $location - exit 0 -fi - -# spit out something generic -echo "host=$(hostname -s) root=default" -