We are trying to implement masakari with hacluster.
After installation there exist WARNING logs below on "masakari_hostmonitor" container logs:
```
2022-01-31 11:29:33.063 7 INFO masakarimonitors.hostmonitor.host_handler.handle_host [-] Corosync communication using 'bond0.api' is normal.
2022-01-31 11:30:03.111 7 WARNING masakarimonitors.hostmonitor.host_handler.handle_host [-] Exception caught: Unexpected error while running command.
Command: crmadmin -S r2-osp-test-controller-02.mycompany.dmz
Exit code: 124
Stdout: ''
Stderr: 'No messages received in 30 seconds.. aborting\n': oslo_concurrency.processutils.ProcessExecutionError: Unexpected error while running command.
2022-01-31 11:30:03.112 7 WARNING masakarimonitors.hostmonitor.host_handler.handle_host [-] 'r2-osp-test-controller-02.mycompany.dmz' is unstable state on cluster.: oslo_concurrency.processutils.ProcessExecutionError: Unexpected error while running command.
2022-01-31 11:30:03.112 7 WARNING masakarimonitors.hostmonitor.host_handler.handle_host [-] hostmonitor skips monitoring hosts.
```
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.
After these changes kolla-ansible creates the pacemaker resources with **short 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==12.3.0
* Docker image Install type (source/binary): source
* Docker image distribution: DockerHub Images
**Bug Report**
What happened:
Hi,
We are trying to implement masakari with hacluster.
After installation there exist WARNING logs below on "masakari_ hostmonitor" container logs:
``` s.hostmonitor. host_handler. handle_ host [-] Corosync communication using 'bond0.api' is normal. s.hostmonitor. host_handler. handle_ host [-] Exception caught: Unexpected error while running command. test-controller -02.mycompany. dmz y.processutils. ProcessExecutio nError: Unexpected error while running command. s.hostmonitor. host_handler. handle_ host [-] 'r2-osp- test-controller -02.mycompany. dmz' is unstable state on cluster.: oslo_concurrenc y.processutils. ProcessExecutio nError: Unexpected error while running command. s.hostmonitor. host_handler. handle_ host [-] hostmonitor skips monitoring hosts.
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.
``` osp-test- controller- 02:~# hostname test-controller -02.mycompany. dmz
root@r2-
r2-osp-
root@r2- osp-test- controller- 02:~# hostname -f test-controller -02.mycompany. dmz
r2-osp-
root@r2- osp-test- controller- 02:~# hostname -s test-controller -02 osp-test- controller- 02:~#
r2-osp-
root@r2-
```
This issue has similarities with https:/ /bugs.launchpad .net/kolla- ansible/ +bug/1830023
Our multinode inventory file also consist of FQDNs like below: test-controller -01.mycompany. dmz test-controller -02.mycompany. dmz test-controller -03.mycompany. dmz
```
[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_ corosync. conf.j2* * as below: config/ hacluster- corosync/ corosync. conf:
ring0_ addr: {{ 'api' | kolla_address(host) }} host].ansible_ facts.hostname }} host].inventory _hostname }}
```
vim /etc/kolla/
...
...
...
nodelist {
{% for host in groups['hacluster'] | sort %}
node {
- name: {{ hostvars[
+ name: {{ hostvars[
nodeid: {{ loop.index }}
}
{% endfor %}
}
...
...
...
```
We also updated the **kolla- ansible/ ansible/ roles/hacluster /tasks/ bootstrap_ service. yml** file and changed all **{{ ansible_ facts.hostname }}** values to **{{ inventory_hostname }}** services[ 'hacluster- pacemaker' ] }}" container_ name }} crm_attribute --type crm_config --name stonith-enabled --update false service. group][ 0] }}"
```
---
- 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 service: "{{ hacluster_ services[ 'hacluster- pacemaker' ] }}" remote_ service: "{{ hacluster_ services[ 'hacluster- pacemaker- remote' ] }}" service. container_ name }} facts.hostname }}" class="ocf" provider= "pacemaker" type="remote"> "pacemaker" type="remote"> attributes id="{{ ansible_ facts.hostname }}-instance_ attributes" > attributes id="{{ inventory_hostname }}-instance_ attributes" > facts.hostname }}-instance_ attributes- server" name="server" value="{{ 'api' | kolla_address }}"/> attributes- server" name="server" value="{{ 'api' | kolla_address }}"/>
</instance_ attributes>
<operations> facts.hostname }}-monitor" name="monitor" interval="60" timeout="30"/>
</operations >
</primitive> pacemaker_ service. group][ 0] }}" pacemaker_ remote_ service. group] remote_ service. enabled | bool
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 **short 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**: =12.3.0
* 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