Bug 1353920

Summary: Incorrect custom Hostname on some nodes
Product: Red Hat OpenStack Reporter: Dimitri Savineau <dsavinea>
Component: openstack-heatAssignee: Giulio Fidente <gfidente>
Status: CLOSED ERRATA QA Contact: Amit Ugol <augol>
Severity: high Docs Contact:
Priority: high    
Version: 8.0 (Liberty)CC: ahrechan, augol, cllewellyn, dbecker, dhill, gfidente, jmelvin, markmc, mburns, morazi, mschuppe, nalmond, ohochman, owalsh, rhel-osp-director-maint, rhos-maint, sbaker, shardy, skinjo, srevivo, zbitter
Target Milestone: asyncKeywords: ZStream
Target Release: 8.0 (Liberty)   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: openstack-heat-5.0.1-8.el7ost Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1368553 (view as bug list) Environment:
Last Closed: 2016-09-14 14:41:10 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:
Bug Depends On:    
Bug Blocks: 1368553    

Description Dimitri Savineau 2016-07-08 12:12:50 UTC
Description of problem:

Nodes with index [0-9] have hostname correctly mapped but not the others.

Version-Release number of selected component (if applicable):

OSPd 8
$ rpm -qa openstack-tripleo-heat-templates
openstack-tripleo-heat-templates-0.8.14-11.el7ost.noarch

How reproducible:

100%

Steps to Reproduce:

https://access.redhat.com/documentation/en/red-hat-openstack-platform/version-8/director-installation-and-usage/#sect-Controlling_Node_Placement

1. Tag node in ironic
2. Setup SchedulerHints
3. Setup HostnameMap
4. Deploy with more than 10 nodes in a profile

Actual results:

Deploying with 14 computes nodes

ironic node tag           |  nova hostname
------------------------------------------------------
overcloud-compute-[0-9]   :  mycompute-rack1-[1-10]
overcloud-compute-[10-13] :  mycompute-rack1-[20-23]

Expected results:

ironic node tag           |  nova hostname
------------------------------------------------------
overcloud-compute-[0-13]  :  mycompute-rack1-[1-14]

Additional info:

The controller and ceph nodes are fine (but only 3 nodes for each profile).
We can see the right HostnameMap in the stack of the compute nodes with the bad hostname

Comment 4 Steven Hardy 2016-07-08 12:33:05 UTC
We discussed this on IRC and after some investigation I realized this is due to a partial replacement, raised https://bugs.launchpad.net/tripleo/+bug/1600209

Details from there:

parameter_defaults:
  HostnameMap:
    overcloud-controller-0: foo-a123-n1
    overcloud-controller-1: foo-a123-n2
...
    overcloud-compute-12: foo-b123-n13

In this situation, the str_replace in puppet/compute.yaml does a partial replacement of "overcloud-compute-12" so it ends up being "foo-a123-n22", which is clearly not what the author of the hostname map intended.

A workaround for this is probably to add a trailing character to the HostnameFormat parameter, e.g:

parameter_defaults:
  ComputeHostnameFormat: '%stackname%-novacompute-%index%X'
  HostnameMap:
    overcloud-controller-0X: foo-a123-n1
    overcloud-controller-1X: foo-a123-n2
...
    overcloud-compute-12X: foo-b123-n13

It'd be better if we could handle this inside the templates though and I'm thinking about the best way to achieve that.

Comment 5 Mark McLoughlin 2016-08-11 14:30:04 UTC
*** Bug 1354573 has been marked as a duplicate of this bug. ***

Comment 6 Zane Bitter 2016-08-12 19:27:31 UTC
Giulio's upstream patch to Heat (linked above) looks like it should resolve the issue and be a fairly safe candidate for backporting once upstream reviews are complete.

Comment 7 Mark McLoughlin 2016-08-16 11:16:52 UTC
https://review.openstack.org/354856 merged and should be a good candidate for backporting, according to Zane above

Comment 8 Giulio Fidente 2016-08-16 13:59:02 UTC
Submitted ports to mitaka and liberty, linked liberty port from BZ

Comment 9 Zane Bitter 2016-08-19 17:31:34 UTC
Upstream backports have merged.

Comment 25 errata-xmlrpc 2016-09-14 14:41:10 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://rhn.redhat.com/errata/RHBA-2016-1871.html

Comment 27 Artem Hrechanychenko 2018-04-18 17:35:02 UTC
weren't reproduce in OSP13

(undercloud) [stack@undercloud-0 ~]$ ironic node-list
The "ironic" CLI is deprecated and will be removed in the S* release. Please use the "openstack baremetal" CLI instead.
/usr/lib/python2.7/site-packages/requests/packages/urllib3/connection.py:344: SubjectAltNameWarning: Certificate for 192.168.24.2 has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/shazow/urllib3/issues/497 for details.)
  SubjectAltNameWarning
/usr/lib/python2.7/site-packages/requests/packages/urllib3/connection.py:344: SubjectAltNameWarning: Certificate for 192.168.24.2 has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/shazow/urllib3/issues/497 for details.)
  SubjectAltNameWarning
+--------------------------------------+--------------+---------------+-------------+--------------------+-------------+
| UUID                                 | Name         | Instance UUID | Power State | Provisioning State | Maintenance |
+--------------------------------------+--------------+---------------+-------------+--------------------+-------------+
| 6d14a163-6188-4651-be31-a5946a39bd39 | compute-0    | None          | power off   | available          | False       |
| a1412bc1-5cc8-45ba-a48b-76b034672327 | compute-1    | None          | power off   | available          | False       |
| 3645103e-2a0a-4e2d-a3c7-a8617414d248 | compute-10   | None          | power off   | available          | False       |
| 243a05c1-e6be-4036-8789-f9296775b7ac | compute-11   | None          | power off   | available          | False       |
| eb8b1db4-f3aa-4fdc-b6ae-0048ff582f27 | compute-12   | None          | power off   | available          | False       |
| d81b743f-f620-4c72-a0b3-fdd17adc33f0 | compute-2    | None          | power off   | available          | False       |
| 74985c9b-7057-436e-b2f5-2011c367ed65 | compute-3    | None          | power off   | available          | False       |
| 8ff208f8-b91e-4220-8f57-9ea86f21c483 | compute-4    | None          | power off   | available          | False       |
| 90e78973-fa17-421c-b1ee-f7be1dbd967b | compute-5    | None          | power off   | available          | False       |
| a1faca21-e271-4224-97d8-68b7e3e4cc32 | compute-6    | None          | power off   | available          | False       |
| b01648d8-3510-4924-b601-aec172d429b4 | compute-7    | None          | power off   | available          | False       |
| 5c518d12-12f6-47c7-943d-07f366e4ac1c | compute-8    | None          | power off   | available          | False       |
| 02ced649-afcb-4acf-b7d3-4529843fd1c8 | compute-9    | None          | power off   | available          | False       |
| 7d39ff0a-3806-491d-88d1-663cf0d6dca8 | controller-0 | None          | power off   | available          | False       |
+--------------------------------------+--------------+---------------+-------------+--------------------+-------------+
(undercloud) [stack@undercloud-0 ~]$ nova list
/usr/lib/python2.7/site-packages/requests/packages/urllib3/connection.py:344: SubjectAltNameWarning: Certificate for 192.168.24.2 has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/shazow/urllib3/issues/497 for details.)
  SubjectAltNameWarning
/usr/lib/python2.7/site-packages/requests/packages/urllib3/connection.py:344: SubjectAltNameWarning: Certificate for 192.168.24.2 has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/shazow/urllib3/issues/497 for details.)
  SubjectAltNameWarning
+----+------+--------+------------+-------------+----------+
| ID | Name | Status | Task State | Power State | Networks |
+----+------+--------+------------+-------------+----------+
+----+------+--------+------------+-------------+----------+
(undercloud) [stack@undercloud-0 ~]$ nova list
/usr/lib/python2.7/site-packages/requests/packages/urllib3/connection.py:344: SubjectAltNameWarning: Certificate for 192.168.24.2 has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/shazow/urllib3/issues/497 for details.)
  SubjectAltNameWarning
/usr/lib/python2.7/site-packages/requests/packages/urllib3/connection.py:344: SubjectAltNameWarning: Certificate for 192.168.24.2 has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/shazow/urllib3/issues/497 for details.)
  SubjectAltNameWarning
+--------------------------------------+-----------------+--------+------------+-------------+------------------------+
| ID                                   | Name            | Status | Task State | Power State | Networks               |
+--------------------------------------+-----------------+--------+------------+-------------+------------------------+
| ae13333a-fe51-4c80-9348-3d2c8d90ed73 | ctrl-0          | ACTIVE | -          | Running     | ctlplane=192.168.24.14 |
| 414d24be-d833-4369-a18c-299085efe499 | test_compute-00 | BUILD  | spawning   | NOSTATE     | ctlplane=192.168.24.23 |
| fd2a35c6-eba6-4ddf-b055-c102e08cebf7 | test_compute-01 | BUILD  | spawning   | NOSTATE     | ctlplane=192.168.24.22 |
| 12ce919a-1903-4983-a712-a5acc955e395 | test_compute-02 | ACTIVE | -          | Running     | ctlplane=192.168.24.12 |
| 7e501818-daed-4771-be72-4bcfbb5e13f7 | test_compute-03 | BUILD  | scheduling | NOSTATE     |                        |
| e22fec0f-bf59-43da-a14a-bd4ff53ae5e3 | test_compute-04 | BUILD  | scheduling | NOSTATE     |                        |
| 2e88847b-8937-4d04-847d-66f3be823c43 | test_compute-05 | BUILD  | scheduling | NOSTATE     |                        |
| 205e447e-465b-46aa-84ee-5cff1ab5fbd6 | test_compute-06 | ACTIVE | -          | Running     | ctlplane=192.168.24.11 |
| 2e3d6656-dcd3-4f88-9166-00e8b69db99b | test_compute-07 | BUILD  | spawning   | NOSTATE     | ctlplane=192.168.24.18 |
| 6a084974-939e-4f21-b34b-37cb0e9760c7 | test_compute-08 | ACTIVE | -          | Running     | ctlplane=192.168.24.15 |
| 3795f5db-5c70-4749-bd75-3d58654a8bfe | test_compute-09 | BUILD  | scheduling | NOSTATE     |                        |
| 3f9eafd0-9e9a-4740-9c93-615cad7ac879 | test_compute-10 | BUILD  | spawning   | NOSTATE     | ctlplane=192.168.24.7  |
| b7122211-68e0-48db-b250-47f9f440a87b | test_compute-11 | ACTIVE | -          | Running     | ctlplane=192.168.24.16 |
| 85ae8ecc-0c2c-477b-a63d-ab9645ecfb4f | test_compute-12 | BUILD  | spawning   | NOSTATE     | ctlplane=192.168.24.19 |


(undercloud) [stack@undercloud-0 ~]$ cat virt/custom_hostnames.yaml 
parameter_defaults:
  HostnameMap:
    controller-0: ctrl-0
    compute-0: test_compute-00
    compute-1: test_compute-01
    compute-2: test_compute-02
    compute-3: test_compute-03
    compute-4: test_compute-04
    compute-5: test_compute-05
    compute-6: test_compute-06
    compute-7: test_compute-07
    compute-8: test_compute-08
    compute-9: test_compute-09
    compute-10: test_compute-10
    compute-11: test_compute-11
    compute-12: test_compute-12

(undercloud) [stack@undercloud-0 ~]$ cat overcloud_deploy.sh 
#!/bin/bash

openstack overcloud deploy \
--timeout 100 \
--templates /usr/share/openstack-tripleo-heat-templates \
--stack overcloud \
--libvirt-type kvm \
--ntp-server clock.redhat.com \
-e /home/stack/virt/config_lvm.yaml \
-e /usr/share/openstack-tripleo-heat-templates/environments/network-isolation.yaml \
-e /home/stack/virt/network/network-environment.yaml \
-e /home/stack/virt/inject-trust-anchor.yaml \
-e /home/stack/virt/hostnames.yml \
-e /home/stack/virt/debug.yaml \
-e /home/stack/virt/custom_hostnames.yaml \
-e /home/stack/virt/nodes_data.yaml \
-e /home/stack/virt/docker-images.yaml \
--log-file overcloud_deployment_26.log

Comment 28 Red Hat Bugzilla 2023-09-14 03:27:46 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 1000 days