Bug 2079935 - Upgrade [OSP16.2 -> OSP17.1] - Adopting deployed nodes fail when ironic node names and hostname use the same format.
Summary: Upgrade [OSP16.2 -> OSP17.1] - Adopting deployed nodes fail when ironic node ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: tripleo-ansible
Version: 17.1 (Wallaby)
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ga
: 17.1
Assignee: Steve Baker
QA Contact: James E. LaBarre
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-04-28 14:44 UTC by Juan Badia Payno
Modified: 2023-08-16 01:11 UTC (History)
6 users (show)

Fixed In Version: tripleo-ansible-3.3.1-0.20220519231828.5e0485e.el8ost
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-08-16 01:11:06 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
OpenStack Storyboard 2010018 0 None None None 2022-04-28 18:10:08 UTC
OpenStack gerrit 840262 0 None MERGED Use instance_info.display_name for existing hostname matching 2022-05-18 22:02:14 UTC
Red Hat Issue Tracker OSP-14941 0 None None None 2022-04-28 16:44:02 UTC
Red Hat Product Errata RHEA-2023:4577 0 None None None 2023-08-16 01:11:35 UTC

Description Juan Badia Payno 2022-04-28 14:44:23 UTC
After upgrading the undercloud to osp17, the command "metalsmith list" does not show the correct values for the hostname

These mismatch leads to an error later on when we tried to provision the nodes:
The following error showed:
"msg": "An allocation with the requested hostname controller-0 already exists. Refusing to proceed to avoid confusing results. Please either change the node name or use a different hostname"


On the undercloud osp17, the metalsmith output:

(undercloud) [stack@undercloud-0 ~]$ metalsmith list
+--------------------------------------+--------------+-----------------+--------------+--------+------------------------+                                                                                                                   
| UUID                                 | Node Name    | Allocation UUID | Hostname     | State  | IP Addresses           |                                                                                                                   
+--------------------------------------+--------------+-----------------+--------------+--------+------------------------+                                                                                                                   
| 018035f5-7d05-40e8-8680-89653edfce0d | ceph-0       |                 | ceph-0       | ACTIVE | ctlplane=192.168.24.52 |                                                                                                                   
| 6bbbc832-1fc1-46b5-9e2b-b8a928b8cbad | ceph-1       |                 | ceph-1       | ACTIVE | ctlplane=192.168.24.9  |                                                                                                                   
| be4fc1a9-dbc4-4af6-b632-d26db6478a6f | ceph-2       |                 | ceph-2       | ACTIVE | ctlplane=192.168.24.7  |                                                                                                                   
| 0e9901bd-51b3-496c-b21a-6d0ce4f0b67e | compute-0    |                 | compute-0    | ACTIVE | ctlplane=192.168.24.15 |                                                                                                                   
| 01148020-d1d4-40ae-b4a6-d62d442ed6fb | compute-1    |                 | compute-1    | ACTIVE | ctlplane=192.168.24.45 |                                                                                                                   
| 9dcff2a4-ca88-4206-80a4-414227195792 | controller-0 |                 | controller-0 | ACTIVE | ctlplane=192.168.24.31 |                                                                                                                   
| 41424ef7-3c4b-4418-b9d2-e75e79bebdbd | controller-1 |                 | controller-1 | ACTIVE | ctlplane=192.168.24.14 |                                                                                                                   
| 99680e74-e327-4689-be65-ea5ad54d4482 | controller-2 |                 | controller-2 | ACTIVE | ctlplane=192.168.24.21 |                                                                                                                   
+--------------------------------------+--------------+-----------------+--------------+--------+------------------------+                                                                                                                   

(osp17 undercloud) an "allocations" are empty:
(undercloud) [stack@undercloud-0 ~]$ openstack baremetal allocation list
/usr/lib64/python3.6/site-packages/_yaml/__init__.py:23: DeprecationWarning: The _yaml extension module is now located at yaml._yaml and its location is subject to change.  To use the LibYAML-based parser and emitter, import from `yaml`:
`from yaml import CLoader as Loader, CDumper as Dumper`.
  DeprecationWarning
/usr/lib/python3.6/site-packages/barbicanclient/__init__.py:61: UserWarning: The secrets module is moved to barbicanclient/v1 directory, direct import of barbicanclient.secrets will be deprecated. Please import barbicanclient.v1.secrets instead.
  % (name, name, name))



On OSP16.2 the baremetal node list was:

(undercloud) [stack@undercloud-0 ~]$ openstack baremetal node list 
/usr/lib64/python3.6/site-packages/_yaml/__init__.py:23: DeprecationWarning: The _yaml extension module is now located at yaml._yaml and its location is subject to change.  To use the LibYAML-based parser and emitter, import from `yaml`: `from yaml import CLoader as Loader, CDumper as Dumper`.
  DeprecationWarning
+--------------------------------------+--------------+--------------------------------------+-------------+--------------------+-------------+
| UUID                                 | Name         | Instance UUID                        | Power State | Provisioning State | Maintenance |
+--------------------------------------+--------------+--------------------------------------+-------------+--------------------+-------------+
| 018035f5-7d05-40e8-8680-89653edfce0d | ceph-0       | a2b2a54b-eb04-4653-b824-924d1374c523 | power on    | active             | False       |
| 6bbbc832-1fc1-46b5-9e2b-b8a928b8cbad | ceph-1       | 877292a2-4810-4199-ac84-c7d2f21bf0c1 | power on    | active             | False       |
| be4fc1a9-dbc4-4af6-b632-d26db6478a6f | ceph-2       | ac45b6a3-e763-463d-a456-4f56700c3608 | power on    | active             | False       |
| 0e9901bd-51b3-496c-b21a-6d0ce4f0b67e | compute-0    | 070e68b2-8ff2-468f-b4d3-b6c46dd43195 | power on    | active             | False       |
| 01148020-d1d4-40ae-b4a6-d62d442ed6fb | compute-1    | bcb0e4b6-e2ea-41f4-8aa8-381776ceca70 | power on    | active             | False       |
| 9dcff2a4-ca88-4206-80a4-414227195792 | controller-0 | e4bab1da-06e1-49c9-8139-e7f023f4a07a | power on    | active             | False       |
| 41424ef7-3c4b-4418-b9d2-e75e79bebdbd | controller-1 | 5400fa38-7489-451b-b94c-6f97409df03e | power on    | active             | False       |
| 99680e74-e327-4689-be65-ea5ad54d4482 | controller-2 | 256c64bf-d6e4-4ced-b3c8-ea33a0684bb7 | power on    | active             | False       |
+--------------------------------------+--------------+--------------------------------------+-------------+--------------------+-------------+

and the server list:

(undercloud) [stack@undercloud-0 ~]$ openstack server list 
/usr/lib64/python3.6/site-packages/_yaml/__init__.py:23: DeprecationWarning: The _yaml extension module is now located at yaml._yaml and its location is subject to change.  To use the LibYAML-based parser and emitter, import from `yaml`: `from yaml import CLoader as Loader, CDumper as Dumper`.
  DeprecationWarning
+--------------------------------------+--------------+--------+------------------------+----------------+------------+
| ID                                   | Name         | Status | Networks               | Image          | Flavor     |
+--------------------------------------+--------------+--------+------------------------+----------------+------------+
| e4bab1da-06e1-49c9-8139-e7f023f4a07a | controller-2 | ACTIVE | ctlplane=192.168.24.31 | overcloud-full | controller |
| 256c64bf-d6e4-4ced-b3c8-ea33a0684bb7 | controller-0 | ACTIVE | ctlplane=192.168.24.21 | overcloud-full | controller |
| 5400fa38-7489-451b-b94c-6f97409df03e | controller-1 | ACTIVE | ctlplane=192.168.24.14 | overcloud-full | controller |
| bcb0e4b6-e2ea-41f4-8aa8-381776ceca70 | compute-1    | ACTIVE | ctlplane=192.168.24.45 | overcloud-full | compute    |
| 070e68b2-8ff2-468f-b4d3-b6c46dd43195 | compute-0    | ACTIVE | ctlplane=192.168.24.15 | overcloud-full | compute    |
| 877292a2-4810-4199-ac84-c7d2f21bf0c1 | ceph-1       | ACTIVE | ctlplane=192.168.24.9  | overcloud-full | ceph       |
| ac45b6a3-e763-463d-a456-4f56700c3608 | ceph-2       | ACTIVE | ctlplane=192.168.24.7  | overcloud-full | ceph       |
| a2b2a54b-eb04-4653-b824-924d1374c523 | ceph-0       | ACTIVE | ctlplane=192.168.24.52 | overcloud-full | ceph       |
+--------------------------------------+--------------+--------+------------------------+----------------+------------+

