From a0b805d4fcaf0d2a5fb601578c4986e316f1f2da Mon Sep 17 00:00:00 2001
From: Alberto Colla <alberto.colla@garr.it>
Date: Tue, 5 Oct 2021 10:41:46 +0000
Subject: [PATCH] Add new file

---
 web/support/images/restore-osd.sh | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 web/support/images/restore-osd.sh

diff --git a/web/support/images/restore-osd.sh b/web/support/images/restore-osd.sh
new file mode 100644
index 00000000..7207c335
--- /dev/null
+++ b/web/support/images/restore-osd.sh
@@ -0,0 +1,20 @@
+ms=./mon-store
+rm -rf $ms
+mkdir $ms
+
+hosts=`juju status ceph-osd | grep 'ceph-osd/' | awk '{print $1}' | cut -d'*' -f1`
+
+# collect the cluster map from stopped OSDs
+for host in $hosts; do
+  echo $host
+  juju ssh $host sudo rm -rf /tmp/$ms
+  juju scp -- -r $ms $host:/tmp
+  juju ssh $host sudo bash <<EOF
+    for osd in /var/lib/ceph/osd/ceph-*; do
+      ceph-objectstore-tool  --data-path \$osd --no-mon-config --op update-mon-db --mon-store-path /tmp/$ms
+    done
+    chmod -R +r /tmp/$ms
+EOF
+  rm -rf $ms
+  juju scp -- -r $host:/tmp/$ms .
+done
-- 
GitLab