oVirt/ovirt-engine

Fix comparison logic in ovirt_initial_validations Ansible role

o0-o opened this issue · 1 comments

o0-o commented

Affected version

  • oVirt Engine: ovirt-engine-4.5.4-1.el8.noarch
  • Host OS Variant: oVirt Node 4.5.4
  • VDSM version: vdsm-4.50.3.4-1.el8.x86_64
  • Ansible Core version: 2.15.0
  • Python version: 3.11.2

Describe the bug

If elasticsearch_host or fluentd_elasticsearch_host are undefined, hosted-engine --deploy will fail (timeout waiting for the engine to add the host).

The tasks file is located here on the engine vm:

/usr/share/ansible/roles/oVirt.metrics/roles/ovirt_initial_validations/tasks/check_logging_collectors.yml

The following lines will fail if elasticsearch_host or fluentd_elasticsearch_host are undefined:

elasticsearch_host == None or elasticsearch_host is undefined
fluentd_elasticsearch_host == None or fluentd_elasticsearch_host is undefined
when: (fluentd_elasticsearch_host == "elasticsearch-server.example.com") or (fluentd_elasticsearch_host is undefined)

(Comparing undefined to anything will fail, even if is undefined appears later in the logic)

Possible solution:

elasticsearch_host | default(None) == None
fluentd_elasticsearch_host | default(None) == None
when: (fluentd_elasticsearch_host | default == "elasticsearch-server.example.com")

In the last case, I'm not sure what it's purpose is since it's a hard-coded example... is the role generated dynamically?

To reproduce

  1. hosted-engine --deploy --4

  2. Install pip3.11 and then netaddr on the engine VM immediately after the Python 3.11 is installed (per #867)

Expected behavior

The engine should not fail while adding its host.

Additional context

For anyone looking for a quick fix:

  1. Console into the engine vm from the host node:
virsh -c qemu:///system?authfile=/etc/ovirt-hosted-engine/virsh_auth.conf console HostedEngineLocal
  1. Set the elasticsearch_host and fluentd_elasticsearch_host to None in defaults:
printf '%s\n' 'elasticsearch_host:' 'fluentd_elasticsearch_host:' >> /usr/share/ansible/roles/oVirt.metrics/roles/ovirt_initial_validations/defaults/main.yml