From 874e54abeb50601a89f8193b941d26e3f916c1dc Mon Sep 17 00:00:00 2001 From: Eric Harney Date: Thu, 8 Aug 2019 09:57:32 -0400 Subject: [PATCH] Use vercmp Use devstack's vercmp function instead of bc for version comparisons. Change-Id: I6436a6f836ad1ab9594858986bfdb8d6d6dbc392 --- devstack/lib/ceph | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/devstack/lib/ceph b/devstack/lib/ceph index a384c7f3..97cd7ceb 100755 --- a/devstack/lib/ceph +++ b/devstack/lib/ceph @@ -250,7 +250,7 @@ function _get_ceph_version { function _run_as_ceph_or_root { local ceph_version ceph_version=$(_get_ceph_version cli) - if [[ $(echo $ceph_version '>=' 9.2 | bc -l) == 1 ]] ; then + if vercmp "$ceph_version" ">=" "9.2"; then echo ceph else echo root @@ -469,13 +469,13 @@ function configure_ceph { local ceph_version ceph_version=$(_get_ceph_version mon) - if [[ $(echo $ceph_version '>=' 14.0 | bc -l) == 1 ]] ; then + if vercmp "$ceph_version" ">=" "14.0"; then for key in bootstrap-{mds,osd,rgw}; do sudo ceph auth get client.$key -o ${CEPH_DATA_DIR}/$key/ceph.keyring done fi - if [[ $(echo $ceph_version '>=' 12.1 | bc -l) == 1 ]] ; then + if vercmp "$ceph_version" ">=" "12.1"; then sudo mkdir -p ${CEPH_DATA_DIR}/mgr/ceph-${MGR_ID} sudo ceph -c ${CEPH_CONF_FILE} auth get-or-create mgr.${MGR_ID} \ mon 'allow profile mgr' mds 'allow *' osd 'allow *' \ @@ -1220,7 +1220,7 @@ function start_ceph { sudo systemctl start ceph-mon@$(hostname) local ceph_version ceph_version=$(_get_ceph_version mon) - if [[ $(echo $ceph_version '>=' 12.1 | bc -l) == 1 ]] ; then + if vercmp "$ceph_version" ">=" "12.1"; then sudo systemctl start ceph-mgr@${MGR_ID} # use `tell mgr` as the mgr might not have been activated # yet to register the python module commands. @@ -1275,7 +1275,7 @@ function stop_ceph { done local ceph_version ceph_version=$(_get_ceph_version cli) - if [[ $(echo $ceph_version '>=' 12.1 | bc -l) == 1 ]] ; then + if vercmp "$ceph_version" ">=" "12.1"; then sudo systemctl stop ceph-mgr@${MGR_ID} fi sudo systemctl stop ceph-mon@$(hostname)