diff --git a/tests/roles/ceph_migrate/tasks/fail_mgr.yaml b/tests/roles/ceph_migrate/tasks/fail_mgr.yaml new file mode 100644 index 000000000..63f9c9742 --- /dev/null +++ b/tests/roles/ceph_migrate/tasks/fail_mgr.yaml @@ -0,0 +1,38 @@ +# Get a client using -v /home/tripleo-admin/ceph_config:/etc/ceph:z as input +- name: Refresh ceph_cli + ansible.builtin.include_tasks: ceph_cli.yaml + vars: + ceph_config_home: "{{ ceph_config_tmp_client_home }}" + ceph_fsid: "{{ mon_dump.fsid }}" + ceph_cluster: ceph + +- name: Force fail ceph mgr + become: true + ansible.builtin.command: "{{ ceph_cli }} mgr fail" + +- name: Wait for cephadm to reconcile + ansible.builtin.pause: + seconds: "{{ ceph_wait_mon_timeout }}" + +- name: Get the ceph orchestrator status with + become: true + ansible.builtin.command: "{{ ceph_cli }} orch status --format json" + register: ceph_orch_status + async: 30 + poll: 1 + failed_when: false + +- name: Restart ceph active mgr if ceph orch is not responding + become: true + when: + - ceph_orch_status.msg is defined + - '"Timeout exceeded" in ceph_orch_status.msg' + block: + - name: Restart the active mgr + ansible.builtin.command: "{{ ceph_cli }} mgr fail" + # This time we fail because something is wrong + - name: Fail if ceph orchestrator is still not responding + ansible.builtin.command: "{{ ceph_cli }} orch status --format json" + become: true + async: 30 + poll: 1 diff --git a/tests/roles/ceph_migrate/tasks/mon.yaml b/tests/roles/ceph_migrate/tasks/mon.yaml index 25e4bdefb..224917a93 100644 --- a/tests/roles/ceph_migrate/tasks/mon.yaml +++ b/tests/roles/ceph_migrate/tasks/mon.yaml @@ -63,8 +63,7 @@ - name: Fail mgr if active in the current node become: true - ansible.builtin.command: - "{{ ceph_cli }} mgr fail {{ mgr.active_name }}" + ansible.builtin.include_tasks: fail_mgr.yaml when: - mgr.active_name | length > 0 - mgr.active_name | regex_search(cur_mon | split('.') | first) or mgr.active_name | regex_search(target_node | split('.') | first) @@ -182,7 +181,7 @@ - name: reconfig osds ansible.builtin.command: "{{ ceph_cli }} orch reconfig osd.default_drive_group " - name: force-fail ceph mgr - ansible.builtin.command: "{{ ceph_cli }} mgr fail" + ansible.builtin.include_tasks: fail_mgr.yaml - name: MON - Manage mons # root privileges required to run cephadm