Update B&R monitor bootstrap to enable V1/V2 Msgr protocols

During system restore, the monitor does not start up currently and hangs
in a continual probing loop.

The issue here stems from the fact that we are no longer providing the
port for the public_addr of the Ceph monitor. This was removed with
09e0401d59
and is not present the restored ceph.conf.

If we define a port, either v1 (6789) or v2 (3300), for the monitor's
public_addr, then the restore playbook will work without us needing to
change the backup.

Since we still have older containerized ceph clients using the V1
protocol, we can't specify the V2 port because we'll have no easy
way to enable the V1 protocol.

Here we add the V1 protocol port to allow the monitor to bootstrap
correctly then enable the V2 protocol.

Test plan:
 - AIO-SX B&R
 - AIO-DX B&R

Story: 2009074
Task: 43992
Signed-off-by: Felipe Sanches Zanoni <Felipe.SanchesZanoni@windriver.com>
Change-Id: I487035f96654371f708d846803238de1ad995572
This commit is contained in:
Felipe Sanches Zanoni
2021-11-19 17:17:27 -05:00
parent 29ce64a5be
commit 79ef41ffcd

View File

@@ -123,6 +123,38 @@
- /etc/init.d/ceph stop mon
when: ceph_mons.stdout != ""
# Four sed patterns for the monitor public_addr: First two remove the MSGR
# V1 port if it already exists, the second two add it when it doesn't exist.
# Prevents us from continually adding the port in case this role becomes
# reentrant
#
# Handling two patterns of restored ceph.conf:
# 1) For AIO-SX/STD
#
# [mon.controller-0]
# public_addr = 192.168.204.2
# host = controller-0
#
# 2) For AIO-DX
#
# [mon.controller]
# host = controller-0
# public_addr = 192.168.204.2
#
- name: Explicitly enable Msgr V1 port on Ceph monitor public address
command: "{{ item }}"
args:
warn: false
with_items:
- "sed -ri -e '/mon.'$MON_NAME'/!b;n;s/(public_addr.*):'$MON_PORT'$/\\1/' /etc/ceph/ceph.conf"
- "sed -ri -e '/mon.'$MON_NAME'/!b;n;!b;n;s/(public_addr.*):'$MON_PORT'$/\\1/' /etc/ceph/ceph.conf"
- "sed -ri -e '/mon.'$MON_NAME'/!b;n;s/(public_addr.*)$/\\1:'$MON_PORT'/' /etc/ceph/ceph.conf"
- "sed -ri -e '/mon.'$MON_NAME'/!b;n;!b;n;s/(public_addr.*)$/\\1:'$MON_PORT'/' /etc/ceph/ceph.conf"
environment:
MON_PORT: 6789
MON_NAME: "{{ mon_name }}"
# On a partial restore ceph-osds are not wiped.
# 'ceph-disk list' command returns the list of ceph osds
# This task:
@@ -171,6 +203,19 @@
retries: 5
delay: 2
- name: Enable Ceph Msgr v2 protocol
shell: ceph mon enable-msgr2
until: true
retries: 5
delay: 2
- name: Wait for V2 protocol to be enabled
shell: ceph -s
register: result
until: "'1 monitors have not enabled msgr2' not in result"
retries: 30
delay: 10
- name: Start Ceph manager
command: /usr/bin/ceph-mgr --cluster ceph --id controller-0 - start ceph-mgr