From 81c5559f9024a240017c4db89709403aa0429b96 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 60157485fe..c5c243d2fe 100644 --- a/vmware_nsx/db/extended_security_group_rule.py +++ b/vmware_nsx/db/extended_security_group_rule.py @@ -92,6 +92,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: