]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/tools/ceph-monstore-update-crush.sh
update sources to v12.1.0
[ceph.git] / ceph / src / tools / ceph-monstore-update-crush.sh
index 73c6dd0bccf0cd08977ce3ff4f413b649aaf9107..e2fd73cf302105ea394b8ea63d0256f6c525eaa0 100755 (executable)
@@ -19,12 +19,8 @@ verbose=
 
 test -d ../src && export PATH=$PATH:.
 
-if type xmlstarlet > /dev/null 2>&1; then
-    XMLSTARLET=xmlstarlet
-elif type xml > /dev/null 2>&1; then
-    XMLSTARLET=xml
-else
-    echo "Missing xmlstarlet binary!"
+if ! which jq ; then
+    echo "Missing jq binary!"
     exit 1
 fi
 
@@ -43,8 +39,8 @@ function osdmap_get() {
     $CEPH_BIN/ceph-monstore-tool $store_path get osdmap -- \
                        $epoch -o $osdmap > /dev/null || return
 
-    echo $($CEPH_BIN/osdmaptool --dump xml $osdmap 2> /dev/null | \
-           $XMLSTARLET sel -t -m "$query" -v .)
+    echo $($CEPH_BIN/osdmaptool --dump json $osdmap 2> /dev/null | \
+           jq "$query")
 
     rm -f $osdmap
 }
@@ -132,11 +128,11 @@ function main() {
     # try accessing the store; if it fails, likely means a mon is running
     local last_osdmap_epoch
     local max_osd
-    last_osdmap_epoch=$(osdmap_get $store_path "/osdmap/epoch") || \
+    last_osdmap_epoch=$(osdmap_get $store_path ".epoch") || \
         die "error accessing mon store at $store_path"
     # get the max_osd # in last osdmap epoch, crushtool will use it to check
     # the crush maps in previous osdmaps
-    max_osd=$(osdmap_get $store_path "/osdmap/max_osd" $last_osdmap_epoch)
+    max_osd=$(osdmap_get $store_path ".max_osd" $last_osdmap_epoch)
 
     local good_crush
     local good_epoch