From f2b4b552efa75ba4f1184f8694aa40d3da1249b1 Mon Sep 17 00:00:00 2001 From: Salvatore Orlando Date: Fri, 26 Nov 2021 06:03:19 -0800 Subject: [PATCH] Ensure security group rule description is returned The neutron standard-attr-description is not working with NSX plugins for security group rules. It seems that when the extension is loaded the relevant DB model class is not yet available. To address this problem, this change explictly adds a resource extender function for the NSX plugin to add the description field to ecurity groups rule responses. Change-Id: I4d8b2629660f9e33401ce6b011b1784a6ec66aac --- vmware_nsx/db/extended_security_group_rule.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vmware_nsx/db/extended_security_group_rule.py b/vmware_nsx/db/extended_security_group_rule.py index 0bdf75bac5..b30f254728 100644 --- a/vmware_nsx/db/extended_security_group_rule.py +++ b/vmware_nsx/db/extended_security_group_rule.py @@ -96,6 +96,13 @@ class ExtendedSecurityGroupRuleMixin(object): else: sg_rule_res[ext_local_ip.LOCAL_IP_PREFIX] = None + @staticmethod + @resource_extend.extends([ext_sg.SECURITYGROUPRULES]) + def _extend_sg_rule_description(res, db_object): + if not hasattr(db_object, 'description'): + return + res['description'] = db_object.description + def _get_security_group_rule_local_ip(self, context, rule_id): with db_api.CONTEXT_READER.using(context): try: