Add extra Ironic instance_info metadata

Registered by John Garbutt

Ironic currently only sets instance_info/instance_uuid, we want to expand this to include project_id, user_id and flavor name, such that we are more consistent with what is set in Libvirt guest metadata. All of these fields are deleted when a node is undeployed, similar to instance_uuid today. The project_id might in the future be used to help with Ironic API RBAC.

(We would like this to be a specless blueprint).

Blueprint information

Status:
Not started
Approver:
None
Priority:
Undefined
Drafter:
John Garbutt
Direction:
Approved
Assignee:
John Garbutt
Definition:
Approved
Series goal:
Accepted for 2024.1
Implementation:
Deferred
Milestone target:
None

Related branches

Sprints

Whiteboard

This blueprint seeks to unify the guest metadata sent to Ironic with that sent to libvirt.

Implementation (Nova):

Currently, _get_guest_config_meta in the libvirt driver, here: https://opendev.org/openstack/nova/src/branch/master/nova/virt/libvirt/driver.py#L5780, assembles guest metadata into a libvirt metadata object. We should promote this method to the base compute driver, refactoring it to instead return either a generic metadata object or a dictionary. Then, methods in the libvirt driver and the Ironic driver can convert it, as needed, into the formats desired by those drivers.

When implemented in the Ironic driver, this would lead to the following metadata being added to the payload sent to an Ironic node's instance_info API on provisioning:
- instance display name
- instance creation time
- user id and name
- project id and name
- flavor uuid (as a bonus: maybe start doing this for libvirt, too?)
- IP addresses and types
(At implementation time we may choose to send fewer fields)

Essentially, everything exposed in https://opendev.org/openstack/nova/src/branch/master/nova/virt/libvirt/driver.py#L5780, excluding fields that are already sent to Ironic in other formats (such as image information).

Be sure when implementing this to check for any situation that could change this metadata, and update appropriately -- the only such known case in Ironic at this writing is a rebuild.

Implementation (Ironic):

Once Nova's implementation is complete, Ironic will enhance support for https://docs.openstack.org/releasenotes/ironic/zed.html#relnotes-21-0-0-stable-zed-new-features node.automatic_lessee to recognize when Nova has sent user/project metadata, and use it to set lessee on the node when opted in.

Migration (Ironic):

This script will be developed in and merged to the Ironic repository after the completion of both Ironic and Nova implementation steps.

Operators who want this metadata immediately, along with Ironic lessees set, will have a script given to them which will:
- Fetch metadata for existing instances, where possible
- Set metadata for those instances in instance_info, only being additive -- this script should not modify any existing fields in node.instance_info
- If opted-into by operator (either by Ironic config or by CLI option), also set node.lessee on the nodes according to Ironic's internal logic.

This migration script will only make reads and updates using Ironic's API. It will not perform any direct to database updates or make anything but read requests to nova's API.

[20231219 bauzas] Approved as a specless blueprint during today's nova meeting

Gerrit topic: https://review.opendev.org/#/q/topic:ironic-guest-metadata

Addressed by: https://review.opendev.org/c/openstack/nova/+/905406
    [WIP] factor out driver instance metadata

(?)

Work Items

Work items:
NOVA Factor out common parts of _get_guest_config_meta method to ComputeDriver: TODO
NOVA Implement calls to ComputeDriver._get_guest_config_meta in Ironic; add to instance_info dict on deployment: TODO
NOVA If needed, implement ability to update instance_info metadata on rebuild: TODO
IRONIC Implement support for [conductor]automatic_lessee using Nova-supplied user metadata: TODO
IRONIC Implement metadata/lessee backfill script: TODO

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.