Merge pull request #19881 from liewegas/wip-kill-crush-location

ceph-crush-location: remove

Reviewed-by: Wido den Hollander <wido@widodh.nl>
This commit is contained in:
Sage Weil 2018-01-11 15:48:29 -06:00 committed by GitHub
commit c4a7881876
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 17 additions and 115 deletions

View File

@ -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

View File

@ -216,7 +216,6 @@ common() {
ceph-dencoder \
ceph-rbdnamer \
ceph-syn \
ceph-crush-location \
cephfs-data-scan \
cephfs-journal-tool \
cephfs-table-tool \

View File

@ -1062,7 +1062,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

View File

@ -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

View File

@ -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

View File

@ -925,9 +925,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)
@ -943,7 +940,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

View File

@ -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 <clustername> name of the cluster (see /etc/ceph/$cluster.conf)
# --type <osd|mds|client> daemon/entity type
# --id <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 <cluster>] --id <id> --type <osd|mds|client>"
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"

View File

@ -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