Server host name limit

Bug #1564327 reported by Michal Jura
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Committed
Undecided
Unassigned

Bug Description

After launching AutoScalling heat template from
https://github.com/openstack/heat-templates/blob/master/hot/autoscaling.yaml
I discovered that on VM's with apache2 service cloud-init doesn't work. I looked into
/var/log/cloud-init.log and discovered following problem

2016-03-31T07:31:37.072553+00:00 host-192-168-123-80 [CLOUDINIT] util.py[DEBUG]: Running command ['hostnamectl', 'set-hostname', 'au-xph5-rvgrdsb5hcxc-47et3a5vvkrc-server-wyoz4elpdpe3.openstack.local'] with allowed return codes [0] (shell=False, capture=True)
2016-03-31T07:31:37.091567+00:00 host-192-168-123-80 [CLOUDINIT] util.py[WARNING]: Failed to set the hostname to au-xph5-rvgrdsb5hcxc-47et3a5vvkrc-server-wyoz4elpdpe3.openstack.local (au-xph5-rvgrdsb5hcxc-47et3a5vvkrc-server-wyoz4elpdpe3)
2016-03-31T07:31:37.098625+00:00 host-192-168-123-80 [CLOUDINIT] util.py[DEBUG]: Failed to set the hostname to au-xph5-rvgrdsb5hcxc-47et3a5vvkrc-server-wyoz4elpdpe3.openstack.local (au-xph5-rvgrdsb5hcxc-47et3a5vvkrc-server-wyoz4elpdpe3)#012Traceback (most recent call last):#012 File "/usr/lib/python2.7/site-packages/cloudinit/config/cc_set_hostname.py", line 33, in handle#012 cloud.distro.set_hostname(hostname, fqdn)#012 File "/usr/lib/python2.7/site-packages/cloudinit/distros/__init__.py", line 90, in set_hostname#012 self._write_hostname(writeable_hostname, self.hostname_conf_fn)#012 File "/usr/lib/python2.7/site-packages/cloudinit/distros/opensuse.py", line 157, in _write_hostname#012 util.subp(['hostnamectl', 'set-hostname', str(hostname)])#012 File "/usr/lib/python2.7/site-packages/cloudinit/util.py", line 1570, in subp#012 cmd=args)#012ProcessExecutionError: Unexpected error while running command.#012Command: ['hostnamectl', 'set-hostname', 'au-xph5-rvgrdsb5hcxc-47et3a5vvkrc-server-wyoz4elpdpe3.openstack.local']#012Exit code: 1#012Reason: -#012Stdout: ''#012Stderr: "Could not set property: Invalid static hostname 'au-xph5-rvgrdsb5hcxc-47et3a5vvkrc-server-wyoz4elpdpe3.openstack.'\n"
2016-03-31T07:31:37.099327+00:00 host-192-168-123-80 [CLOUDINIT] util.py[WARNING]: Running module set_hostname (<module 'cloudinit.config.cc_set_hostname' from '/usr/lib/python2.7/site-packages/cloudinit/config/cc_set_hostname.pyc'>) failed
2016-03-31T07:31:37.103119+00:00 host-192-168-123-80 [CLOUDINIT] util.py[DEBUG]: Running module set_hostname (<module 'cloudinit.config.cc_set_hostname' from '/usr/lib/python2.7/site-packages/cloudinit/config/cc_set_hostname.pyc'>) failed#012Traceback (most recent call last):#012 File "/usr/lib/python2.7/site-packages/cloudinit/stages.py", line 660, in _run_modules#012 cc.run(run_name, mod.handle, func_args, freq=freq)#012 File "/usr/lib/python2.7/site-packages/cloudinit/cloud.py", line 63, in run#012 return self._runners.run(name, functor, args, freq, clear_on_fail)#012 File "/usr/lib/python2.7/site-packages/cloudinit/helpers.py", line 197, in run#012 results = functor(*args)#012 File "/usr/lib/python2.7/site-packages/cloudinit/config/cc_set_hostname.py", line 33, in handle#012 cloud.distro.set_hostname(hostname, fqdn)#012 File "/usr/lib/python2.7/site-packages/cloudinit/distros/__init__.py", line 90, in set_hostname#012 self._write_hostname(writeable_hostname, self.hostname_conf_fn)#012 File "/usr/lib/python2.7/site-packages/cloudinit/distros/opensuse.py", line 157, in _write_hostname#012 util.subp(['hostnamectl', 'set-hostname', str(hostname)])#012 File "/usr/lib/python2.7/site-packages/cloudinit/util.py", line 1570, in subp#012 cmd=args)#012ProcessExecutionError: Unexpected error while running command.#012Command: ['hostnamectl', 'set-hostname', 'au-xph5-rvgrdsb5hcxc-47et3a5vvkrc-server-wyoz4elpdpe3.openstack.local']#012Exit code: 1#012Reason: -#012Stdout: ''#012Stderr: "Could not set property: Invalid static hostname 'au-xph5-rvgrdsb5hcxc-47et3a5vvkrc-server-wyoz4elpdpe3.openstack.'\n"
2016-03-31T07:31:37.103587+00:00 host-192-168-123-80 [CLOUDINIT] stages.py[DEBUG]: Running module update_hostname (<module 'cloudinit.config.cc_update_hostname' from '/usr/lib/python2.7/site-packages/cloudinit/config/cc_update_hostname.pyc'>) with frequency always
2016-03-31T07:31:37.103715+00:00 host-192-168-123-80 [CLOUDINIT] helpers.py[DEBUG]: Running config-update_hostname using lock (<cloudinit.helpers.DummyLock object at 0x7fc9b3a06050>)
2016-03-31T07:31:37.103837+00:00 host-192-168-123-80 [CLOUDINIT] cc_update_hostname.py[DEBUG]: Updating hostname to au-xph5-rvgrdsb5hcxc-47et3a5vvkrc-server-wyoz4elpdpe3.openstack.local (au-xph5-rvgrdsb5hcxc-47et3a5vvkrc-server-wyoz4elpdpe3)

I have configured dhcp_domain = openstack.local

When I tried manually run hostnamectl, I've got

hostnamectl set-hostname du-xfh5-rvgrdsb5hcxc-47et3a5vvkrc-server-wyoz4elpdpe3.openstack.local
Could not set property: Invalid static hostname 'du-xfh5-rvgrdsb5hcxc-47et3a5vvkrc-server-wyoz4elpdpe3.openstack.

So problem which I have found is that in

https://github.com/openstack/heat/blob/master/heat/engine/resources/openstack/nova/server.py#L563

    # Server host name limit to 53 characters by due to typical default
    # linux HOST_NAME_MAX of 64, minus the .novalocal appended to the name
    physical_resource_name_limit = 53

Probably we want to change this physical_resource_name_limit to 48 or even 32

Revision history for this message
lynxn0t (lynxn0t) wrote :

I'm also afflicted by this bug when using magnum heat templates to deploy kubernetes on fedora atomic.

In a more general way i think that heat resource naming should be under the control of the stack deployer. For instance deploying the magnum kubernetes template generates instances names as such :

k8-p4hiyps3s7-0-zgro74fzhiur-kube_master-gvwqbcfpn6kp

There are 3 different hashes in the composition of this name. If there was a way for me to specify the instance naming format i would end up with:

k8-bay-01-master-01

which is something that make sense to humans too. And its actually my CNAME in the DNS because i would never type the heat generated name or give that to a customer.

Moreover all testing is done with "novalocal" domain, but real deployments have different domains name that can be longer that "novalocal" which also affects the ability of hostnamectl to work properly. That is why i guess magnum dev team did not see this bug in their tests.

Revision history for this message
Nishad Shah (raigax9) wrote :

This fix have been committed back in April 15 2016 and is on the master branch and is on master.

Changed in heat:
status: New → Fix Committed
Rico Lin (rico-lin)
Changed in heat:
milestone: none → no-priority-tag-bugs
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.