Bug 1371685

Summary: When using HostnameMap with more than 9 computes, hostnames are not properly set
Product: Red Hat OpenStack Reporter: David Hill <dhill>
Component: openstack-tripleo-heat-templatesAssignee: Jiri Stransky <jstransk>
Status: CLOSED CURRENTRELEASE QA Contact: Arik Chernetsky <achernet>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.0 (Liberty)CC: aschultz, dhill, jslagle, mburns, rhel-osp-director-maint, shardy, zbitter
Target Milestone: ---Keywords: Triaged
Target Release: 10.0 (Newton)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-07-28 17:32:37 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 David Hill 2016-08-30 19:43:57 UTC
Description of problem:
When using HostnameMap with more than 9 computes, hostnames are not properly set and this is due to the use of str_replace in /usr/share/openstack-tripleo-heat-templates/puppet/compute.yaml:

  NovaCompute:
    type: OS::Nova::Server
    properties:
      image:
        {get_param: Image}
      image_update_policy:
        get_param: ImageUpdatePolicy
      flavor: {get_param: Flavor}
      key_name: {get_param: KeyName}
      networks:
        - network: ctlplane
      user_data_format: SOFTWARE_CONFIG
      user_data: {get_resource: UserData}
      name:
        str_replace:
            template: {get_param: Hostname}
            params: {get_param: HostnameMap}


So as soon as you hit compute 10-19, it will always replace the first part of the string with the first node in the HostnameMap...  The effect here is that you end up with 0-9 at the end of the string instead of having the proper hostname in the HostnameMap.


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


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Steven Hardy 2016-08-31 17:55:40 UTC
I think this is a duplicate of https://bugzilla.redhat.com/show_bug.cgi?id=1353920 ?

Comment 2 David Hill 2016-09-01 16:17:30 UTC
Nope... it's not the same issue.  If the value is to similar to the key, this breaks.  The other case solves one specific corner case but look at this one:

1) When the first compute his deployed, it replaces all the strings in that array so 
  HostnameMap:
    whatever-CTLR0: whatever-CTLR0-wa1614
    whatever-CTLR1: whatever-CTLR1-wa1514
    whatever-CTLR2: whatever-CTLR2-wa0112
    whatever-COMP0: whatever-COMP0-wa0001
    whatever-COMP1: whatever-COMP1-wa1101
    whatever-COMP2: whatever-COMP2-wa0002
    whatever-COMP3: whatever-COMP3-wa1102
    whatever-COMP4: whatever-COMP4-wa0003
    whatever-COMP5: whatever-COMP5-wa1103
    whatever-COMP6: whatever-COMP6-wa0004
    whatever-COMP7: whatever-COMP7-wa1104
    whatever-COMP8: whatever-COMP8-wa0005
    whatever-COMP9: whatever-COMP9-wa1105
    whatever-COMP10: whatever-COMP10-wa0006
    whatever-COMP11: whatever-COMP11-wa1106
    whatever-COMP12: whatever-COMP12-wa0007

becomes:
  HostnameMap:
    whatever-CTLR0: whatever-CTLR0-wa1614
    whatever-CTLR1: whatever-CTLR1-wa1514
    whatever-CTLR2: whatever-CTLR2-wa0112
    whatever-COMP0: whatever-COMP0-wa0001
    whatever-COMP1: whatever-COMP1-wa1101
    whatever-COMP2: whatever-COMP2-wa0002
    whatever-COMP3: whatever-COMP3-wa1102
    whatever-COMP4: whatever-COMP4-wa0003
    whatever-COMP5: whatever-COMP5-wa1103
    whatever-COMP6: whatever-COMP6-wa0004
    whatever-COMP7: whatever-COMP7-wa1104
    whatever-COMP8: whatever-COMP8-wa0005
    whatever-COMP9: whatever-COMP9-wa1105
    whatever-COMP10: whatever-COMP1-wa11010-wa0006
    whatever-COMP11: whatever-COMP1-wa11011-wa1106
    whatever-COMP12: whatever-COMP1-wa11012-wa0007

Comment 7 Zane Bitter 2017-07-28 17:32:37 UTC
Yeah, this is fixed in OSP10 by https://review.openstack.org/#/c/355583/