Make image attributes in Gnocchi optional

The container_format and disk_format attributes for Glance images
can be set to null in certain cases (such as when images are "empty"
and have not any data uploaded to them yet).

Ceilometer does generate samples for these when processing
notifications or doing polling, and if the size attribute is available
and not set to None (which can happen in certain cases) it will try to
create the resource in Gnocchi and publish measures. This ends up
failing as the container_format and disk_format attributes are marked
as "required" in Gnocchi.

To make handling for this situation a little better (so these kinds of
resources can be monitored for at least), make the container_format and
disk_format attributes optional in Gnocchi.

Change-Id: I63edfa7d48aa3b75ee73cdcc091fa093c53879d3
Signed-off-by: Callum Dickinson <callum.dickinson@catalystcloud.nz>
This commit is contained in:
Callum Dickinson
2025-09-11 23:12:40 +12:00
parent e370e88c4a
commit ce80a04a26
2 changed files with 26 additions and 0 deletions

View File

@@ -227,6 +227,24 @@ resources_update_operations = [
"value": {"type": "string", "min_length": 0, "max_length": 255,
"required": False} # Allow the hypervisor to be withheld
}]},
{"desc": "make container_format optional for image",
"type": "update_attribute_type",
"resource_type": "image",
"data": [{
"op": "add", # Usually update, the attribute likely already exists
"path": "/attributes/container_format",
"value": {"type": "string", "min_length": 0, "max_length": 255,
"required": False} # This can be null in certain cases
}]},
{"desc": "make disk_format optional for image",
"type": "update_attribute_type",
"resource_type": "image",
"data": [{
"op": "add", # Usually update, the attribute likely already exists
"path": "/attributes/disk_format",
"value": {"type": "string", "min_length": 0, "max_length": 255,
"required": False} # This can be null in certain cases
}]},
]

View File

@@ -0,0 +1,8 @@
---
upgrade:
- |
The ``container_format`` and ``disk_format`` attributes have been made
optional for ``image`` resources in Gnocchi. This fixes an issue where
image resources would fail to be created in Gnocchi because
``container_format`` and ``disk_format`` are set to ``null`` (which is
possible on images that haven't had data uploaded to them yet).