Masakari fails when using FQDN as short hostname
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
kolla-ansible |
New
|
Undecided
|
Unassigned |
Bug Description
**Bug Report**
What happened:
Hi,
We are trying to implement masakari with hacluster.
After installation there exist WARNING logs below on "masakari_
-------
2022-01-31 11:29:33.063 7 INFO masakarimonitor
2022-01-31 11:30:03.111 7 WARNING masakarimonitor
Command: crmadmin -S r2-osp-
Exit code: 124
Stdout: ''
Stderr: 'No messages received in 30 seconds.. aborting\n': oslo_concurrenc
2022-01-31 11:30:03.112 7 WARNING masakarimonitor
2022-01-31 11:30:03.112 7 WARNING masakarimonitor
-------
Masakari HA not works because of this.
It seems that hacluster task creates pacemaker resources with short hostnames but Masakari uses python socket library to get hostname and it gets FQDN.
Our all installations have the hostnames as FQDN like below. It is not easy and safe to change all these hostnames.
-------
root@r2-
r2-osp-
root@r2-
r2-osp-
root@r2-
r2-osp-
root@r2-
-------
This issue has similarities with https:/
Our multinode inventory file also consist of FQDNs like below:
-------
[control]
r2-osp-
r2-osp-
r2-osp-
-------
These FQDNs have dns records and ansible can reach the hosts with these FQDNs.
We had to change **hacluster_
-------
vim /etc/kolla/
...
...
...
nodelist {
{% for host in groups['hacluster'] | sort %}
node {
- name: {{ hostvars[
+ name: {{ hostvars[
nodeid: {{ loop.index }}
}
{% endfor %}
}
...
...
...
-------
We also updated the **kolla-
-------
- name: Ensure stonith is disabled
vars:
service: "{{ hacluster_
command: docker exec {{ service.
run_once: true
become: true
delegate_to: "{{ groups[
- name: Ensure remote node is added
vars:
pacemaker_
pacemaker_
shell: >
docker exec {{ pacemaker_
cibadmin --modify --scope resources -X '
<resources>
- <primitive id="{{ ansible_
+ <primitive id="{{ inventory_hostname }}" class="ocf" provider=
- <instance_
+ <instance_
- <nvpair id="{{ ansible_
+ <nvpair id="{{ inventory_hostname }}-instance_
- <op id="{{ ansible_
+ <op id="{{ inventory_hostname }}-monitor" name="monitor" interval="60" timeout="30"/>
</resources>
'
become: true
delegate_to: "{{ groups[
when:
- inventory_hostname in groups[
- pacemaker_
-------
After these changes kolla-ansible creates the pacemaker resources with **FQDN hostnames** and beacuse of our hosts have **fqdn** as **short hostnames** then everything works seamless.
What you expected to happen: Masakari Installation should work out of the box even using FQDN as short hostnames.
How to reproduce it (minimal and precise): Set short hostnames as FQDN then try to install hacluster and masakari.
**Environment**:
* OS (e.g. from /etc/os-release): Ubuntu 20.04.2 LTS
* Kernel (e.g. `uname -a`): Linux 5.4.0-90-generic #101-Ubuntu SMP Fri Oct 15 20:00:55 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
* Docker version if applicable (e.g. `docker version`): 20.10.7
* Kolla-Ansible version (e.g. `git head or tag or stable branch` or pip package version if using release): pip installation, kolla-ansible=
* Docker image Install type (source/binary): source
* Docker image distribution: DockerHub Images
My solution is ansible/ roles/hacluster /templates/ hacluster_ corosync. conf.j2 /opt/kayobe/ venvs/kolla- ansible/ share/kolla- ansible/ ansible/ roles/hacluster /templates/ hacluster_ corosync. conf.j2 host].ansible_ facts.hostname }} host].ansible_ facts.fqdn }}
[rocky@kayobe src]$ diff kolla-ansible/
16c16
< name: {{ hostvars[
---
> name: {{ hostvars[
[rocky@kayobe src]$ diff kolla-ansible/ ansible/ roles/hacluster /tasks/ bootstrap_ service. yml /opt/kayobe/ venvs/kolla- ansible/ share/kolla- ansible/ ansible/ roles/hacluster /tasks/ bootstrap_ service. yml facts.hostname }}" class="ocf" provider= "pacemaker" type="remote"> attributes id="{{ ansible_ facts.hostname }}-instance_ attributes" > facts.hostname }}-instance_ attributes- server" name="server" value="{{ 'api' | kolla_address }}"/> "pacemaker" type="remote"> attributes id="{{ ansible_facts.fqdn }}-instance_ attributes" > attributes- server" name="server" value="{{ 'api' | kolla_address }}"/> facts.hostname }}-monitor" name="monitor" interval="60" timeout="30"/>
18,20c18,20
< <primitive id="{{ ansible_
< <instance_
< <nvpair id="{{ ansible_
---
> <primitive id="{{ ansible_facts.fqdn }}" class="ocf" provider=
> <instance_
> <nvpair id="{{ ansible_facts.fqdn }}-instance_
23c23
< <op id="{{ ansible_
---
> <op id="{{ ansible_facts.fqdn }}-monitor" name="monitor" interval="60" timeout="30"/>