Bug 1782867

Summary: "Found multiple compute-2, which is unexpected" if any host shortname starts with another host shortname
Product: Red Hat OpenStack Reporter: James Slagle <jslagle>
Component: openstack-tripleo-commonAssignee: Adriano Petrich <apetrich>
Status: CLOSED ERRATA QA Contact: Alexander Chuzhoy <sasha>
Severity: high Docs Contact:
Priority: high    
Version: 16.0 (Train)CC: aschultz, drosenfe, kecarter, mburns, slinaber
Target Milestone: rcKeywords: Triaged
Target Release: 16.0 (Train on RHEL 8.1)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openstack-tripleo-common-11.3.2-0.20191212040219.77511ee.el8ost Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-02-06 14:43:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description James Slagle 2019-12-12 14:18:56 UTC
When config download runs to generate the ansible project directory, it will fail if any host shortname starts with another host's shortname.

Particularly, this will happen when deploying with more than 10 nodes of the same roles and using the default hostname formats since a hostname such as openstack-compute-10 starts with openstack-compute-1.

Sample traceback of a host called compute-2, and I also have hosts compute-20, compute-21, etc:

Traceback (most recent call last):
  File "/usr/bin/tripleo-config-download", line 57, in <module>
    stack_config.download_config(args.stack_name, args.output_dir)
  File "/home/centos/tripleo-common/tripleo_common/utils/config.py", line 577, in download_config
    self.write_config(stack, name, config_dir, config_type)
  File "/home/centos/tripleo-common/tripleo_common/utils/config.py", line 515, in write_config
    if role_host_vars and server_role:
SystemError: Found multiple `compute-2`, which is unexpected. This means that the FQDN of the selected device is either wrong or is sharing a name with another host, which is also wrong. Please correct this issue before continuing. Return data can be found here -> [{u'fqdn_internal_api': u'compute-2.internalapi.localdomain', u'fqdn_ctlplane': u'compute-2.ctlplane.localdomain', u'fqdn_storage': u'compute-2.storage.localdomain', u'fqdn_canonical': u'compute-2.localdomain', u'fqdn_tenant': u'compute-2.tenant.localdomain'}, {u'fqdn_internal_api': u'compute-20.internalapi.localdomain', u'fqdn_ctlplane': u'compute-20.ctlplane.localdomain', u'fqdn_storage': u'compute-20.storage.localdomain', u'fqdn_canonical': u'compute-20.localdomain', u'fqdn_tenant': u'compute-20.tenant.localdomain'}, {u'fqdn_internal_api': u'compute-21.internalapi.localdomain', u'fqdn_ctlplane': u'compute-21.ctlplane.localdomain', u'fqdn_storage': u'compute-21.storage.localdomain', u'fqdn_canonical': u'compute-21.localdomain', u'fqdn_tenant': u'compute-21.tenant.localdomain'}, {u'fqdn_internal_api': u'compute-22.internalapi.localdomain', u'fqdn_ctlplane': u'compute-22.ctlplane.localdomain', u'fqdn_storage': u'compute-22.storage.localdomain', u'fqdn_canonical': u'compute-22.localdomain', u'fqdn_tenant': u'compute-22.tenant.localdomain'}, {u'fqdn_internal_api': u'compute-23.internalapi.localdomain', u'fqdn_ctlplane': u'compute-23.ctlplane.localdomain', u'fqdn_storage': u'compute-23.storage.localdomain', u'fqdn_canonical': u'compute-23.localdomain', u'fqdn_tenant': u'compute-23.tenant.localdomain'}, {u'fqdn_internal_api': u'compute-24.internalapi.localdomain', u'fqdn_ctlplane': u'compute-24.ctlplane.localdomain', u'fqdn_storage': u'compute-24.storage.localdomain', u'fqdn_canonical': u'compute-24.localdomain', u'fqdn_tenant': u'compute-24.tenant.localdomain'}, {u'fqdn_internal_api': u'compute-25.internalapi.localdomain', u'fqdn_ctlplane': u'compute-25.ctlplane.localdomain', u'fqdn_storage': u'compute-25.storage.localdomain', u'fqdn_canonical': u'compute-25.localdomain', u'fqdn_tenant': u'compute-25.tenant.localdomain'}, {u'fqdn_internal_api': u'compute-26.internalapi.localdomain', u'fqdn_ctlplane': u'compute-26.ctlplane.localdomain', u'fqdn_storage': u'compute-26.storage.localdomain', u'fqdn_canonical': u'compute-26.localdomain', u'fqdn_tenant': u'compute-26.tenant.localdomain'}, {u'fqdn_internal_api': u'compute-27.internalapi.localdomain', u'fqdn_ctlplane': u'compute-27.ctlplane.localdomain', u'fqdn_storage': u'compute-27.storage.localdomain', u'fqdn_canonical': u'compute-27.localdomain', u'fqdn_tenant': u'compute-27.tenant.localdomain'}, {u'fqdn_internal_api': u'compute-28.internalapi.localdomain', u'fqdn_ctlplane': u'compute-28.ctlplane.localdomain', u'fqdn_storage': u'compute-28.storage.localdomain', u'fqdn_canonical': u'compute-28.localdomain', u'fqdn_tenant': u'compute-28.tenant.localdomain'}, {u'fqdn_internal_api': u'compute-29.internalapi.localdomain', u'fqdn_ctlplane': u'compute-29.ctlplane.localdomain', u'fqdn_storage': u'compute-29.storage.localdomain', u'fqdn_canonical': u'compute-29.localdomain', u'fqdn_tenant': u'compute-29.tenant.localdomain'}].


The issue is caused by this patch:
https://review.opendev.org/#/c/695998/

These lines:
            if role_host_vars and server_role:
                servers_ansible_host_vars = [
                    v for k, v in server_role_vars.items()
                    if k.startswith(server)
                ]
                if len(servers_ansible_host_vars) > 1:
                    raise SystemError(
                        "Found multiple `{}`, which is unexpected. This means"
                        " that the FQDN of the selected device is either"
                        " wrong or is sharing a name with another host, which"
                        " is also wrong. Please correct this issue before"
                        " continuing. Return data can be found here"
                        " -> {}.".format(
                            server,
                            servers_ansible_host_vars
                        )
                    )
ine:

Comment 2 David Rosenfeld 2019-12-17 18:13:29 UTC
Verified: 

Executed regression job(which was reason for original commit):
https://rhos-qe-jenkins.rhev-ci-vms.eng.rdu2.redhat.com/view/DFG/view/df/view/controller_replacement/job/DFG-df-controller_replacement-16-virthost-3cont_3comp_3ceph-yes_UC_SSL-yes_OC_SSL-ceph-ipv4-geneve-replace_controller-corrupt_disk-RHELOSP-38495/7/

In addition checked with submitter and he stated: 

The problem I hit was fixed by this patch: https://code.engineering.redhat.com/gerrit/#/c/187649/ which is a revert of an earlier patch.

Above patch was committed to fix this bug.

Comment 6 errata-xmlrpc 2020-02-06 14:43:45 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2020:0283