diff options
| author | Dean Troyer <dtroyer@gmail.com> | 2017-04-28 14:25:00 -0500 |
|---|---|---|
| committer | Dean Troyer <dtroyer@gmail.com> | 2017-04-28 16:06:00 -0500 |
| commit | 2c5405ed5e69eb5b000d47d92e1019b8bb9b54f9 (patch) | |
| tree | 5cbb527098cf1c74539874b6e65cdf5fe3426384 /openstackclient/volume/v2 | |
| parent | dd7da49325e3b4bc430b8a3d46ae19e43491c3b5 (diff) | |
| download | python-openstackclient-2c5405ed5e69eb5b000d47d92e1019b8bb9b54f9.tar.gz | |
Fix volume qos spec list
This has been sporadically failing in functional tests due to the way
the volume qos spec list command calls get_associations() for each spec.
When tests run in parallel occasionally a spec from another test is present
in the list returned and is deleted before the get_associations() call is
made, causing a NotFound exception. We should just keep going when this
occurs.
* make v1 match v2
* add tests to ensure the exception is being caught and handled
Closes-Bug: #1687083
Change-Id: If2d17c1deb53d293fc2c7f0c527a4e4ef6f69976
Diffstat (limited to 'openstackclient/volume/v2')
| -rw-r--r-- | openstackclient/volume/v2/qos_specs.py | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/openstackclient/volume/v2/qos_specs.py b/openstackclient/volume/v2/qos_specs.py index 8e1d67b5..c7160581 100644 --- a/openstackclient/volume/v2/qos_specs.py +++ b/openstackclient/volume/v2/qos_specs.py @@ -187,11 +187,20 @@ class ListQos(command.Lister): qos_specs_list = volume_client.qos_specs.list() for qos in qos_specs_list: - qos_associations = volume_client.qos_specs.get_associations(qos) - if qos_associations: - associations = [association.name - for association in qos_associations] - qos._info.update({'associations': associations}) + try: + qos_associations = volume_client.qos_specs.get_associations( + qos, + ) + if qos_associations: + associations = [ + association.name for association in qos_associations + ] + qos._info.update({'associations': associations}) + except Exception as ex: + if type(ex).__name__ == 'NotFound': + qos._info.update({'associations': None}) + else: + raise display_columns = ( 'ID', 'Name', 'Consumer', 'Associations', 'Properties') |
