Quoting Scott Moser (smo...@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. > > We are also writing /etc/hostname with the new hostname explicitly. This is > useful/necessary because on network bringup of eth0, dhclient will submit its > hosname. The updating done by cloud-init occurs to late, and thus > the dhcp request goes out with the un-configured hostname and dns doens't > work correctly. > > Signed-off-by: Scott Moser <smo...@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hal...@ubuntu.com> Thanks, Scott. -serge > --- > hooks/ubuntu-cloud-prep | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/hooks/ubuntu-cloud-prep b/hooks/ubuntu-cloud-prep > index c4c3620..f0b30ea 100755 > --- a/hooks/ubuntu-cloud-prep > +++ b/hooks/ubuntu-cloud-prep > @@ -49,8 +49,8 @@ prep() { > fi > > local cur="" next="" > - local userdata="" hostid="" authkey="" locales=1 cloud=0 name="" > - local create_etc_init=0 > + local userdata="" hostid="" authkey="" locales=1 cloud=0 > + local create_etc_init=0 name="ubuntucloud-lxc" > > while [ $# -ne 0 ]; do > cur="$1"; next="$2"; > @@ -97,6 +97,10 @@ prep() { > > local seed_d="" > seed_d="$root_d/var/lib/cloud/seed/nocloud-net" > + > + echo "$name" > "$root_d/etc/hostname" || > + { error "failed to write /etc/hostname"; return 1; } > + > if [ $cloud -eq 1 ]; then > debug 1 "--cloud provided, not modifying seed in '$seed_d'" > else > @@ -110,6 +114,9 @@ prep() { > echo "instance-id: lxc-$hostid" > "$seed_d/meta-data" || > { error "failed to write to $seed_d/meta-data"; return 1; } > > + echo "local-hostname: $name" >> "$seed_d/meta-data" || > + { error "failed to write to $seed_d/meta-data"; return 1; } > + > if [ -n "$authkey" ]; then > { > echo "public-keys:" && > -- > 1.8.3.2 > > > ------------------------------------------------------------------------------ > Introducing Performance Central, a new site from SourceForge and > AppDynamics. Performance Central is your source for news, insights, > analysis and resources for efficient Application Performance Management. > Visit us today! > http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk > _______________________________________________ > Lxc-devel mailing list > Lxc-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/lxc-devel ------------------------------------------------------------------------------ Introducing Performance Central, a new site from SourceForge and AppDynamics. Performance Central is your source for news, insights, analysis and resources for efficient Application Performance Management. Visit us today! http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk _______________________________________________ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel