]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
Fix in regular expression matching OSD ID on non-contenerized
authorArtur Fijalkowski <artur.fijalkowski@ing.com>
Thu, 2 Aug 2018 11:28:44 +0000 (13:28 +0200)
committermergify[bot] <mergify[bot]@users.noreply.github.com>
Mon, 6 Aug 2018 19:09:19 +0000 (19:09 +0000)
deployment.
restart_osd_daemon.sh is used to discover and restart all OSDs on a
host. To do it the scripts loops the list of ceph-osd@ services in the
system. This commit fixes bug in the regular expression responsile for
extraction of OSDs - prior version uses `[0-9]{1,2}` expression
which is ignoring all OSDS which numbers are greater than 99 (thus
longer than 2 digits). Fix removed upper limit of digits in the number.
This problem existed in two places in the script.

Closes: #2964
Signed-off-by: Artur Fijalkowski <artur.fijalkowski@ing.com>
(cherry picked from commit 52d9d406b107c4926b582905b3d442feabf1fafc)

roles/ceph-defaults/templates/restart_osd_daemon.sh.j2

index 59ff259704aa7cc39942f67124d1075c77a039c7..0ca0b1958a8bf0926e8cfeb50d1ceb85d45c6b10 100644 (file)
@@ -55,8 +55,8 @@ get_docker_osd_id() {
 }
 
 # For containerized deployments, the unit file looks like: ceph-osd@sda.service
-# For non-containerized deployments, the unit file looks like: ceph-osd@0.service
-for unit in $(systemctl list-units | grep -E "loaded * active" | grep -oE "ceph-osd@([0-9]{1,2}|[a-z]+).service"); do
+# For non-containerized deployments, the unit file looks like: ceph-osd@NNN.service where NNN is OSD ID
+for unit in $(systemctl list-units | grep -E "loaded * active" | grep -oE "ceph-osd@([0-9]{1,}|[a-z]+).service"); do
   # First, restart daemon(s)
   systemctl restart "${unit}"
   # We need to wait because it may take some time for the socket to actually exists
@@ -68,7 +68,7 @@ for unit in $(systemctl list-units | grep -E "loaded * active" | grep -oE "ceph-
   osd_id=$(get_docker_osd_id "$container_id")
   docker_exec="docker exec $container_id"
   {% else %}
-  osd_id=$(echo ${unit#ceph-osd@} | grep -oE '[0-9]{1,2}')
+  osd_id=$(echo ${unit#ceph-osd@} | grep -oE '[0-9]{1,}')
   {% endif %}
   SOCKET=/var/run/ceph/{{ cluster }}-osd.${osd_id}.asok
   while [ $COUNT -ne 0 ]; do