From ce3ab93cb88ccc751d2efbb5681e8f4c4704539f Mon Sep 17 00:00:00 2001 From: Callum Dickinson Date: Wed, 5 Feb 2025 15:26:14 +1300 Subject: [PATCH] Add the volume_type_id attribute for volumes This change adds the volume_type_id attribute to volume.size notification samples and the volume Gnocchi resource type. The volume_type_id attribute contains the ID for the volume type of a volume. The current volume_type attribute stores the name of the volume type instead. The volume.size pollster already adds the volume_type_id attribute to polling samples, so no changes were required there. Note that the volume_type attribute returned by Cinder volume notifications is actually the volume type ID (not the name). This causes issues when populating the volume_type attribute in Gnocchi, addressed in another patch [1]. [1]: https://review.opendev.org/c/openstack/ceilometer/+/940758 Change-Id: I079be170f10357e001bbe1c17df8541bf523d402 --- ceilometer/data/meters.d/meters.yaml | 1 + ceilometer/gnocchi_client.py | 9 +++++++++ .../publisher/data/gnocchi_resources.yaml | 1 + ...dd-volume_type_id-attr-f29af86534907941.yaml | 17 +++++++++++++++++ 4 files changed, 28 insertions(+) create mode 100644 releasenotes/notes/add-volume_type_id-attr-f29af86534907941.yaml diff --git a/ceilometer/data/meters.d/meters.yaml b/ceilometer/data/meters.d/meters.yaml index 69364916d8..f0bf8d4b1c 100644 --- a/ceilometer/data/meters.d/meters.yaml +++ b/ceilometer/data/meters.d/meters.yaml @@ -130,6 +130,7 @@ metric: metadata: display_name: $.payload.display_name volume_type: $.payload.volume_type + volume_type_id: $.payload.volume_type image_id: $.payload.glance_metadata[?key=image_id].value instance_id: $.payload.volume_attachment[0].server_id diff --git a/ceilometer/gnocchi_client.py b/ceilometer/gnocchi_client.py index c8789681f8..ea3dcbe5f2 100644 --- a/ceilometer/gnocchi_client.py +++ b/ceilometer/gnocchi_client.py @@ -200,6 +200,15 @@ resources_update_operations = [ "value": {"type": "string", "min_length": 0, "max_length": 255, "required": False} }]}, + {"desc": "add volume_type_id to volume", + "type": "update_attribute_type", + "resource_type": "volume", + "data": [{ + "op": "add", + "path": "/attributes/volume_type_id", + "value": {"type": "string", "min_length": 0, "max_length": 255, + "required": False} + }]}, ] diff --git a/ceilometer/publisher/data/gnocchi_resources.yaml b/ceilometer/publisher/data/gnocchi_resources.yaml index 72f3baa860..afbedc6a23 100644 --- a/ceilometer/publisher/data/gnocchi_resources.yaml +++ b/ceilometer/publisher/data/gnocchi_resources.yaml @@ -242,6 +242,7 @@ resources: attributes: display_name: resource_metadata.(display_name|name) volume_type: resource_metadata.volume_type + volume_type_id: resource_metadata.volume_type_id image_id: resource_metadata.image_id instance_id: resource_metadata.instance_id event_delete: diff --git a/releasenotes/notes/add-volume_type_id-attr-f29af86534907941.yaml b/releasenotes/notes/add-volume_type_id-attr-f29af86534907941.yaml new file mode 100644 index 0000000000..0b7b6a1b13 --- /dev/null +++ b/releasenotes/notes/add-volume_type_id-attr-f29af86534907941.yaml @@ -0,0 +1,17 @@ +--- +features: + - | + Added the ``volume_type_id`` attribute to ``volume.size`` notification + samples, which stores the ID for the volume type of the given volume. + - | + Added the ``volume_type_id`` attribute to ``volume`` resources in Gnocchi, + which stores the ID for the volume type of the given volume. +upgrade: + - | + ``meters.yaml`` has been updated with changes to the ``volume.size`` + notification meter. If you override this file in your deployment, + it needs to be updated. + - | + ``gnocchi_resources.yaml`` has been updated with changes to the + ``volume`` resource type. If you override this file in your deployment, + it needs to be updated.