Commit Graph

57 Commits

Author SHA1 Message Date
ricolin 150c0a9bde Check ready status volume before extend volume
Change-Id: I2d74bb0ee66813a500b3cb7766022297f5a152f2
Story: 2008349
Task: 41251
2021-03-12 01:12:10 +00:00
Rabi Mishra 01c230e793 Check for nova exception.Conflict rather than task_state
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
2020-06-26 14:29:54 +05:30
Hervé Beraud 1c318a167c Remove six and python 2.7 full support
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
2020-04-23 14:49:12 +02:00
Feilong Wang 50d72b8c0b Support handling empty string for volume AZ
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
2020-02-24 21:53:57 +00:00
Zuul 73f9dc295f Merge "Check task_state of instance before volume actions" 2020-02-20 04:42:20 +00:00
Pavlo Shchelokovskyy d31c123c02 Do not cache volume status attribute
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
2020-01-27 09:23:24 +00:00
ricolin 40ca7e9e63 Check task_state of instance before volume actions
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
2019-12-26 15:29:05 +00:00
Rabi Mishra 1ab29a42e3 Fix multiple gate issues
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
2019-09-18 18:23:50 +05:30
rabi 3b59f9ad98 Check for server in attachements when checking for detach complete
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
2018-09-24 17:28:52 +05:30
huangtianhua 72be5266ee Parse live data with correct key 'readonly'
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
2017-08-28 06:49:51 +00:00
Gerry Buteau 9269787d39 Cinder volume attachment attributes should not be cached
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
2017-07-14 12:53:52 +01:00
Jenkins e59cc159ee Merge "Fix snapshot/restore of volumes" 2017-06-05 04:01:01 +00:00
rabi a8129573d2 Fix handle_restore for server and volume resources
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
2017-05-19 11:56:27 +05:30
Thomas Herve b2f990d6c8 Fix snapshot/restore of volumes
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
2017-05-17 16:08:19 +02:00
Paul Bourke 73fd6c3cbb 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
2017-04-12 10:41:28 +01:00
liyi 8f10215ffd Remove log translations
Log messages are no longer being translated. This removes all use of
the _LE, _LI, and _LW translation markers to simplify logging and to
avoid confusion with new contributions.

See:
http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html
http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html

Change-Id: Ieec8028305099422e1b0f8fc84bc90c9ca6c694f
2017-03-25 17:11:50 +08:00
huangtianhua 5cf81b2ae3 Set default value for 'metadata' of cinder volume
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
2016-12-13 07:29:51 +00:00
huangtianhua ca71c69667 Don't replace failed volume always
Overide needs_replace_failed() to decide whether to replace
the volume resource if it's in *_FAILED.

Change-Id: I7c0f0de2e251f1ba695f8b5566c96d659bb66e20
Closes-Bug: #1490134
2016-12-09 09:23:23 +08:00
Thomas Herve 4ca2950811 Don't resolve attribute pre-storage
Handle calls to _resolve_attribute when resource_id is None, removing
useless API calls to backends.

Change-Id: I2da7bf25193dbf10207564554fca93b4571c8858
2016-10-15 20:58:34 +02:00
Peter Razumovsky c650b38c27 Cinder::Volume observe reality implementation
Add override parse_live_resource_data method implementation to
OS::Cinder::Volume resource.

implements bp get-reality-for-resources

Change-Id: Ifa6f4e7d01e8a146eaaf5d38f229346a27f1981e
2016-09-05 11:59:31 +03:00
Rabi Mishra 0dabb9febc Remove deprecated v1 cinder api support
This removes the deprecated cinder v1 api and adds
support for v3 api in the client plugin.

Change-Id: I6af06ed85c7022e0e47072985c578aa455b7eb1a
2016-08-02 14:32:20 +05:30
huangtianhua d898623e49 Improve validation of cinder volume resource
The property 'size' is required unless backup_id or
source_volid or snapshot_id is specified.

Change-Id: Ib31795a247535d0090ae5e434cbc3c5c2bfda12c
Closes-Bug: #1584660
2016-05-31 08:43:41 +00:00
Rabi Mishra a78303b791 Don't access `_stored_properties_data`
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
2016-04-20 18:38:42 +05:30
huangtianhua fa67f34791 Use to_dict() instead for cinder resources
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
2016-04-16 15:01:50 +08:00
Peter Razumovsky e4dc942ce1 Fix resources descriptions for custom guidelines
There're several errors, raised by custom guidelines check,
need to fix it for successful pep8 running.

implements bp custom-guidelines

Change-Id: Ibef41cad9b20715a740cedac7b98e9647bd3d6b7
2016-02-26 15:47:46 +03:00
Rabi Mishra 903d05f7ed Refactor property translation rule(1/2)
This moves TranslationRule class from the properties module
to a separare module.

Change-Id: I1faa2cf22aa7378384ef8cd38506f0f13e2d9ce6
2016-02-09 10:30:13 +05:30
Rabi Mishra 29692ee4f5 Use custom find functions for image lookup
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
2016-01-27 09:56:01 +05:30
Jenkins bb894cde1c Merge "Add descriptions to all openstack resources (Part 1)" 2015-12-28 23:22:17 +00:00
huangtianhua 3b37f1021d Make sure update access mode for volume in available
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
2015-12-26 18:32:53 +08:00
Peter Razumovsky 6294168760 Add descriptions to all openstack resources (Part 1)
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
2015-12-24 20:33:16 +03:00
Thomas Herve 003df61ae0 Translate properties before update
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
2015-11-25 11:12:14 +01:00
huangtianhua 6f2383c42c Support 'multiattach' for cinder volume
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
2015-11-10 09:31:35 +08:00
Peter Razumovsky 97f7b44453 Fix mounpoint value of VolumeAttachment
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
2015-09-11 11:15:52 +03:00
Oleksii Chuprykov 68a73b513c Move Resource exceptions to common module (2)
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
2015-09-04 11:24:31 +00:00
Joe D'Andrea b31259a9ed Adds resource uuid, volume support to lifecycle scheduler hints
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
2015-08-27 12:05:39 -04:00
Jenkins 87298f1ef7 Merge "Move all tasks objects into progress module" 2015-08-24 03:43:13 +00:00
Pavlo Shchelokovskyy 3b2c92905e Move all tasks objects into progress module
Change-Id: I45666b885161f6d92554683f9a652a34513d7933
2015-08-21 10:57:49 +03:00
huangtianhua 4b0247dc92 Add and apply cinder backup constraint
Add custom constraint for cinder backup and apply
it to related resources property.

Change-Id: I6e7f0dae98fae6f36b46ca6fcf02f77f79f942dd
Blueprint: add-cinder-backup-constraint
2015-08-20 08:11:58 +00:00
huangtianhua 4e2e6a597d Correct volume restore behavior
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
2015-08-17 23:21:07 +08:00
huangtianhua 37e7ae790a Add _show_resource function to Cinder resources (6)
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
2015-08-04 10:47:53 +08:00
Peter Razumovsky 42f6e521b5 Add HIDDEN status to Cinder::Volume image_ref
Add HIDDEN status and translation rules to image_ref
property of Cinder::Volume resource.

bp deprecating-improvements

Change-Id: I478e772f0452c4ba9a648472b577466b6caa96b8
2015-07-27 12:54:04 +03:00
Doug Hellmann 423110ef6e Update version for Liberty
Update the version for Liberty, switching from date-based versioning
to pre-versioning using SemVer. See
http://lists.openstack.org/pipermail/openstack-dev/2015-May/065211.html
and
http://lists.openstack.org/pipermail/openstack-dev/2015-June/067082.html
for details.

Also new version was updated in resources with SupportStatus version 2015.2.

Change-Id: I6a35fa0dda798fad93b804d00a46af80f08d475c
2015-06-22 04:13:01 -04:00
Jenkins 2cc97650c5 Merge "Add attribute type for openstack resources" 2015-06-19 10:03:25 +00:00
tyagi d901500fd4 Add attribute type for openstack resources
Add type field to the schema of the openstack resources.

Implements: blueprint add-type-in-attributes-schema

Change-Id: I214b44095f0d79c4a1f80dee0219a8c68a534f0a
2015-06-15 03:36:44 -07:00
huangtianhua f500132879 Fix KeyError exception when stack snapshot deletion
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
2015-06-15 16:38:25 +08:00
Pavlo Shchelokovskyy a484c73973 Remove TaskRunner from Volume resources
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
2015-05-19 00:15:21 +03:00
huangtianhua d52f8c7210 Improve cinder volume validation and tests related
There are some improvement of error message and tests
related of bug/1451713.

Change-Id: I78b609c8f1c8d04835f4a9dbadae51e2013fa753
Related-Bug: #1451713
2015-05-15 12:52:02 +08:00
Jenkins 5b2d0fe1e0 Merge "Replace self.properties.get on self.properties[]" 2015-05-15 00:49:57 +00:00
Peter Razumovsky 4b5f296acc Replace self.properties.get on self.properties[]
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
2015-05-13 16:24:12 +03:00
huangtianhua a26d1fcdd9 Add validation for cinder volume
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
2015-05-13 16:43:33 +08:00