Bug 1368553

Summary: Incorrect custom Hostname on some nodes
Product: Red Hat OpenStack Reporter: Zane Bitter <zbitter>
Component: openstack-heatAssignee: Zane Bitter <zbitter>
Status: CLOSED ERRATA QA Contact: Amit Ugol <augol>
Severity: high Docs Contact:
Priority: high    
Version: 9.0 (Mitaka)CC: agurenko, augol, dbecker, dsavinea, gfidente, jjoyce, jmelvin, markmc, mburns, mcornea, morazi, nalmond, rhel-osp-director-maint, rhos-maint, sbaker, shardy, srevivo, zbitter
Target Milestone: asyncKeywords: ZStream
Target Release: 9.0 (Mitaka)   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: openstack-heat-6.0.0-11.el7ost Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1353920 Environment:
Last Closed: 2016-09-21 14:08:46 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: 1353920    
Bug Blocks:    

Description Zane Bitter 2016-08-19 17:35:03 UTC
+++ This bug was initially created as a clone of Bug #1353920 +++

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

--- Additional comment from Steven Hardy on 2016-07-08 08:33:05 EDT ---

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.

--- Additional comment from Mark McLoughlin on 2016-08-11 10:30:04 EDT ---



--- Additional comment from Zane Bitter on 2016-08-12 15:27:31 EDT ---

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.

--- Additional comment from Mark McLoughlin on 2016-08-16 07:16:52 EDT ---

https://review.openstack.org/354856 merged and should be a good candidate for backporting, according to Zane above

--- Additional comment from Giulio Fidente on 2016-08-16 09:59:02 EDT ---

Submitted ports to mitaka and liberty, linked liberty port from BZ

--- Additional comment from Zane Bitter on 2016-08-19 13:31:34 EDT ---

Upstream backports have merged.

Comment 3 Amit Ugol 2016-09-19 15:56:45 UTC
Original issue was resolved

Comment 5 errata-xmlrpc 2016-09-21 14:08:46 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-1917.html