Comment 1 Juan Badia Payno 2022-04-28 15:01:00 UTC
OSP16.2
(undercloud) [stack@undercloud-0 ~]$ openstack baremetal node show 9dcff2a4-ca88-4206-80a4-414227195792 -f json 
/usr/lib64/python3.6/site-packages/_yaml/__init__.py:23: DeprecationWarning: The _yaml extension module is now located at yaml._yaml and its location is subject to change.  To use the LibYAML-based parser and emitter, import from `yaml`: `from yaml import CLoader as Loader, CDumper as Dumper`.
  DeprecationWarning
{
  "allocation_uuid": null,
  "automated_clean": null,
  "bios_interface": "no-bios",
  "boot_interface": "ipxe",
  "chassis_uuid": null,
  "clean_step": {},
  "conductor": "undercloud-0.redhat.local",
  "conductor_group": "",
  "console_enabled": false,
  "console_interface": "ipmitool-socat",
  "created_at": "2022-03-25T02:57:34+00:00",
  "deploy_interface": "iscsi",
  "deploy_step": {},
  "description": null,
  "driver": "ipmi",
  "driver_info": {
    "deploy_kernel": "file:///var/lib/ironic/httpboot/agent.kernel",
    "rescue_kernel": "file:///var/lib/ironic/httpboot/agent.kernel",
    "deploy_ramdisk": "file:///var/lib/ironic/httpboot/agent.ramdisk",
    "rescue_ramdisk": "file:///var/lib/ironic/httpboot/agent.ramdisk",
    "ipmi_address": "172.16.0.88",
    "ipmi_username": "admin",
    "ipmi_password": "******",
    "ipmi_port": "6235"
  },
  "driver_internal_info": {
    "is_whole_disk_image": false,
    "deploy_boot_mode": "bios",
    "deploy_steps": null,
    "last_power_state_change": "2022-03-25T03:29:00.155321",
    "agent_version": "5.0.5.dev26",
    "agent_last_heartbeat": "2022-03-25T03:27:52.419460",
    "root_uuid_or_disk_id": "bd5bf8c3-2a5c-48d8-b209-7909c011adf5"
  },
  "extra": {
    "hardware_swift_object": "extra_hardware-9dcff2a4-ca88-4206-80a4-414227195792"
  },
  "fault": null,
  "inspect_interface": "inspector",
  "inspection_finished_at": null,
  "inspection_started_at": null,
  "instance_info": {
    "image_source": "0e2f847c-652d-4e1b-8da2-06787775a698",
    "root_gb": "37",
    "swap_mb": "0",
    "display_name": "controller-2",
    "vcpus": "7",
    "nova_host_id": "undercloud-0.redhat.local",
    "memory_mb": "32768",
    "local_gb": "39",
    "capabilities": "{\"boot_option\": \"local\", \"profile\": \"controller\"}",
    "configdrive": "******"
  },
  "instance_uuid": "e4bab1da-06e1-49c9-8139-e7f023f4a07a",
  "last_error": null,
  "maintenance": false,
  "maintenance_reason": null,
  "management_interface": "ipmitool",
  "name": "controller-0",
  "network_interface": "flat",
  "owner": null,
  "power_interface": "ipmitool",
  "power_state": "power on",
  "properties": {
    "cpus": "8",
    "memory_mb": "32768",
    "local_gb": "39",
    "cpu_arch": "x86_64",
    "capabilities": "profile:controller,boot_option:local,node:controller-0",
    "vendor": "unknown"
  },
  "protected": false,
  "protected_reason": null,
  "provision_state": "active",
  "provision_updated_at": "2022-03-25T03:29:11+00:00",
  "raid_config": {},
  "raid_interface": "no-raid",
  "rescue_interface": "agent",
  "reservation": null,
  "resource_class": "controller",
  "storage_interface": "noop",
  "target_power_state": null,
  "target_provision_state": null,
  "target_raid_config": {},
  "traits": [],
  "updated_at": "2022-04-28T09:40:54+00:00",
  "uuid": "9dcff2a4-ca88-4206-80a4-414227195792",
  "vendor_interface": "ipmitool"
}

OPS17
(undercloud) [stack@undercloud-0 ~]$ openstack baremetal node show 9dcff2a4-ca88-4206-80a4-414227195792 -f json 
/usr/lib64/python3.6/site-packages/_yaml/__init__.py:23: DeprecationWarning: The _yaml extension module is now located at yaml._yaml and its location is subject to change.  To use the LibYAML-based parser and emitter, import from `yaml`: `from yaml import CLoader as Loader, CDumper as Dumper`.
  DeprecationWarning
