Public bug reported:

PROBLEM:
Description field is added to resources by inheriting 
StandardAttrDescriptionMixin, and StandardAttrDescriptionMixin use the 
@has_resource_extenders decorator to register _extend_standard_attr_description 
functions. This causes a problem, any plugin which inherits 
StandardAttrDescriptionMixin will register _extend_standard_attr_description 
duplicately. 

I added a log so we can see the _resource_extend_functions dict. When querying 
a network, it will be executed for 4 times.
DEBUG neutron_lib.db.resource_extend [None 
req-369638d4-a6db-4d55-8e9d-ff0d21372161 demo demo] resource: networks, funcs: 
[<weakref at 0x75d9b1d8c1d0; to 'function' at 0x75d9b19dab00 
(_extend_availability_zone)>, <weakref at 0x75d9b1d6b240; to 'function' at 
0x75d9b19cb880 (_extend_network_dict_address_scope)>, <weakref at 
0x75d9b280c040; to 'function' at 0x75d9b1a712d0 (_extend_network_dict_l3)>, 
<weakref at 0x75d9b1fec860; to 'function' at 0x75d9b1a73a30 
(_extend_network_dict_vlan_qinq)>, <weakref at 0x75d9b1f51670; to 'function' at 
0x75d9b1a79e10 (_extend_network_dict_vlan_transparent)>, <weakref at 
0x75d9b1eca840; to 'function' at 0x75d9b1a445e0 
(_extend_standard_attr_description)>, <weakref at 0x75d9b1adda30; to 'function' 
at 0x75d9b15a3c70 (_ml2_md_extend_network_dict)>, <weakref at 0x75d9b1eca840; 
to 'function' at 0x75d9b1a445e0 (_extend_standard_attr_description)>, <weakref 
at 0x75d9b10ca390; to 'function' at 0x75d9b0b8e170 
(_extend_external_network_default)>, <weakref at 0x75
 d9b10c92b0; to 'function' at 0x75d9b0bd45e0 (_extend_tags_dict)>, <weakref at 
0x75d9b10f0a40; to 'function' at 0x75d9b0bd6440 
(_extend_resource_dict_timestamp)>, <weakref at 0x75d9b1eca840; to 'function' 
at 0x75d9b1a445e0 (_extend_standard_attr_description)>, <weakref at 
0x75d9b1b01670; to 'function' at 0x75d9b0be0700 
(extend_resource_dict_revision)>, <weakref at 0x75d9b1eca840; to 'function' at 
0x75d9b1a445e0 (_extend_standard_attr_description)>] {{(pid=11208) apply_funcs 
/opt/stack/data/venv/lib/python3.10/site-packages/neutron_lib/db/resource_extend.py:95}}
DEBUG neutron.db.standardattrdescription_db [None 
req-369638d4-a6db-4d55-8e9d-ff0d21372161 demo demo] 
extend_standard_attr_description executed {{(pid=11208) 
_extend_standard_attr_description 
/opt/stack/neutron/neutron/db/standardattrdescription_db.py:29}}
DEBUG neutron.db.standardattrdescription_db [None 
req-369638d4-a6db-4d55-8e9d-ff0d21372161 demo demo] 
extend_standard_attr_description executed {{(pid=11208) 
_extend_standard_attr_description 
/opt/stack/neutron/neutron/db/standardattrdescription_db.py:29}}
DEBUG neutron.db.standardattrdescription_db [None 
req-369638d4-a6db-4d55-8e9d-ff0d21372161 demo demo] 
extend_standard_attr_description executed {{(pid=11208) 
_extend_standard_attr_description 
/opt/stack/neutron/neutron/db/standardattrdescription_db.py:29}}
DEBUG neutron.db.standardattrdescription_db [None 
req-369638d4-a6db-4d55-8e9d-ff0d21372161 demo demo] 
extend_standard_attr_description executed {{(pid=11208) 
_extend_standard_attr_description 
/opt/stack/neutron/neutron/db/standardattrdescription_db.py:29}}

When there are a larger number of plugins, a high volume of query
requests can be time-consuming.

** Affects: neutron
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/2127835

Title:
  Duplicated function registration in resource_extend

