[nova] How to update OS-EXT-SRV-ATTR:hostname
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.
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, Cheers, Thomas Goirand (zigo)
On Tue, 2021-12-07 at 11:53 +0100, Thomas Goirand wrote:
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,
Cheers,
Thomas Goirand (zigo)
To add to this, there's no way to change the hostname embedded in the instance metadata until Xena, when we added the ability to provide a 'hostname' parameter when creating, updating or rebuilding servers (microversion 2.90). See [1] and [2] for more details. Stephen [1]https://docs.openstack.org/nova/latest/reference/api-microversion-history.ht... [2]https://specs.openstack.org/openstack/nova-specs/specs/xena/implemented/conf...
Thanks for info about Xena API abilities. At the moment we ended up with making changed directly to Nova DB 🙁 ________________________________ From: Stephen Finucane <stephenfin@redhat.com> Sent: Tuesday, December 7, 2021 12:30 PM To: Thomas Goirand <zigo@debian.org>; Kamil Madáč <kamil.madac@slovenskoit.sk>; openstack-discuss <openstack-discuss@lists.openstack.org> Subject: Re: [nova] How to update OS-EXT-SRV-ATTR:hostname On Tue, 2021-12-07 at 11:53 +0100, Thomas Goirand wrote:
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,
Cheers,
Thomas Goirand (zigo)
To add to this, there's no way to change the hostname embedded in the instance metadata until Xena, when we added the ability to provide a 'hostname' parameter when creating, updating or rebuilding servers (microversion 2.90). See [1] and [2] for more details. Stephen [1]https://docs.openstack.org/nova/latest/reference/api-microversion-history.ht... [2]https://specs.openstack.org/openstack/nova-specs/specs/xena/implemented/conf...
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. Kamil ________________________________ From: Thomas Goirand <zigo@debian.org> Sent: Tuesday, December 7, 2021 11:53 AM To: Kamil Madáč <kamil.madac@slovenskoit.sk>; openstack-discuss <openstack-discuss@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, Cheers, Thomas Goirand (zigo)
participants (3)
-
Kamil Madáč
-
Stephen Finucane
-
Thomas Goirand