Merge "only show standard image properties in server show."

This commit is contained in:
Zuul
2025-08-19 16:39:30 +00:00
committed by Gerrit Code Review
19 changed files with 33 additions and 149 deletions

View File

@@ -45,14 +45,7 @@
],
"properties": {
"architecture": "x86_64",
"auto_disk_config": "True",
"base_image_ref": "70a599e0-31e7-49b7-b260-868f441e862b",
"container_format": "ova",
"disk_format": "vhd",
"kernel_id": "nokernel",
"min_disk": "1",
"min_ram": "0",
"ramdisk_id": "nokernel"
"auto_disk_config": "True"
}
},
"key_name": null,

View File

@@ -37,14 +37,7 @@
],
"properties": {
"architecture": "x86_64",
"auto_disk_config": "True",
"base_image_ref": "70a599e0-31e7-49b7-b260-868f441e862b",
"container_format": "ova",
"disk_format": "vhd",
"kernel_id": "nokernel",
"min_disk": "1",
"min_ram": "0",
"ramdisk_id": "nokernel"
"auto_disk_config": "True"
}
},
"key_name": null,

View File

@@ -37,14 +37,7 @@
],
"properties": {
"architecture": "x86_64",
"auto_disk_config": "True",
"base_image_ref": "70a599e0-31e7-49b7-b260-868f441e862b",
"container_format": "ova",
"disk_format": "vhd",
"kernel_id": "nokernel",
"min_disk": "1",
"min_ram": "0",
"ramdisk_id": "nokernel"
"auto_disk_config": "True"
}
},
"key_name": null,

View File

@@ -36,14 +36,7 @@
],
"properties": {
"architecture": "x86_64",
"auto_disk_config": "True",
"base_image_ref": "70a599e0-31e7-49b7-b260-868f441e862b",
"container_format": "ova",
"disk_format": "vhd",
"kernel_id": "nokernel",
"min_disk": "1",
"min_ram": "0",
"ramdisk_id": "nokernel"
"auto_disk_config": "True"
}
},
"key_name": null,

View File

@@ -45,14 +45,7 @@
],
"properties": {
"architecture": "x86_64",
"auto_disk_config": "True",
"base_image_ref": "70a599e0-31e7-49b7-b260-868f441e862b",
"container_format": "ova",
"disk_format": "vhd",
"kernel_id": "nokernel",
"min_disk": "1",
"min_ram": "0",
"ramdisk_id": "nokernel"
"auto_disk_config": "True"
}
},
"key_name": null,

View File

@@ -37,14 +37,7 @@
],
"properties": {
"architecture": "x86_64",
"auto_disk_config": "True",
"base_image_ref": "70a599e0-31e7-49b7-b260-868f441e862b",
"container_format": "ova",
"disk_format": "vhd",
"kernel_id": "nokernel",
"min_disk": "1",
"min_ram": "0",
"ramdisk_id": "nokernel"
"auto_disk_config": "True"
}
},
"key_name": null,

View File

@@ -44,14 +44,7 @@
],
"properties": {
"architecture": "x86_64",
"auto_disk_config": "True",
"base_image_ref": "70a599e0-31e7-49b7-b260-868f441e862b",
"container_format": "ova",
"disk_format": "vhd",
"kernel_id": "nokernel",
"min_disk": "1",
"min_ram": "0",
"ramdisk_id": "nokernel"
"auto_disk_config": "True"
}
},
"key_name": null,

View File

@@ -36,14 +36,7 @@
],
"properties": {
"architecture": "x86_64",
"auto_disk_config": "True",
"base_image_ref": "70a599e0-31e7-49b7-b260-868f441e862b",
"container_format": "ova",
"disk_format": "vhd",
"kernel_id": "nokernel",
"min_disk": "1",
"min_ram": "0",
"ramdisk_id": "nokernel"
"auto_disk_config": "True"
}
},
"key_name": null,

View File

@@ -1216,10 +1216,10 @@ rebuild_response_v298['properties']['server']['properties']['image'][
'patternProperties': {
'^[a-zA-Z0-9_:. ]{1,255}$': {
'type': 'string',
'max_Length': 255,
},
'maxLength': 255,
},
'additionalProperties': False,
},
'additionalProperties': False,
},
})

View File

