Files
glance/etc/schema-image.json.extended-format-sample
Mitsuhiro Tanino c322704ba7 Enhance schema loading to support required properties
Currently, the `load_custom_properties` logic treats the schema file
(schema-image.json) strictly as a flat dictionary of property definitions.
This limits the ability to enforce mandatory properties because top-level
keys like "required" are ignored or cause errors during merging.

This commit enhances the schema loading logic to support a structured
JSON format:
  {"properties": {...}, "required": [...]}

This change allows operators to define both custom properties and
mandatory fields via the schema file, satisfying both discoverability
and enforcement requirements.

Backward compatibility is maintained by detecting the format; existing
flat JSON files will continue to work as before.

Change-Id: I6f4bdb78809511931b160c88e9173432fd2e6d06
Signed-off-by: Mitsuhiro Tanino <mitsuhiro.tanino@lycorp.co.jp>
2026-01-07 00:30:32 +09:00

48 lines
2.3 KiB
Plaintext

{
"properties": {
"kernel_id": {
"type": ["null", "string"],
"pattern": "^([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}$",
"description": "ID of image stored in Glance that should be used as the kernel when booting an AMI-style image."
},
"ramdisk_id": {
"type": ["null", "string"],
"pattern": "^([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}$",
"description": "ID of image stored in Glance that should be used as the ramdisk when booting an AMI-style image."
},
"instance_uuid": {
"type": "string",
"description": "Metadata which can be used to record which instance this image is associated with. (Informational only, does not create an instance snapshot.)"
},
"architecture": {
"description": "Operating system architecture as specified in https://docs.openstack.org/python-glanceclient/latest/cli/property-keys.html",
"type": "string"
},
"os_distro": {
"description": "Common name of operating system distribution as specified in https://docs.openstack.org/python-glanceclient/latest/cli/property-keys.html",
"type": "string"
},
"os_version": {
"description": "Operating system version as specified by the distributor.",
"type": "string"
},
"description": {
"description": "A human-readable string describing this image.",
"type": "string"
},
"cinder_encryption_key_id": {
"description": "Identifier in the OpenStack Key Management Service for the encryption key for the Block Storage Service to use when mounting a volume created from this image",
"type": "string"
},
"cinder_encryption_key_deletion_policy": {
"description": "States the condition under which the Image Service will delete the object associated with the 'cinder_encryption_key_id' image property. If this property is missing, the Image Service will take no action",
"type": "string",
"enum": [
"on_image_deletion",
"do_not_delete"
]
}
},
"required": ["os_distro", "architecture"]
}