← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1917681] [NEW] Unset hostname if image was created with the same hostname

 

Public bug reported:

The following issue is reproduced in Azure. If an image was created from
a VM with a particular name (say, for instance, 'hostname1') and then a
new VM is created from the image with setting the hostname as the same,
'hostname1', then this results in the hostname not being set at all.

I see the following in the cloud-init logs after creating the new VM:

2021-03-03 22:47:47,972 - util.py[DEBUG]: Read 77 bytes from /var/lib/cloud/data/set-hostname
2021-03-03 22:47:47,972 - cc_set_hostname.py[DEBUG]: No hostname changes. Skipping set-hostname

The contents of /var/lib/cloud/data/set-hostname have the old VM name in
it:

{
 "fqdn": "hostname1",
 "hostname": "hostname1"
}

So if I try to create a new VM from this image with the same hostname,
'hostname1', it sees it as no change because of this cached value. But
the reality is that the actual hostname of the VM at this point (and
after cloud-init runs) is 'localhost.localdomain'.

This behavior is not desired, as you should be able to create a VM from
an image that was created from a VM with the same hostname.

** Affects: cloud-init
     Importance: Undecided
         Status: New

-- 
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/1917681

Title:
  Unset hostname if image was created with the same hostname

Status in cloud-init:
  New

Bug description:
  The following issue is reproduced in Azure. If an image was created
  from a VM with a particular name (say, for instance, 'hostname1') and
  then a new VM is created from the image with setting the hostname as
  the same, 'hostname1', then this results in the hostname not being set
  at all.

  I see the following in the cloud-init logs after creating the new VM:

  2021-03-03 22:47:47,972 - util.py[DEBUG]: Read 77 bytes from /var/lib/cloud/data/set-hostname
  2021-03-03 22:47:47,972 - cc_set_hostname.py[DEBUG]: No hostname changes. Skipping set-hostname

  The contents of /var/lib/cloud/data/set-hostname have the old VM name
  in it:

  {
   "fqdn": "hostname1",
   "hostname": "hostname1"
  }

  So if I try to create a new VM from this image with the same hostname,
  'hostname1', it sees it as no change because of this cached value. But
  the reality is that the actual hostname of the VM at this point (and
  after cloud-init runs) is 'localhost.localdomain'.

  This behavior is not desired, as you should be able to create a VM
  from an image that was created from a VM with the same hostname.

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


Follow ups