@@ -14,6 +14,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import itertools
from oslo_log import log as logging
from oslo_serialization import jsonutils
@@ -634,16 +636,17 @@ class ViewBuilder(common.ViewBuilder):
}
if api_version_request.is_supported(request, '2.98'):
image_props = {}
for key, value in instance.system_metadata.items():
if key.startswith(utils.SM_IMAGE_PROP_PREFIX):
# remove prefix 'image_' at start of key, so that
# key 'image_<key-name>' becomes '<key-name>'
k = key.partition('_')[2]
image_props[k] = value
image['properties'] = image_props
prefix_len = len(utils.SM_IMAGE_PROP_PREFIX)
# allow legacy names if that is what were stored in metadata
std_fields = set(itertools.chain(
objects.ImageMetaProps.fields.keys(),
objects.ImageMetaProps._legacy_property_map.keys()
))
image['properties'] = {
key[prefix_len:]: value for key, value in
instance.system_metadata.items()
if (key.startswith(utils.SM_IMAGE_PROP_PREFIX) and
key[prefix_len:] in std_fields and value is not None)}
return image
else:
return ""

View File

@@ -45,14 +45,7 @@
],
"properties": {
"architecture": "x86_64",
"auto_disk_config": "True",
"base_image_ref": "%(uuid)s",
"container_format": "ova",
"disk_format": "vhd",
"kernel_id": "nokernel",
"min_disk": "1",
"min_ram": "0",
"ramdisk_id": "nokernel"
"auto_disk_config": "True"
}
},
"key_name": null,

View File

@@ -38,14 +38,7 @@
],
"properties": {
"architecture": "x86_64",
"auto_disk_config": "True",
"base_image_ref": "%(uuid)s",
"container_format": "ova",
"disk_format": "vhd",
"kernel_id": "nokernel",
"min_disk": "1",
"min_ram": "0",
"ramdisk_id": "nokernel"
"auto_disk_config": "True"
}
},
"key_name": null,

View File

@@ -37,14 +37,7 @@
],
"properties": {
"architecture": "x86_64",
"auto_disk_config": "True",
"base_image_ref": "%(uuid)s",
"container_format": "ova",
"disk_format": "vhd",
"kernel_id": "nokernel",
"min_disk": "1",
"min_ram": "0",
"ramdisk_id": "nokernel"
"auto_disk_config": "True"
}
},
"key_name": null,

View File

@@ -37,14 +37,7 @@
],
"properties": {
"architecture": "x86_64",
"auto_disk_config": "True",
"base_image_ref": "%(uuid)s",
"container_format": "ova",
"disk_format": "vhd",
"kernel_id": "nokernel",
"min_disk": "1",
"min_ram": "0",
"ramdisk_id": "nokernel"
"auto_disk_config": "True"
}
},
"key_name": null,

View File

@@ -45,14 +45,7 @@
],
"properties": {
"architecture": "x86_64",
"auto_disk_config": "True",
"base_image_ref": "%(uuid)s",
"container_format": "ova",
"disk_format": "vhd",
"kernel_id": "nokernel",
"min_disk": "1",
"min_ram": "0",
"ramdisk_id": "nokernel"
"auto_disk_config": "True"
}
},
"key_name": null,

View File

@@ -37,14 +37,7 @@
],
"properties": {
"architecture": "x86_64",
"auto_disk_config": "True",
"base_image_ref": "%(uuid)s",
"container_format": "ova",
"disk_format": "vhd",
"kernel_id": "nokernel",
"min_disk": "1",
"min_ram": "0",
"ramdisk_id": "nokernel"
"auto_disk_config": "True"
}
},
"key_name": null,

View File

@@ -38,14 +38,7 @@
],
"properties": {
"architecture": "x86_64",
"auto_disk_config": "True",
"base_image_ref": "%(uuid)s",
"container_format": "ova",
"disk_format": "vhd",
"kernel_id": "nokernel",
"min_disk": "1",
"min_ram": "0",
"ramdisk_id": "nokernel"
"auto_disk_config": "True"
}
},
"key_name": null,

View File

@@ -37,14 +37,7 @@
],
"properties": {
"architecture": "x86_64",
"auto_disk_config": "True",
"base_image_ref": "%(uuid)s",
"container_format": "ova",
"disk_format": "vhd",
"kernel_id": "nokernel",
"min_disk": "1",
"min_ram": "0",
"ramdisk_id": "nokernel"
"auto_disk_config": "True"
}
},
"key_name": null,

View File

@@ -37,14 +37,7 @@
],
"properties": {
"architecture": "x86_64",
"auto_disk_config": "True",
"base_image_ref": "%(uuid)s",
"container_format": "ova",
"disk_format": "vhd",
"kernel_id": "nokernel",
"min_disk": "1",
"min_ram": "0",
"ramdisk_id": "nokernel"
"auto_disk_config": "True"
}
},
"key_name": null,