Renaming instance brokes DNS integration
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Opinion
|
Low
|
Unassigned | ||
neutron |
Invalid
|
Undecided
|
Unassigned |
Bug Description
Colleagues,
Description
===========
Renaming instance (e.g. using "openstack server set --name") brokes DNS integration, since it makes it impossible to bind port with new instance's name. So, if user renamed instance and want to access it using name, he can not.
Steps to reproduce
==================
1) You have an instance with some name (e.g. "web01")
2) You rename it using "openstack server set --name web02 web01"
3) You create port with instance's new name (e.g. web02) in order to attach it to the instance
$ openstack port create --network e-net --fixed-ip subnet=e-subnet --dns-name web02 test_port
4) You're trying to attach the port to the instance:
$ nova interface-attach --port-id <uuid> web02
Expected result
===============
Port binds to the instance and instance can be accessed using hostname "web02"
Actual result
=============
Last command in steps above fails with the following message:
ERROR (ClientException): Unexpected API Error. Please report this at http://
Nova log says the following:
2020-01-30 11:43:32.652 17476 ERROR nova.api.
MySQL content show that renaming instance changed column "display_name", but "hostname" remained with old name:
mysql> select hostname, display_name from instances where uuid='2d49b781-
+------
| hostname | display_name |
+------
| web01 | web02 |
+------
Thus, DNS integration compares port's dns_name to "hostname" not the "display_name", which makes it unusable after renaming instance. Either renaming instance need to change both "hostname" and "display_name" columns or DNS integration need compare port's dns_name with "display_name".
Environment
===========
Host OS: Ubuntu 18.04 LTS
Openstack: Rocky
$ dpkg -l |grep nova
ii nova-api 2:18.2.
ii nova-common 2:18.2.
ii nova-conductor 2:18.2.
ii nova-novncproxy 2:18.2.
ii nova-placement-api 2:18.2.
ii nova-scheduler 2:18.2.
ii python-nova 2:18.2.
ii python-novaclient 2:11.0.
Thank you.
Colleagues,
FYI
changing single line in (for Rocky) nova/network/ neutronv2/ api.py:
--- nova/network/ neutronv2/ api.py. orig 2020-02-04 08:32:33.305779575 +0000 neutronv2/ api.py 2020-02-04 08:32:50.445688233 +0000
# dns_name attribute, it is equal to the instance's
# hostname
if port.get( 'dns_name' ): display_ name:
raise exception. PortNotUsableDN S(
port_ id=request. port_id,
instance= instance. uuid, value=port[ 'dns_name' ],
+++ nova/network/
@@ -728,7 +728,7 @@
- if port['dns_name'] != instance.hostname:
+ if port['dns_name'] != instance.
did the job. Same piece of code is present in current master at nova/network/ neutron. py
I can submit the patch, but just don't know whether this approach will/will not break something else. It seems, no; but if anybody can clarify, it will be great.
Thank you.