/usr/lib/python3.6/site-packages/barbicanclient/__init__.py:61: UserWarning: The secrets module is moved to barbicanclient/v1 directory, direct import of barbicanclient.secrets will be deprecated. Please import barbicanclient.v1.secrets instead.
  % (name, name, name))
{
  "allocation_uuid": null,
  "automated_clean": null,
  "bios_interface": "no-bios",
  "boot_interface": "ipxe",
  "chassis_uuid": null,
  "clean_step": {},
  "conductor": "undercloud-0.redhat.local",
  "conductor_group": "",
  "console_enabled": false,
  "console_interface": "ipmitool-socat",
  "created_at": "2022-03-25T02:57:34+00:00",
  "deploy_interface": "direct",
  "deploy_step": {},
  "description": null,
  "driver": "ipmi",
  "driver_info": {
    "deploy_kernel": "file:///var/lib/ironic/httpboot/agent.kernel",
    "rescue_kernel": "file:///var/lib/ironic/httpboot/agent.kernel",
    "deploy_ramdisk": "file:///var/lib/ironic/httpboot/agent.ramdisk",
    "rescue_ramdisk": "file:///var/lib/ironic/httpboot/agent.ramdisk",
    "ipmi_address": "172.16.0.88",
    "ipmi_username": "admin",
    "ipmi_password": "******",
    "ipmi_port": "6235"
  },
  "driver_internal_info": {
    "is_whole_disk_image": false,
    "deploy_boot_mode": "bios",
    "deploy_steps": null,
    "last_power_state_change": "2022-03-25T03:29:00.155321",
    "agent_version": "5.0.5.dev26",
    "agent_last_heartbeat": "2022-03-25T03:27:52.419460",
    "root_uuid_or_disk_id": "bd5bf8c3-2a5c-48d8-b209-7909c011adf5"
  },
  "extra": {
    "hardware_swift_object": "extra_hardware-9dcff2a4-ca88-4206-80a4-414227195792"
  },
  "fault": null,
  "inspect_interface": "inspector",
  "inspection_finished_at": null,
  "inspection_started_at": null,
  "instance_info": {
    "image_source": "0e2f847c-652d-4e1b-8da2-06787775a698",
    "root_gb": "37",
    "swap_mb": "0",
    "display_name": "controller-2",
    "vcpus": "7",
    "nova_host_id": "undercloud-0.redhat.local",
    "memory_mb": "32768",
    "local_gb": "39",
    "capabilities": "{\"boot_option\": \"local\", \"profile\": \"controller\"}",
    "configdrive": "******"
  },
  "instance_uuid": "e4bab1da-06e1-49c9-8139-e7f023f4a07a",
  "last_error": null,
  "lessee": null,
  "maintenance": false,
  "maintenance_reason": null,
  "management_interface": "ipmitool",
  "name": "controller-0",
  "network_data": {},
  "network_interface": "flat",
  "owner": null,
  "power_interface": "ipmitool",
  "power_state": "power on",
  "properties": {
    "cpus": "8",
    "memory_mb": "32768",
    "local_gb": "39",
    "cpu_arch": "x86_64",
    "capabilities": "profile:controller,boot_option:local,node:controller-0",
    "vendor": "unknown"
  },
  "protected": false,
  "protected_reason": null,
  "provision_state": "active",
  "provision_updated_at": "2022-03-25T03:29:11+00:00",
  "raid_config": {},
  "raid_interface": "no-raid",
  "rescue_interface": "agent",
  "reservation": null,
  "resource_class": "controller",
  "retired": false,
  "retired_reason": null,
  "storage_interface": "noop",
  "target_power_state": null,
  "target_provision_state": null,
  "target_raid_config": {},
  "traits": [],
  "updated_at": "2022-04-27T08:18:20+00:00",
  "uuid": "9dcff2a4-ca88-4206-80a4-414227195792",
  "vendor_interface": "ipmitool"
}

Comment 2 Juan Badia Payno 2022-04-28 15:02:08 UTC
OSP16.2
(undercloud) [stack@undercloud-0 ~]$ openstack baremetal node show 99680e74-e327-4689-be65-ea5ad54d4482  -f json 
/usr/lib64/python3.6/site-packages/_yaml/__init__.py:23: DeprecationWarning: The _yaml extension module is now located at yaml._yaml and its location is subject to change.  To use the LibYAML-based parser and emitter, import from `yaml`: `from yaml import CLoader as Loader, CDumper as Dumper`.
  DeprecationWarning
{
  "allocation_uuid": null,
  "automated_clean": null,
  "bios_interface": "no-bios",
  "boot_interface": "ipxe",
  "chassis_uuid": null,
  "clean_step": {},
  "conductor": "undercloud-0.redhat.local",
  "conductor_group": "",
  "console_enabled": false,
  "console_interface": "ipmitool-socat",
  "created_at": "2022-03-25T02:57:35+00:00",
  "deploy_interface": "iscsi",
  "deploy_step": {},
  "description": null,
  "driver": "ipmi",
  "driver_info": {
    "deploy_kernel": "file:///var/lib/ironic/httpboot/agent.kernel",
    "rescue_kernel": "file:///var/lib/ironic/httpboot/agent.kernel",
    "deploy_ramdisk": "file:///var/lib/ironic/httpboot/agent.ramdisk",
    "rescue_ramdisk": "file:///var/lib/ironic/httpboot/agent.ramdisk",
    "ipmi_address": "172.16.0.88",
    "ipmi_username": "admin",
    "ipmi_password": "******",
    "ipmi_port": "6237"
  },
  "driver_internal_info": {
    "is_whole_disk_image": false,
    "deploy_boot_mode": "bios",
    "deploy_steps": null,
    "last_power_state_change": "2022-03-25T03:29:00.120813",
    "agent_version": "5.0.5.dev26",
    "agent_last_heartbeat": "2022-03-25T03:27:55.716816",
    "root_uuid_or_disk_id": "bd5bf8c3-2a5c-48d8-b209-7909c011adf5"
  },
  "extra": {
    "hardware_swift_object": "extra_hardware-99680e74-e327-4689-be65-ea5ad54d4482"
  },
  "fault": null,
  "inspect_interface": "inspector",
  "inspection_finished_at": null,
  "inspection_started_at": null,
  "instance_info": {
    "image_source": "0e2f847c-652d-4e1b-8da2-06787775a698",
    "root_gb": "37",
    "swap_mb": "0",
    "display_name": "controller-0",
    "vcpus": "7",
    "nova_host_id": "undercloud-0.redhat.local",
    "memory_mb": "32768",
    "local_gb": "39",
    "capabilities": "{\"boot_option\": \"local\", \"profile\": \"controller\"}",
    "configdrive": "******"
  },
  "instance_uuid": "256c64bf-d6e4-4ced-b3c8-ea33a0684bb7",
  "last_error": null,
  "maintenance": false,
  "maintenance_reason": null,
  "management_interface": "ipmitool",
  "name": "controller-2",
  "network_interface": "flat",
  "owner": null,
  "power_interface": "ipmitool",
  "power_state": "power on",
  "properties": {
    "cpus": "8",
    "memory_mb": "32768",
    "local_gb": "39",
    "cpu_arch": "x86_64",
    "capabilities": "profile:controller,boot_option:local,node:controller-2",
    "vendor": "unknown"
  },
  "protected": false,
  "protected_reason": null,
  "provision_state": "active",
  "provision_updated_at": "2022-03-25T03:29:11+00:00",
  "raid_config": {},
  "raid_interface": "no-raid",
  "rescue_interface": "agent",
  "reservation": null,
  "resource_class": "controller",
  "storage_interface": "noop",
  "target_power_state": null,
  "target_provision_state": null,
  "target_raid_config": {},
  "traits": [],
  "updated_at": "2022-04-28T09:40:49+00:00",
  "uuid": "99680e74-e327-4689-be65-ea5ad54d4482",
  "vendor_interface": "ipmitool"
}


