Add image meta to libvirt XML metadata

This patch adds the image_meta used to launch an instance to its
libvirt domain metadata.

Nova exposes the image_meta structure when publishing
instance notifications. Downstream services that consume these
notifications such as Ceilometer use this to provide metadata about
the image originally used to create an ephemeral instance or
instance boot volume.

Ceilometer also polls the running instances using the Compute Agent
by reading the metadata of active instances from the libvirt socket.

Adding the data stored in image_meta to the libvirt metadata allows
Ceilometer to discover and expose the actual image metadata used to
launch instances using its compute pollsters, without performing
additional API queries to Nova, Cinder and Glance to get this
information (and even if that was done, it could be different to what
is actually running if images are updated after the fact).

To match the existing image_meta definition from Nova notifications,
depending on the type of instance, the behaviour of the metadata is:

* Instance built from image
  => UUID set for image, image metadata added to the XML
* Instance launched from volume built from image
  => UUID empty, volume image metadata added to the XML
* Instance launched from volume NOT built from image
  => UUID empty, no attributes from image meta defined

Signed-off-by: Callum Dickinson <callum.dickinson@catalystcloud.nz>
Implements: blueprint xml-image-meta
Change-Id: I09f4f76fff30f9cccf35f4832b9c870095c380ad
This commit is contained in:
Callum Dickinson
2025-02-26 09:07:19 +13:00
parent 619cd0a9c7
commit 7ce26377af
7 changed files with 521 additions and 96 deletions
@@ -7,6 +7,14 @@ features:
This allows downstream clients that queries libvirt domain metadata,
such as Ceilometer, to avoid performing additional Nova API queries
to get this information.
- |
Additional attributes relating to the image metadata an instance is
configured with have been added to the libvirt domain metadata under
the ``<nova:image>`` element. This allows downstream services that
read libvirt domain metadata, such as Ceilometer, to use and expose
more information about an instance without needing to perform
additional API queries (potentially to multiple services) to get that
information.
upgrades:
- |