diff options
author | Zuul <zuul@review.opendev.org> | 2021-05-02 17:38:11 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2021-05-02 17:38:11 +0000 |
commit | a5ce4d806172f9d144633f297163e088c8ed1491 (patch) | |
tree | 2d689b43d2e29038a6df1b230b8b7f8e1ece7091 | |
parent | 79707c6d074f8df6583520f8a9c20aab28cd76c0 (diff) | |
parent | 4f49545afaf3cd453796d48ba96b9a82d11c01bf (diff) | |
download | nova-a5ce4d806172f9d144633f297163e088c8ed1491.tar.gz |
Merge "[neutron] Get only ID and name of the SGs from Neutron" into stable/wallaby23.0.1
-rw-r--r-- | nova/network/neutron.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/nova/network/neutron.py b/nova/network/neutron.py index a45e48bf24..20bb97818c 100644 --- a/nova/network/neutron.py +++ b/nova/network/neutron.py @@ -802,9 +802,15 @@ class API(base.Base): # TODO(arosen) Should optimize more to do direct query for security # group if len(security_groups) == 1 if len(security_groups): + # NOTE(slaweq): fields other than name and id aren't really needed + # so asking only about those fields will allow Neutron to not + # prepare list of rules for each found security group. That may + # speed processing of this request a lot in case when tenant has + # got many security groups + sg_fields = ['id', 'name'] search_opts = {'tenant_id': instance.project_id} user_security_groups = neutron.list_security_groups( - **search_opts).get('security_groups') + fields=sg_fields, **search_opts).get('security_groups') for security_group in security_groups: name_match = None |