OSP17
(undercloud) [stack@undercloud-0 ~]$ openstack baremetal node show 99680e74-e327-4689-be65-ea5ad54d4482  -f json 
/usr/lib64/python3.6/site-packages/_yaml/__init__.py:23: DeprecationWarning: The _yaml extension module is now located at yaml._yaml and its location is subject to change.  To use the LibYAML-based parser and emitter, import from `yaml`: `from yaml import CLoader as Loader, CDumper as Dumper`.
  DeprecationWarning
/usr/lib/python3.6/site-packages/barbicanclient/__init__.py:61: UserWarning: The secrets module is moved to barbicanclient/v1 directory, direct import of barbicanclient.secrets will be deprecated. Please import barbicanclient.v1.secrets instead.
  % (name, name, name))
{
  "allocation_uuid": null,
  "automated_clean": null,
  "bios_interface": "no-bios",
  "boot_interface": "ipxe",
  "chassis_uuid": null,
  "clean_step": {},
  "conductor": "undercloud-0.redhat.local",
  "conductor_group": "",
  "console_enabled": false,
  "console_interface": "ipmitool-socat",
  "created_at": "2022-03-25T02:57:35+00:00",
  "deploy_interface": "direct",
  "deploy_step": {},
  "description": null,
  "driver": "ipmi",
  "driver_info": {
    "deploy_kernel": "file:///var/lib/ironic/httpboot/agent.kernel",
    "rescue_kernel": "file:///var/lib/ironic/httpboot/agent.kernel",
    "deploy_ramdisk": "file:///var/lib/ironic/httpboot/agent.ramdisk",
    "rescue_ramdisk": "file:///var/lib/ironic/httpboot/agent.ramdisk",
    "ipmi_address": "172.16.0.88",
    "ipmi_username": "admin",
    "ipmi_password": "******",
    "ipmi_port": "6237"
  },
  "driver_internal_info": {
    "is_whole_disk_image": false,
    "deploy_boot_mode": "bios",
    "deploy_steps": null,
    "last_power_state_change": "2022-03-25T03:29:00.120813",
    "agent_version": "5.0.5.dev26",
    "agent_last_heartbeat": "2022-03-25T03:27:55.716816",
    "root_uuid_or_disk_id": "bd5bf8c3-2a5c-48d8-b209-7909c011adf5"
  },
  "extra": {
    "hardware_swift_object": "extra_hardware-99680e74-e327-4689-be65-ea5ad54d4482"
  },
  "fault": null,
  "inspect_interface": "inspector",
  "inspection_finished_at": null,
  "inspection_started_at": null,
  "instance_info": {
    "image_source": "0e2f847c-652d-4e1b-8da2-06787775a698",
    "root_gb": "37",
    "swap_mb": "0",
    "display_name": "controller-0",
    "vcpus": "7",
    "nova_host_id": "undercloud-0.redhat.local",
    "memory_mb": "32768",
    "local_gb": "39",
    "capabilities": "{\"boot_option\": \"local\", \"profile\": \"controller\"}",
    "configdrive": "******"
  },
  "instance_uuid": "256c64bf-d6e4-4ced-b3c8-ea33a0684bb7",
  "last_error": null,
  "lessee": null,
  "maintenance": false,
  "maintenance_reason": null,
  "management_interface": "ipmitool",
  "name": "controller-2",
  "network_data": {},
  "network_interface": "flat",
  "owner": null,
  "power_interface": "ipmitool",
  "power_state": "power on",
  "properties": {
    "cpus": "8",
    "memory_mb": "32768",
    "local_gb": "39",
    "cpu_arch": "x86_64",
    "capabilities": "profile:controller,boot_option:local,node:controller-2",
    "vendor": "unknown"
  },
  "protected": false,
  "protected_reason": null,
  "provision_state": "active",
  "provision_updated_at": "2022-03-25T03:29:11+00:00",
  "raid_config": {},
  "raid_interface": "no-raid",
  "rescue_interface": "agent",
  "reservation": null,
  "resource_class": "controller",
  "retired": false,
  "retired_reason": null,
  "storage_interface": "noop",
  "target_power_state": null,
  "target_provision_state": null,
  "target_raid_config": {},
  "traits": [],
  "updated_at": "2022-04-27T08:18:20+00:00",
  "uuid": "99680e74-e327-4689-be65-ea5ad54d4482",
  "vendor_interface": "ipmitool"
}

