When detaching and attaching volumes nova would raise an
exception.Conflict, if attach and detach can't happen. Let's
use that to retry rather than using task_state.
Change-Id: I50904e4254568cd807b9ff18eef482cadb626ce5
Task: 40169
Six is in use to help us to keep support for python 2.7.
Since the ussuri cycle we decide to remove the python 2.7
support so we can go ahead and also remove six usage from
the python code.
Review process and help
-----------------------
Removing six introduce a lot of changes and an huge amount of modified files
To simplify reviews we decided to split changes into several patches to avoid
painful reviews and avoid mistakes.
To review this patch you can use the six documentation [1] to obtain help and
understand choices.
Additional informations
-----------------------
Changes related to 'six.b(data)' [2]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
six.b [2] encode the given datas in latin-1 in python3 so I did the same
things in this patch.
Latin-1 is equal to iso-8859-1 [3].
This encoding is the default encoding [4] of certain descriptive HTTP
headers.
I suggest to keep latin-1 for the moment and to move to another encoding
in a follow-up patch if needed to move to most powerful encoding (utf8).
HTML4 support utf8 charset and utf8 is the default charset for HTML5 [5].
Note that this commit message is autogenerated and not necesserly contains
changes related to 'six.b'
[1] https://six.readthedocs.io/
[2] https://six.readthedocs.io/#six.b
[3] https://docs.python.org/3/library/codecs.html#standard-encodings
[4] https://www.w3schools.com/charsets/ref_html_8859.asp
[5] https://www.w3schools.com/html/html_charset.asp
Patch 8 of a serie of 28 patches
Change-Id: If54d634abfd345c1e672d31cb11de14260b34cc0
When building a complex stack, instance and volume are both
necessary. But the support of AZ in Nova and Cinder are slightly
different which is causing troubles to build the Heat template.
Without setting, the property availability_zone of volume always
got "", an empty string, instead of None. As a result, Cinder will
return 400 BadRequest error. This patch will turn the empty
string into None, to make sure Cinder can correctly handle the
scenario when availability_zone of volume is not set.
Task: 38853
Story: 2007330
Change-Id: Ib5bddf12ca63849a030d1d579d0a2e853e8b848a
this field can change by itself even during processing of the stack
(e.g. volume created, and considerably later attached),
or by itself (e.g. going to error).
If something is polling stack or its outputs while the stack is created,
the first value will get cached and returned regardless of actual
volume status.
Change-Id: Ic48a824a330c67cd4d9c4ccff31b6f53f0ca196d
Story: 2007217
Task: 38469
Check task_state before verify resize or before detachment.
We need to make sure the task_state moved out from resize_finish before
we trigger some action like attach/detach volume.
So when we update flvor and volume at the samethime, the resize action
will not affect volume attachment/detachment.
Depends-On: https://review.opendev.org/#/c/700512/
Change-Id: I64033d5a0a8fea5c4fd93b1deb111d3d8fba0cf7
Story: #2007042
Task: #37854
Task: #37855
Task: #37869
Change 'multiattach' property support status to HIDDEN
From queens release this is an extra-spec capability of volume type and
the ability to attach a volume to multiple hosts/servers requires that
the volume is of a special type that includes an extra-spec capability
setting of multiattach=<is> True.
Address v1 designate client removal from python-designateclient
designateclient v1 has been removed and we need to stop testing
it with client plugin.
Change-Id: I6fd022ea6cabfb7fadf49152babd215e07f8bec1
It's possible that the volume is already attached to another
server, which can happen by marking a VolumeAttachment resource
unhealthy after removing the volume from the server.
Change-Id: Ia77e0462bf732224b491591d22584cbcfa779956
Story: #2003850
Task: 26643
Cinder returns the volume infos with key 'readonly',
not 'read_only', so parse live data with correct key
'readonly' for volume resource.
Change-Id: If19db3129f23a6cb9d19e6744c4ffc4522166426
Closes-Bug: #1712041
The Cinder volume 'attachments' and 'attachments_list' attributes are
dynamically built lists and must be queried from the Cinder API on each
request. There are several factors that may change the contents of this
list that are unknown to Heat. Caching should be prevented for these
attributes.
Closes-Bug: #1703605
Related-Bug: #1703387
Co-Authored-By: Paul Bourke <paul.bourke@oracle.com>
Change-Id: I1a646e567b2d88f2acf09b3077c205c5b061d4bc
When resource references are used for properties restore
does not work for nova server and volume resources.
This patch fixes it and adds a functional test for it.
Change-Id: I34efb3f4e0d3578d95134793f5c5d413667790e0
Closes-Bug: #1687009
This fixes the snapshot of the volume resource by passing the force
flag, and the restore by detaching it properly beforehand.
Change-Id: I69936a12fe6bca44ee445cdfe0cedb38a5926f32
Closes-Bug: #1687006
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
Set default value of 'metadata' to {}, to make sure
update cinder volume success when observe_on_update
is enabled.
Change-Id: I006d8612f4d9fd0633695a17ad3c8f0ca37dbb97
Closes-Bug: #1635164
Overide needs_replace_failed() to decide whether to replace
the volume resource if it's in *_FAILED.
Change-Id: I7c0f0de2e251f1ba695f8b5566c96d659bb66e20
Closes-Bug: #1490134
Handle calls to _resolve_attribute when resource_id is None, removing
useless API calls to backends.
Change-Id: I2da7bf25193dbf10207564554fca93b4571c8858
The property 'size' is required unless backup_id or
source_volid or snapshot_id is specified.
Change-Id: Ib31795a247535d0090ae5e434cbc3c5c2bfda12c
Closes-Bug: #1584660
It seems we're accessing _stored_properties_data in some
resources. We don't need to do that as self.properties
would have the older values.
Change-Id: I68187c8986d639e1db1ae7fb3f9c2da66c70edc6
After the bug #1479641 fixed and we bumped up requirements
for latest release which provides
to_dict() for resources, this patch removes
_show_resources() method for cinder resources.
Change-Id: I09b7009bd663b98dead0cf0634a3413f9df7c9f7
There're several errors, raised by custom guidelines check,
need to fix it for successful pep8 running.
implements bp custom-guidelines
Change-Id: Ibef41cad9b20715a740cedac7b98e9647bd3d6b7
Use get interface and custom find functions to look for
images by id/name. Find interface is now implemented in
the client plugin itslef, as glanceclient v2 does not
support it. Once it's implemented in galnceclient v2,
we can leverage images.find interface directly.
This also leverges openstack.common.apicient.exceptions.
Change-Id: Ibf85495b9d5533c759c4e63284806f11e6e45413
Cinder only supports update 'read_only' access mode for
volumes which are in available status.
This patch will make sure to update access mode for
volume in available to avoid create/update failed.
Change-Id: Iccd1918f314394e00095e4e718e067dc68fe95df
Closes-Bug: #1490120
Add description of resources in openstack folder
of heat engine. It should help users to understand
which resource is need to.
Resources' services updated in this patch:
* barbican
* ceilometer
* cinder
* designate
* glance
* heat (partial)
* keystone
* magnum
* mistral
* monasca
* neutron (one resource)
implements bp docstring-improvements
Change-Id: I68813427ef8944cc7b05f1d8dcf12190d3ca45d1
This adds the translation rule call to properties before update, so that
we can remove resource code that refers to deprecated properties. The
new ones are used everywhere with the expectation that the translation
occurred.
Change-Id: Ibdf91ae711f82de5c60896f2452e2872bb3dc9cb
Closes-Bug: #1518676
This patch only supports 'multiattach' property for
cinder volume resource.
We have to fix some places too to allow for real
multi-attach support in Heat after nova support this
feature.
Change-Id: I8d89d8eb8338f614638049d7da4a680a4b0846f7
Closes-Bug: #1468981
Current novaclient create_server_volume raises
error if device equals to empty string. Add
check if mountpoint of VolumeAttachment is empty
and not None, cast it to None for correct passing
to novaclient.
Change-Id: Ia1df717635cbc40ed3da53205a5c77588c113c1c
Closes-bug: #1494303
It is convenient to have all exceptions in exception module.
Also it is reduces namespace cluttering of resource module and decreases
the number of dependencies in other modules (we do not need to import resource
in some cases for now).
ResourceUnknownStatus exception is moved in this patch.
Change-Id: Iad44c16252f5171984859f0ddd05b821f5dfc7e7
Heat resources are now assigned an orchestration id prior to their
instantiation by nova, cinder, et. al. This id is now added to
stack lifecycle scheduler hints. In addition to nova receiving
such hints, cinder is also now supported.
Change-Id: I5a13feb1bdedfbbe44de15e3d9eae72e56ec8a25
Closes-Bug: #1476345
Add custom constraint for cinder backup and apply
it to related resources property.
Change-Id: I6e7f0dae98fae6f36b46ca6fcf02f77f79f942dd
Blueprint: add-cinder-backup-constraint
Now cinder volume restore will enter UpdateReplacement
flow, the volume will be deleted and a new one be created.
This patch will correct the restore behavior to call
backup-restore API to just restore the volume.
Change-Id: I2d2c330572279113c403e8fda41999521bfd4966
Closes-Bug: #1451359
Resource in CinderClient has no to_dict method,
This patch adds entity attribute and _show_resource function
for heat (cinder) resources:
- volume
- volume type
Change-Id: I10c73847059fa5d32277b7877c5df41e2d4732d7
Add HIDDEN status and translation rules to image_ref
property of Cinder::Volume resource.
bp deprecating-improvements
Change-Id: I478e772f0452c4ba9a648472b577466b6caa96b8
Add type field to the schema of the openstack resources.
Implements: blueprint add-type-in-attributes-schema
Change-Id: I214b44095f0d79c4a1f80dee0219a8c68a534f0a
There is no 'backup_id' data in snapshot if the cinder
volume snapshot failed. This patch will use 'get'
instead __getitem__ to get the 'backup_id' data to avoid
KeyError exception raise.
Change-Id: Iae7e22ccdaf8f48a85d90afac3a38011f14cbd34
Closes-Bug: #1465173
All the volume_tasks logic has been redistributed as methods of either
cinder or nova client plugins.
The logic of detaching was simplified and a check for out-of-band
changes is no longer executed.
The old VolumeAttachTask is left in place as it is still used in
creating the AWS::EC2::Instance resource.
Change-Id: I13f8e03ff090dd5f5739e5af231c77d066eb9eac
Partial-Bug: #1393268
There are some improvement of error message and tests
related of bug/1451713.
Change-Id: I78b609c8f1c8d04835f4a9dbadae51e2013fa753
Related-Bug: #1451713
Remove unnecessary using self.properties.get for more
clear code. Using properties.get(prop, default) causes
next issues:
1. properties.get(prop) if prop not in properties_schema
will return None instead of expected KeyError.
2. properties.get(prop, default) returns "default" value
if current properties is not presented in properties_schema.
So using self.properties.get() makes sense only when we plan
to use this property with default option in another resource,
which has not it in property schema.
This patch replaces this methods in resources/openstack folder.
Change-Id: I523eb3feacb0cb7a16a928a92896ce56188e376f
Add validation for cinder volume, should specify only one
of snapshot_id, image, source_volid if don't specify backup_id
or size.
And also add validation of image and imageRef, user can't
set both of them.
Change-Id: Ibc9e75c338d07896e399267c366dd9167229ba9d
Closes-Bug: #1451713