Use neutron-lib add_validator for registration

As per [1], neutron-lib 0.3.0 provides a public add/get API for
local validator registration/access. This API is preferred over
directly accessing the validators dict module-level attribute
that's done today when adding a new validator and in fact
direct access to the validators dict is deprecated.

This patch changes all vmware-nsx's usage of the validators dict
to use the public API.

Related-Bug: #1584237

[1] https://review.openstack.org/#/c/324090/

Change-Id: Ifc403d41133eefb1dfbcd31952c7a88c436e9724
This commit is contained in:
Gary Kotton 2016-08-03 23:12:29 -07:00 committed by garyk
parent 303bcd4469
commit bf72494d00
3 changed files with 4 additions and 4 deletions

View File

@ -64,7 +64,7 @@ def _validate_dns_search_domain(data, max_len=attributes.NAME_MAX_LEN):
return msg return msg
validators.validators['type:dns_search_domain'] = (_validate_dns_search_domain) validators.add_validator('dns_search_domain', _validate_dns_search_domain)
DNS_SEARCH_DOMAIN = 'dns_search_domain' DNS_SEARCH_DOMAIN = 'dns_search_domain'

View File

@ -151,8 +151,8 @@ nw_gw_quota_opts = [
cfg.CONF.register_opts(nw_gw_quota_opts, 'QUOTAS') cfg.CONF.register_opts(nw_gw_quota_opts, 'QUOTAS')
validators.validators['type:device_list'] = _validate_device_list validators.add_validator('device_list', _validate_device_list)
validators.validators['type:connector_type'] = _validate_connector_type validators.add_validator('connector_type', _validate_connector_type)
class Networkgw(extensions.ExtensionDescriptor): class Networkgw(extensions.ExtensionDescriptor):

View File

@ -2623,7 +2623,7 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
if cfg.CONF.api_replay_mode: if cfg.CONF.api_replay_mode:
def _pass(data, _dummy=None): def _pass(data, _dummy=None):
pass pass
ext_sg.validators.validators['type:name_not_default'] = _pass validators.add_validator('name_not_default', _pass)
def get_security_groups(self, context, filters=None, fields=None, def get_security_groups(self, context, filters=None, fields=None,
sorts=None, limit=None, sorts=None, limit=None,