Comment 3 Harald Jensås 2022-04-28 15:19:18 UTC
Nova defaults hostname to 'display_name' unless the user specified a hostname:
 https://opendev.org/openstack/nova/src/branch/master/nova/compute/api.py#L1989-L1993

Metalsmith defaults hostname to ironic Node name, unless there is an allocation:
  https://github.com/openstack/metalsmith/blob/f98dfa61c1d7475b81c20dabbf2c74198c38c793/metalsmith/_utils.py#L119-L123


It would make sense to have metalsmith also default to display_name if present in instance_info by default, and then fallback to node name.

Comment 4 Harald Jensås 2022-04-28 15:48:33 UTC
Additional details:
 We are hitting this error[1] when "adopting" the nodes deployed by Heat->Nova->Ironic on OSP-16.

As can bee seen in output below, allocations are crated for 2 controllers, then it fails on the third controller because two controller nodes in metalsmith have the same hostname.

(undercloud) [stack@undercloud-0 ~]$ metalsmith list                                                                                                                                                                                        
+--------------------------------------+--------------+--------------------------------------+--------------+--------+------------------------+                                                                                             
| UUID                                 | Node Name    | Allocation UUID                      | Hostname     | State  | IP Addresses           |                                                                                             
+--------------------------------------+--------------+--------------------------------------+--------------+--------+------------------------+                                                                                             
| 018035f5-7d05-40e8-8680-89653edfce0d | ceph-0       |                                      | ceph-0       | ACTIVE | ctlplane=192.168.24.52 |                                                                                             
| 6bbbc832-1fc1-46b5-9e2b-b8a928b8cbad | ceph-1       |                                      | ceph-1       | ACTIVE | ctlplane=192.168.24.9  |                                                                                             
| be4fc1a9-dbc4-4af6-b632-d26db6478a6f | ceph-2       |                                      | ceph-2       | ACTIVE | ctlplane=192.168.24.7  |                                                                                             
| 0e9901bd-51b3-496c-b21a-6d0ce4f0b67e | compute-0    |                                      | compute-0    | ACTIVE | ctlplane=192.168.24.15 |                                                                                             
| 01148020-d1d4-40ae-b4a6-d62d442ed6fb | compute-1    |                                      | compute-1    | ACTIVE | ctlplane=192.168.24.45 |                                                                                             
| 9dcff2a4-ca88-4206-80a4-414227195792 | controller-0 |                                      | controller-0 | ACTIVE | ctlplane=192.168.24.31 |                                                                                             
| 41424ef7-3c4b-4418-b9d2-e75e79bebdbd | controller-1 | 5400fa38-7489-451b-b94c-6f97409df03e | controller-1 | ACTIVE | ctlplane=192.168.24.14 |                                                                                             
| 99680e74-e327-4689-be65-ea5ad54d4482 | controller-2 | 256c64bf-d6e4-4ced-b3c8-ea33a0684bb7 | controller-0 | ACTIVE | ctlplane=192.168.24.21 |                                                                                             
+--------------------------------------+--------------+--------------------------------------+--------------+--------+------------------------+                                                                                             
(undercloud) [stack@undercloud-0 ~]$ metalsmith show controller-0
+--------------------------------------+--------------+--------------------------------------+--------------+--------+------------------------+                                                                                             
| UUID                                 | Node Name    | Allocation UUID                      | Hostname     | State  | IP Addresses           |                                                                                             
+--------------------------------------+--------------+--------------------------------------+--------------+--------+------------------------+                                                                                             
| 99680e74-e327-4689-be65-ea5ad54d4482 | controller-2 | 256c64bf-d6e4-4ced-b3c8-ea33a0684bb7 | controller-0 | ACTIVE | ctlplane=192.168.24.21 |                                                                                             
+--------------------------------------+--------------+--------------------------------------+--------------+--------+------------------------+

