[nova] How to update OS-EXT-SRV-ATTR:hostname

Kamil Madáč kamil.madac at slovenskoit.sk
Mon Dec 13 13:00:58 UTC 2021

Thanks for suggestion, but changes in /etc/cloud/cloud.cfg are reverted during VM rebuild, so this is probably not the solution for or issue.

From: Thomas Goirand <zigo at debian.org>
Sent: Tuesday, December 7, 2021 11:53 AM
To: Kamil Madáč <kamil.madac at slovenskoit.sk>; openstack-discuss <openstack-discuss at lists.openstack.org>
Subject: Re: [nova] How to update OS-EXT-SRV-ATTR:hostname

On 12/7/21 11:20 AM, Kamil Madáč wrote:
> Hello,
> I would like to ask, how to update OS-EXT-SRV-ATTR:hostname via
> openstack CLI? We changed hostnames on bunch of instances, but metadata
> service still serves old hostname which causes that every future rebuild
> of instance reverts hostname (`hostname` command in instance console)
> back to old one.
> Kamil Madáč
> /Slovensko IT a.s./

Looks like what you want to do is disable cloud-init editing of your VM
hostname. This is done simply by cloud-init to stop doing this. Simply
edit /etc/cloud/cloud.cfg and set:

preserve_hostname: true

or remove any cloud-init module from the "cloud_init_modules:" list.
Simply remove the lines containing:
- set_hostname
- update_hostname
- update_etc_hosts

I hope this helps,


Thomas Goirand (zigo)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-discuss/attachments/20211213/37094341/attachment-0001.htm>

More information about the openstack-discuss mailing list