From 2c5405ed5e69eb5b000d47d92e1019b8bb9b54f9 Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Fri, 28 Apr 2017 14:25:00 -0500 Subject: 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 --- openstackclient/volume/v2/qos_specs.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'openstackclient/volume/v2') 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') -- cgit v1.2.1