]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
common: support OSDs with more than 2 digits
authorGuillaume Abrioux <gabrioux@redhat.com>
Fri, 21 Feb 2020 09:22:32 +0000 (10:22 +0100)
committerDimitri Savineau <savineau.dimitri@gmail.com>
Fri, 28 Feb 2020 16:06:47 +0000 (11:06 -0500)
When running environment with OSDs having ID with more than 2 digits,
some tasks don't match the system units and therefore, playbook can fail.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1805643
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit a084a2a3470887bfaa3616acac1052664b52e12a)

infrastructure-playbooks/purge-container-cluster.yml
infrastructure-playbooks/rolling_update.yml
roles/ceph-handler/templates/restart_osd_daemon.sh.j2

index dfba25581f9ad8326cf63b03044ce8c979ecee4c..7fb19e783a84983d3e068565d5f6e3de86b5dad7 100644 (file)
 
   - name: get all the running osds
     shell: |
-      systemctl list-units | grep 'loaded[[:space:]]\+active' | grep -oE "ceph-osd@([0-9]{1,2}|[a-z]+).service"
+      systemctl list-units | grep 'loaded[[:space:]]\+active' | grep -oE "ceph-osd@([0-9]+).service"
     register: osd_units
     ignore_errors: true
 
index d1cefa7533b4a260c55ac3cfd9b1da7e20ff0180..2ff86a6796889ca5f4c4038062b3afacd0de7994 100644 (file)
       when: not containerized_deployment | bool
 
     - name: get osd unit names - container
-      shell: systemctl list-units | grep -E "loaded * active" | grep -oE "ceph-osd@([a-z0-9]+).service"
+      shell: systemctl list-units | grep -E "loaded * active" | grep -oE "ceph-osd@([0-9]+).service"
       register: osd_names
       changed_when: false
       when: containerized_deployment | bool
index 31de8864017afb7f478f62778ec59cec39b80182..597baaacd0db72fdd439effec457b09b174243c1 100644 (file)
@@ -55,7 +55,7 @@ get_container_id_from_dev_name() {
 
 # For containerized deployments, the unit file looks like: ceph-osd@sda.service
 # 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]+|[a-z]+).service"); do
+for unit in $(systemctl list-units | grep -E "loaded * active" | grep -oE "ceph-osd@([0-9]+).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