[lxc-devel] [PATCH] hooks/ubuntu-cloud-prep: add hostname to meta-data

Serge Hallyn serge.hallyn at ubuntu.com
Thu Aug 22 14:13:15 UTC 2013


Quoting Scott Moser (smoser at ubuntu.com):
> prior to my enabling of the clone hook, the setting of the hostname
> was being done by writing to /etc/hostname.  Instead of relying on that
> we're now writing 'local-hostname' into the metadata for the instance.
> 
> cloud-init then reads this and sets the hostname properly.
> 
> The one caveat is that setting of the hostname then occurs after
> the initial dhcp, so the hostname sent in the dhcp request would be
> the original one.
> 
> Should this prove problematic (possibly for avahi dns) we can revert
> to explicitly writing the hostname into /etc/hostname as well.

Hi Scott,

this did manage to set the container name as hostname on first boot,
however apparently not in time for dhcp's send gethostname().  On
first boot, the parent dnsmasq couldn't resolve the hostname, but
after a reboot it could.

I don't mind applying the patch as is, but is that going to be a problem
for ubuntu-cloud users?

-serge




More information about the lxc-devel mailing list