summaryrefslogtreecommitdiff
path: root/openstackclient/compute/v2
diff options
context:
space:
mode:
authorPavlo Shchelokovskyy <shchelokovskyy@gmail.com>2022-08-05 14:03:21 +0300
committerStephen Finucane <sfinucan@redhat.com>2022-09-30 11:53:00 +0100
commitec8dba29f9f646ec05c0d6fad32b4b3aaf99f6af (patch)
treea1589bf23ca70adf67eaf6c25003839ef2caa54a /openstackclient/compute/v2
parent00d8d945a1869b723b9845b3e739928a7c4da00a (diff)
downloadpython-openstackclient-ec8dba29f9f646ec05c0d6fad32b4b3aaf99f6af.tar.gz
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
Diffstat (limited to 'openstackclient/compute/v2')
-rw-r--r--openstackclient/compute/v2/flavor.py2
1 files changed, 1 insertions, 1 deletions
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 = (