Deprecate 'attachments' in favor of 'attachments_list'
The 'attachments' attribute of OS::Cinder::Volume is being processed by Heat as a string rather than the native list of dicts that come from Cinder. This makes it hard to consume the data downstream. This change marks the 'attachments' attribute deprecated in the pike release in favor of 'attachments_list', which has the correct type of LIST. An example of where this change is useful is in python-openstackclient; using the new attribute changes the output of 'openstack stack output show mystack' from: ... output_value: - u"[{u'server_id': u'0f5731c1-da17-4209-a2ef-270c7056f9a3', ... }]" ... to: ... output_value: - attached_at: '2017-03-31T14:05:28.000000' - attachment_id: 19436dc5-233d-49cc-a719-f6a92bff466c ... ... Change-Id: I52746f87a3872b18e7ae9a7296d6abd2c12c8b9a Closes-Bug: #1679087
This commit is contained in:
parent
e64e0064ee
commit
73fd6c3cbb
@ -51,12 +51,12 @@ class CinderVolume(vb.BaseVolume, sh.SchedulerHintsMixin):
|
||||
AVAILABILITY_ZONE_ATTR, SIZE_ATTR, SNAPSHOT_ID_ATTR, DISPLAY_NAME_ATTR,
|
||||
DISPLAY_DESCRIPTION_ATTR, VOLUME_TYPE_ATTR, METADATA_ATTR,
|
||||
SOURCE_VOLID_ATTR, STATUS, CREATED_AT, BOOTABLE, METADATA_VALUES_ATTR,
|
||||
ENCRYPTED_ATTR, ATTACHMENTS, MULTI_ATTACH_ATTR,
|
||||
ENCRYPTED_ATTR, ATTACHMENTS, ATTACHMENTS_LIST, MULTI_ATTACH_ATTR,
|
||||
) = (
|
||||
'availability_zone', 'size', 'snapshot_id', 'display_name',
|
||||
'display_description', 'volume_type', 'metadata',
|
||||
'source_volid', 'status', 'created_at', 'bootable', 'metadata_values',
|
||||
'encrypted', 'attachments', 'multiattach',
|
||||
'encrypted', 'attachments', 'attachments_list', 'multiattach',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
@ -220,8 +220,23 @@ class CinderVolume(vb.BaseVolume, sh.SchedulerHintsMixin):
|
||||
type=attributes.Schema.STRING
|
||||
),
|
||||
ATTACHMENTS: attributes.Schema(
|
||||
_('A string representation of the list of attachments of the '
|
||||
'volume.'),
|
||||
type=attributes.Schema.STRING,
|
||||
support_status=support.SupportStatus(
|
||||
status=support.DEPRECATED,
|
||||
message=_('Use property %s.') % ATTACHMENTS_LIST,
|
||||
version='9.0.0',
|
||||
previous_status=support.SupportStatus(
|
||||
status=support.SUPPORTED,
|
||||
version='2015.1'
|
||||
)
|
||||
)
|
||||
),
|
||||
ATTACHMENTS_LIST: attributes.Schema(
|
||||
_('The list of attachments of the volume.'),
|
||||
type=attributes.Schema.STRING
|
||||
type=attributes.Schema.LIST,
|
||||
support_status=support.SupportStatus(version='9.0.0'),
|
||||
),
|
||||
MULTI_ATTACH_ATTR: attributes.Schema(
|
||||
_('Boolean indicating whether allow the volume to be attached '
|
||||
@ -293,6 +308,8 @@ class CinderVolume(vb.BaseVolume, sh.SchedulerHintsMixin):
|
||||
return vol.name
|
||||
elif name == self.DISPLAY_DESCRIPTION_ATTR:
|
||||
return vol.description
|
||||
elif name == self.ATTACHMENTS_LIST:
|
||||
return vol.attachments
|
||||
return six.text_type(getattr(vol, name))
|
||||
|
||||
def check_create_complete(self, vol_id):
|
||||
|
@ -285,6 +285,7 @@ class CinderVolumeTest(vt_base.BaseVolumeTest):
|
||||
self.assertEqual(u'False', rsrc.FnGetAtt('bootable'))
|
||||
self.assertEqual(u'False', rsrc.FnGetAtt('encrypted'))
|
||||
self.assertEqual(u'[]', rsrc.FnGetAtt('attachments'))
|
||||
self.assertEqual([], rsrc.FnGetAtt('attachments_list'))
|
||||
self.assertEqual('False', rsrc.FnGetAtt('multiattach'))
|
||||
error = self.assertRaises(exception.InvalidTemplateAttribute,
|
||||
rsrc.FnGetAtt, 'unknown')
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
deprecations:
|
||||
- |
|
||||
The 'attachments' attribute of OS::Cinder::Volume has been deprecated in
|
||||
favor of 'attachments_list', which has the correct type of LIST. This makes
|
||||
this data easier for end users to process.
|
Loading…
Reference in New Issue
Block a user