From ec8dba29f9f646ec05c0d6fad32b4b3aaf99f6af Mon Sep 17 00:00:00 2001 From: Pavlo Shchelokovskyy Date: Fri, 5 Aug 2022 14:03:21 +0300 Subject: Speed up standard flavor list command currently this command tries to fetch extra_specs for any flavor that does not have them (which is quite usual), regardless if the command was even asked to display them (--long) at all. This significantly slows down this command as it makes a lot of unnecessary REST calls, one per each flavor to fetch extra_specs for. With this patch, client only attempts to fetch flavor extra_specs if the user actually called the client with --long. Change-Id: Ia36414d891a41b641d7a9a04f0a1e7d43cfee351 Story: 2010343 Task: 46484 --- openstackclient/compute/v2/flavor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'openstackclient/compute') diff --git a/openstackclient/compute/v2/flavor.py b/openstackclient/compute/v2/flavor.py index 8a9eb07a..bc8f758b 100644 --- a/openstackclient/compute/v2/flavor.py +++ b/openstackclient/compute/v2/flavor.py @@ -333,7 +333,7 @@ class ListFlavor(command.Lister): # Even if server supports 2.61 some policy might stop it sending us # extra_specs. So try to fetch them if they are absent for f in data: - if not f.extra_specs: + if parsed_args.long and not f.extra_specs: compute_client.fetch_flavor_extra_specs(f) columns = ( -- cgit v1.2.1