Merge "Add note about using OS-EXT-* prefix for attribute naming"

This commit is contained in:
Jenkins 2016-02-24 08:39:40 +00:00 committed by Gerrit Code Review
commit 54679e3dec
5 changed files with 19 additions and 0 deletions

View File

@ -26,6 +26,9 @@ PREFIX = "OS-EXT-AZ"
class ExtendedAZController(wsgi.Controller):
def _extend_server(self, context, server, instance):
# NOTE(mriedem): The OS-EXT-AZ prefix should not be used for new
# attributes after v2.1. They are only in v2.1 for backward compat
# with v2.0.
key = "%s:availability_zone" % PREFIX
az = avail_zone.get_instance_availability_zone(context, instance)
server[key] = az or ''

View File

@ -36,6 +36,11 @@ class ExtendedServerAttributesController(wsgi.Controller):
properties = ['host', 'name']
if api_version_request.is_supported(req, min_version='2.3'):
# NOTE(mriedem): These will use the OS-EXT-SRV-ATTR prefix below
# and that's OK for microversion 2.3 which is being compatible
# with v2.0 for the ec2 API split out from Nova. After this,
# however, new microversoins should not be using the
# OS-EXT-SRV-ATTR prefix.
properties += ['reservation_id', 'launch_index',
'hostname', 'kernel_id', 'ramdisk_id',
'root_device_name', 'user_data']
@ -43,6 +48,8 @@ class ExtendedServerAttributesController(wsgi.Controller):
if attr == 'name':
key = "OS-EXT-SRV-ATTR:instance_%s" % attr
else:
# NOTE(mriedem): Nothing after microversion 2.3 should use the
# OS-EXT-SRV-ATTR prefix for the attribute key name.
key = "OS-EXT-SRV-ATTR:%s" % attr
server[key] = instance[attr]

View File

@ -30,6 +30,9 @@ class ExtendedStatusController(wsgi.Controller):
# to make it same as V2. If needed it can be added with
# microversion.
for state in ['task_state', 'vm_state', 'power_state']:
# NOTE(mriedem): The OS-EXT-STS prefix should not be used for new
# attributes after v2.1. They are only in v2.1 for backward compat
# with v2.0.
key = "%s:%s" % ('OS-EXT-STS', state)
server[key] = instance[state]

View File

@ -35,6 +35,9 @@ class ExtendedVolumesController(wsgi.Controller):
volume_attached['delete_on_termination'] = (
bdm['delete_on_termination'])
volumes_attached.append(volume_attached)
# NOTE(mriedem): The os-extended-volumes prefix should not be used for
# new attributes after v2.1. They are only in v2.1 for backward compat
# with v2.0.
key = "%s:volumes_attached" % ExtendedVolumes.alias
server[key] = volumes_attached

View File

@ -24,6 +24,9 @@ authorize = extensions.os_compute_soft_authorizer(ALIAS)
class ImageSizeController(wsgi.Controller):
def _extend_image(self, image, image_cache):
# NOTE(mriedem): The OS-EXT-* prefix should not be used for new
# attributes after v2.1. They are only in v2.1 for backward compat
# with v2.0.
key = "OS-EXT-IMG-SIZE:size"
image[key] = image_cache['size']