Hi Sean,

please, see below

30.01.20 00:17, Sean Mooney пише:
On Wed, 2020-01-29 at 16:44 +0200, Volodymyr Litovka wrote:
Dear colleagues,

I'm using DNS Integration and just faced an issue - after renaming
instance, I can't bind port to the instance using new name:

1) I've created intances with name 'devel'
2) then I renamed it to devel ((openstack server set --name packager devel)
3) when binding port with dns_name using new name ('packager' in my
case), the following error appear:
ERROR nova.api.openstack.wsgi PortNotUsableDNS: Port
c3a92cf6-b49b-4570-b69b-0c23af1d1f94 not usable for instance
6aa78bd5-099e-4878-a5ac-90262505a924. Value packager assigned to
dns_name attribute does not match instance's hostname devel

and yes, record in DB still uses an old hostname:

mysql> select display_name from instances where hostname='devel';
+--------------+
display_name |
+--------------+
packager     |
+--------------+
1 row in set (0.00 sec)


and hostname remains the same (initial) regardless of any changes to
display_name.

I'm on Rocky. Is it bug or feature and are there ways to work around this?
i think you should be able to change the display name but i would not expect that display name to change
the host name used by the guest. it is likely a bug that the portbinding appears to be using the displayname
for designate integration. 

The issue is that portbinding compares NOT the "display_port", but "hostname" column to port's dns_name,  and this lead to the described above issue, i.e.

mysql> select hostname, display_name from instances where uuid='2d49b781-cef5-4cdd-a310-e74eb98aa514';
+----------+--------------+
| hostname | display_name |
+----------+--------------+
| web01    | web02        |
+----------+--------------+

$ openstack port create --network e-net --dns-name web02 --fixed-ip subnet=e-bed testport
+-----------------------+-------
| Field                 | Value
+-----------------------+-------
| dns_assignment        | fqdn='web02.loc.', hostname='web02', ip_address='x.x.x.x'
| dns_domain            |
| dns_name              | web02
| id                    | 0425701f-d958-4c81-931a-9594fba7d7d2
+-----------------------+-------

$ nova interface-attach --port-id 0425701f-d958-4c81-931a-9594fba7d7d2 web02
ERROR (ClientException): Unexpected API Error.

the core issue behind this is that if user renamed server and still want to access it using name, he can't

i know we use the display name as the hostname for the vm by default but
i would not expect openstack server set --name packager devel to alter the hostname served to the vm over dhcp
once the vm is intially created. i would expect to be able to alther that via designate and for the display name to be
independt of the host name after the inital boot.

so yes there is likely a bug in that we are using the disply name somewhere we shoudl not be.

https://bugs.launchpad.net/nova/+bug/1861401

Either renaming instance need to change both "hostname" and "display_name" columns or DNS integration need compare port's dns_name with "display_name".

Thank you.

--
Volodymyr Litovka
  "Vision without Execution is Hallucination." -- Thomas Edison