Status in neutron:
  New

Bug description:
  PROBLEM:
  Description field is added to resources by inheriting 
StandardAttrDescriptionMixin, and StandardAttrDescriptionMixin use the 
@has_resource_extenders decorator to register _extend_standard_attr_description 
functions. This causes a problem, any plugin which inherits 
StandardAttrDescriptionMixin will register _extend_standard_attr_description 
duplicately. 

  I added a log so we can see the _resource_extend_functions dict. When 
querying a network, it will be executed for 4 times.
  DEBUG neutron_lib.db.resource_extend [None 
req-369638d4-a6db-4d55-8e9d-ff0d21372161 demo demo] resource: networks, funcs: 
[<weakref at 0x75d9b1d8c1d0; to 'function' at 0x75d9b19dab00 
(_extend_availability_zone)>, <weakref at 0x75d9b1d6b240; to 'function' at 
0x75d9b19cb880 (_extend_network_dict_address_scope)>, <weakref at 
0x75d9b280c040; to 'function' at 0x75d9b1a712d0 (_extend_network_dict_l3)>, 
<weakref at 0x75d9b1fec860; to 'function' at 0x75d9b1a73a30 
(_extend_network_dict_vlan_qinq)>, <weakref at 0x75d9b1f51670; to 'function' at 
0x75d9b1a79e10 (_extend_network_dict_vlan_transparent)>, <weakref at 
0x75d9b1eca840; to 'function' at 0x75d9b1a445e0 
(_extend_standard_attr_description)>, <weakref at 0x75d9b1adda30; to 'function' 
at 0x75d9b15a3c70 (_ml2_md_extend_network_dict)>, <weakref at 0x75d9b1eca840; 
to 'function' at 0x75d9b1a445e0 (_extend_standard_attr_description)>, <weakref 
at 0x75d9b10ca390; to 'function' at 0x75d9b0b8e170 
(_extend_external_network_default)>, <weakref at 0x
 75d9b10c92b0; to 'function' at 0x75d9b0bd45e0 (_extend_tags_dict)>, <weakref 
at 0x75d9b10f0a40; to 'function' at 0x75d9b0bd6440 
(_extend_resource_dict_timestamp)>, <weakref at 0x75d9b1eca840; to 'function' 
at 0x75d9b1a445e0 (_extend_standard_attr_description)>, <weakref at 
0x75d9b1b01670; to 'function' at 0x75d9b0be0700 
(extend_resource_dict_revision)>, <weakref at 0x75d9b1eca840; to 'function' at 
0x75d9b1a445e0 (_extend_standard_attr_description)>] {{(pid=11208) apply_funcs 
/opt/stack/data/venv/lib/python3.10/site-packages/neutron_lib/db/resource_extend.py:95}}
  DEBUG neutron.db.standardattrdescription_db [None 
req-369638d4-a6db-4d55-8e9d-ff0d21372161 demo demo] 
extend_standard_attr_description executed {{(pid=11208) 
_extend_standard_attr_description 
/opt/stack/neutron/neutron/db/standardattrdescription_db.py:29}}
  DEBUG neutron.db.standardattrdescription_db [None 
req-369638d4-a6db-4d55-8e9d-ff0d21372161 demo demo] 
extend_standard_attr_description executed {{(pid=11208) 
_extend_standard_attr_description 
/opt/stack/neutron/neutron/db/standardattrdescription_db.py:29}}
  DEBUG neutron.db.standardattrdescription_db [None 
req-369638d4-a6db-4d55-8e9d-ff0d21372161 demo demo] 
extend_standard_attr_description executed {{(pid=11208) 
_extend_standard_attr_description 
/opt/stack/neutron/neutron/db/standardattrdescription_db.py:29}}
  DEBUG neutron.db.standardattrdescription_db [None 
req-369638d4-a6db-4d55-8e9d-ff0d21372161 demo demo] 
extend_standard_attr_description executed {{(pid=11208) 
_extend_standard_attr_description 
/opt/stack/neutron/neutron/db/standardattrdescription_db.py:29}}

  When there are a larger number of plugins, a high volume of query
  requests can be time-consuming.

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/2127835/+subscriptions


-- 
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to