summaryrefslogtreecommitdiff
path: root/openstackclient/network
diff options
context:
space:
mode:
authorRodolfo Alonso Hernandez <ralonsoh@redhat.com>2020-03-02 16:40:15 +0000
committerRodolfo Alonso Hernandez <ralonsoh@redhat.com>2020-03-12 11:44:10 +0000
commit711b9c9405c55ca8bb5649e2b56202845356e049 (patch)
tree80198e3becbc8512b5bb0ba26d334093ebb3f808 /openstackclient/network
parent962efd949feb461283a9bb4a668fbd310f80ba40 (diff)
downloadpython-openstackclient-711b9c9405c55ca8bb5649e2b56202845356e049.tar.gz
Add "fields" parameter to ListSecurityGroup query
This new query parameter will allow to send a query sending the "fields" parameter. This "fields" parameter contains the needed API fields, translated into OVO fields in Neutron server, that require to be retrieved from the DB. As commented in the related bug, the OSC "list" command only prints five parameters, none of them the security group rules. In systems with a reasonable amount of security groups, skipping the unnecessary rule load can save a lot of time. Depends-On: https://review.opendev.org/#/c/710820/ Change-Id: I16f48e292997d029d68f66365db949b9f4b5a0c8 Closes-Bug: #1865223
Diffstat (limited to 'openstackclient/network')
-rw-r--r--openstackclient/network/v2/security_group.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/openstackclient/network/v2/security_group.py b/openstackclient/network/v2/security_group.py
index f8153fa8..2033af14 100644
--- a/openstackclient/network/v2/security_group.py
+++ b/openstackclient/network/v2/security_group.py
@@ -202,6 +202,7 @@ class DeleteSecurityGroup(common.NetworkAndComputeDelete):
# the OSC minimum requirements include SDK 1.0.
class ListSecurityGroup(common.NetworkAndComputeLister):
_description = _("List security groups")
+ FIELDS_TO_RETRIEVE = ['id', 'name', 'description', 'project_id', 'tags']
def update_parser_network(self, parser):
if not self.is_docs_build:
@@ -251,7 +252,8 @@ class ListSecurityGroup(common.NetworkAndComputeLister):
filters['project_id'] = project_id
_tag.get_tag_filtering_args(parsed_args, filters)
- data = client.security_groups(**filters)
+ data = client.security_groups(fields=self.FIELDS_TO_RETRIEVE,
+ **filters)
columns = (
"ID",