← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1998640] Re: set_hostname does not set the hostname before the initial DHCP communication

 

[Expired for cloud-init because there has been no activity for 60 days.]

** Changed in: cloud-init
       Status: Incomplete => Expired

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1998640

Title:
  set_hostname does not set the hostname before the initial DHCP
  communication

Status in cloud-init:
  Expired

Bug description:
  Per the
  doc(https://cloudinit.readthedocs.io/en/22.3.4/topics/modules.html#set-
  hostname), with the cloud-config below, when using "fqdn" or
  "hostname", the desired hostname should be set before the initial DHCP
  communication so that DDNS can update the DNS record with the proper
  hostname.  This is not happening in our environment. "ubuntu" is sent
  to the DNS server instead of the  new hostname of the guest.

  The DNS does get updated after we reboot the guest a second time.  We
  have added a workaround for the 2nd reboot(see below power_state). I
  have also added the kead dhcp4 logs showing the behavior.

  My issue is similar to:
  Bug #1600766  status:	Confirmed → Won't Fix
  Bug #1746455 status:    Fixed Released

  
  #Environment Info
  Hypervisor: KVM
  Hypervisor OS: Red Hat Enterprise Linux 8.6
  Guest OS:Ubuntu 22.04.1 LTS
  cloud-init --version: /usr/bin/cloud-init 22.3.4-0ubuntu1~22.04.1
  Data Source: nocloud

  #cloud-config
  preserve_hostname: false
  fqdn: ${ guest_hostname }.${ guest_subdomain }.test.lan
  prefer_fqdn_over_hostname: true
  users:
    - name: name
      plain_text_passwd: password
      sudo: ALL=(ALL) NOPASSWD:ALL
      groups: adm, sys
      home: /home/name
      shell: /bin/bash
      lock_passwd: false
      ssh_authorized_keys:
        - ${ key }
  ssh_pwauth: true
  #Workaround. Reboot guest so DNS record gets updated with the guest hostname instead of ubuntu
  power_state:
      delay: now
      mode: reboot
      message: Rebooting machine

  
  #set hostname document stating "desired hostname is applied before any DHCP requests are performed"
  "This will occur on datasources like nocloud and ovf where metadata and user data are available locally. This ensures that the desired hostname is applied before any DHCP requests are performed on these platforms where dynamic DNS is based on initial hostname."

  #kea dhcp4 logs:
  /var/lib/kea # grep 52:54:00:ca:dd:19 *
  dhcp4.leases:10.61.229.229,52:54:00:ca:dd:19,ff:b5:5e:67:ff:00:02:00:00:ab:11:2b:2f:f0:f1:3d:27:d9:a1,43200,1670044228,5,1,1,ubuntu.061asd.zebra.lan,0,            #1st boot with default "ubuntu" hostname
  dhcp4.leases:10.61.229.229,52:54:00:ca:dd:19,ff:b5:5e:67:ff:00:02:00:00:ab:11:2b:2f:f0:f1:3d:27:d9:a1,0,1670001028,5,1,1,ubuntu.061asd.zebra.lan,0,		   #Release is sent when reboot is initiated on guest, valid_lifetime set to 0
  dhcp4.leases:10.61.229.230,52:54:00:ca:dd:19,ff:b5:5e:67:ff:00:02:00:00:ab:11:2b:2f:f0:f1:3d:27:d9:a1,43200,1670044253,5,1,1,p061u004.061asd.zebra.lan.,0,	   #2nd boot sends proper hostname to register to DNS

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1998640/+subscriptions



References