(undercloud) [stack@undercloud-0 ~]$ metalsmith show 9dcff2a4-ca88-4206-80a4-414227195792
+--------------------------------------+--------------+-----------------+--------------+--------+------------------------+                                                                                                                  
| UUID                                 | Node Name    | Allocation UUID | Hostname     | State  | IP Addresses           |                                                                                                                  
+--------------------------------------+--------------+-----------------+--------------+--------+------------------------+                                                                                                                  
| 9dcff2a4-ca88-4206-80a4-414227195792 | controller-0 |                 | controller-0 | ACTIVE | ctlplane=192.168.24.31 |                                                                                                                  
+--------------------------------------+--------------+-----------------+--------------+--------+------------------------+                                                                                                                  
(undercloud) [stack@undercloud-0 ~]$ metalsmith show 99680e74-e327-4689-be65-ea5ad54d4482
+--------------------------------------+--------------+--------------------------------------+--------------+--------+------------------------+                                                                                             
| UUID                                 | Node Name    | Allocation UUID                      | Hostname     | State  | IP Addresses           |                                                                                             
+--------------------------------------+--------------+--------------------------------------+--------------+--------+------------------------+                                                                                             
| 99680e74-e327-4689-be65-ea5ad54d4482 | controller-2 | 256c64bf-d6e4-4ced-b3c8-ea33a0684bb7 | controller-0 | ACTIVE | ctlplane=192.168.24.21 |                                                                                             
+--------------------------------------+--------------+--------------------------------------+--------------+--------+------------------------+

(undercloud) [stack@undercloud-0 ~]$ openstack baremetal node show  99680e74-e327-4689-be65-ea5ad54d4482 -c name -c instance_info -c properties -f yaml                                                                                     
instance_info:
  capabilities: '{"boot_option": "local", "profile": "controller"}'
  configdrive: '******'
  display_name: controller-0
  image_source: 0e2f847c-652d-4e1b-8da2-06787775a698
  local_gb: '39'
  memory_mb: '32768'
  nova_host_id: undercloud-0.redhat.local
  root_gb: '37'
  swap_mb: '0'
  traits: []
  vcpus: '7'
name: controller-2
properties:
  capabilities: profile:controller,boot_option:local,node:controller-2
  cpu_arch: x86_64
  cpus: '8'
  local_gb: '39'
  memory_mb: '32768'
  vendor: unknown

(undercloud) [stack@undercloud-0 ~]$ openstack baremetal node show 9dcff2a4-ca88-4206-80a4-414227195792 -c name -c instance_info -c properties -f yaml                                                                                      
instance_info:
  capabilities: '{"boot_option": "local", "profile": "controller"}'
  configdrive: '******'
  display_name: controller-2
  image_source: 0e2f847c-652d-4e1b-8da2-06787775a698
  local_gb: '39'
  memory_mb: '32768'
  nova_host_id: undercloud-0.redhat.local
  root_gb: '37'
  swap_mb: '0'
  vcpus: '7'
name: controller-0
properties:
  capabilities: profile:controller,boot_option:local,node:controller-0
  cpu_arch: x86_64
  cpus: '8'
  local_gb: '39'
  memory_mb: '32768'
  vendor: unknown

(undercloud) [stack@undercloud-0 ~]$ ssh heat-admin.24.31
Warning: Permanently added '192.168.24.31' (ECDSA) to the list of known hosts.
Last login: Wed Apr 27 13:13:34 2022 from 192.168.24.1


---



[1] https://opendev.org/openstack/tripleo-ansible/src/branch/master/tripleo_ansible/ansible_plugins/module_utils/baremetal_deploy.py#L447-L459

Comment 5 Harald Jensås 2022-04-28 18:00:33 UTC
(undercloud) [stack@undercloud-0 ~]$ openstack baremetal node list
+--------------------------------------+--------------+--------------------------------------+-------------+--------------------+-------------+
| UUID                                 | Name         | Instance UUID                        | Power State | Provisioning State | Maintenance |
+--------------------------------------+--------------+--------------------------------------+-------------+--------------------+-------------+
| 018035f5-7d05-40e8-8680-89653edfce0d | ceph-0       | a2b2a54b-eb04-4653-b824-924d1374c523 | power on    | active             | False       |
| 6bbbc832-1fc1-46b5-9e2b-b8a928b8cbad | ceph-1       | 877292a2-4810-4199-ac84-c7d2f21bf0c1 | power on    | active             | False       |
| be4fc1a9-dbc4-4af6-b632-d26db6478a6f | ceph-2       | ac45b6a3-e763-463d-a456-4f56700c3608 | power on    | active             | False       |
| 0e9901bd-51b3-496c-b21a-6d0ce4f0b67e | compute-0    | 070e68b2-8ff2-468f-b4d3-b6c46dd43195 | power on    | active             | False       |
| 01148020-d1d4-40ae-b4a6-d62d442ed6fb | compute-1    | bcb0e4b6-e2ea-41f4-8aa8-381776ceca70 | power on    | active             | False       |
| 9dcff2a4-ca88-4206-80a4-414227195792 | controller-0 | e4bab1da-06e1-49c9-8139-e7f023f4a07a | power on    | active             | False       |
| 41424ef7-3c4b-4418-b9d2-e75e79bebdbd | controller-1 | 5400fa38-7489-451b-b94c-6f97409df03e | power on    | active             | False       |
| 99680e74-e327-4689-be65-ea5ad54d4482 | controller-2 | 256c64bf-d6e4-4ced-b3c8-ea33a0684bb7 | power on    | active             | False       |
+--------------------------------------+--------------+--------------------------------------+-------------+--------------------+-------------+
(undercloud) [stack@undercloud-0 ~]$ metalsmith list
+--------------------------------------+--------------+--------------------------------------+--------------+--------+------------------------+
| UUID                                 | Node Name    | Allocation UUID                      | Hostname     | State  | IP Addresses           |
+--------------------------------------+--------------+--------------------------------------+--------------+--------+------------------------+
| 9dcff2a4-ca88-4206-80a4-414227195792 | controller-0 |                                      | controller-2 | ACTIVE | ctlplane=192.168.24.31 |
| 41424ef7-3c4b-4418-b9d2-e75e79bebdbd | controller-1 | 5400fa38-7489-451b-b94c-6f97409df03e | controller-1 | ACTIVE | ctlplane=192.168.24.14 |
| 99680e74-e327-4689-be65-ea5ad54d4482 | controller-2 | 256c64bf-d6e4-4ced-b3c8-ea33a0684bb7 | controller-0 | ACTIVE | ctlplane=192.168.24.21 |
+--------------------------------------+--------------+--------------------------------------+--------------+--------+------------------------+
(undercloud) [stack@undercloud-0 ~]$ openstack baremetal allocation list
+--------------------------------------+--------------+----------------+--------+--------------------------------------+
| UUID                                 | Name         | Resource Class | State  | Node UUID                            |
+--------------------------------------+--------------+----------------+--------+--------------------------------------+
| 256c64bf-d6e4-4ced-b3c8-ea33a0684bb7 | controller-0 | controller     | active | 99680e74-e327-4689-be65-ea5ad54d4482 |
| 5400fa38-7489-451b-b94c-6f97409df03e | controller-1 | controller     | active | 41424ef7-3c4b-4418-b9d2-e75e79bebdbd |
+--------------------------------------+--------------+----------------+--------+--------------------------------------+

.. We tried this patch to ensure Hostname as listed in metalsmith uses instance_info['display_name']:
diff --git a/metalsmith/_utils.py b/metalsmith/_utils.py
index a692f33..f9a7034 100644
--- a/metalsmith/_utils.py
+++ b/metalsmith/_utils.py
@@ -117,7 +117,10 @@ def parse_checksums(checksums):
 
 
 def default_hostname(node):
-    if node.name and is_hostname_safe(node.name):
+    if (node.instance_info
+            and is_hostname_safe(node.instance_info.get('display_name'))):
+        return node.instance_info['display_name']
+    elif node.name and is_hostname_safe(node.name):
         return node.name
     else:
         return node.id


The result is still the same, we get this error:
""" Requested hostname controller-2 was not found, but the deployed node 99680e74-e327-4689-be65-ea5ad54d4482 has a matching name.
    Refusing to proceed to avoid confusing results. Please either rename the node or use a different hostname
"""

baremetal_deployment.yaml have, exact mapping:

  instances:
  - hostname: controller-0
    name: controller-2
  - hostname: controller-1
    name: controller-1
  - hostname: controller-2
    name: controller-0

We use 'name' from the baremetal definition as identity:
  https://opendev.org/openstack/tripleo-ansible/src/branch/master/tripleo_ansible/ansible_plugins/module_utils/baremetal_deploy.py#L423

  ident = request.get('name', request['hostname'])

Show instance is called:
https://opendev.org/openstack/tripleo-ansible/src/branch/master/tripleo_ansible/ansible_plugins/module_utils/baremetal_deploy.py#L436
            instance = provisioner.show_instance(ident)


Eventually the _find_node_and_allocation end up getting the allocation, using the 'name' value from baremetal definition:

https://opendev.org/openstack/metalsmith/src/branch/master/metalsmith/_provisioner.py#L646-L653
    def _find_node_and_allocation(self, node, refresh=False):
        try:
            if (not isinstance(node, str)
                    or not _utils.is_hostname_safe(node)):
                return self._get_node(node, refresh=refresh), None
            try:
                allocation = self.connection.baremetal.get_allocation(node)
            except os_exc.ResourceNotFound:
                return self._get_node(node, refresh=refresh), None


Allocations are by hostname, i.e 99680e74-e327-4689-be65-ea5ad54d4482 is controller-0 in allocations.

So it returns the wrong node, it should return the ironic node '9dcff2a4-ca88-4206-80a4-414227195792'.

Comment 8 Steve Baker 2022-05-02 23:32:58 UTC
It looks like check_existing will need to be reworked to fetch all existing associated nodes so the hostname can be matched with instance_info.display_name

Comment 17 Lukas Svaty 2023-06-16 08:13:29 UTC
Bulk moving target milestone to GA after the release of Beta on 14th June '23.

Comment 24 errata-xmlrpc 2023-08-16 01:11:06 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Release of components for Red Hat OpenStack Platform 17.1 (Wallaby)), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2023:4577


Note You need to log in before you can comment on or make changes to this bug.