From 8b50a36341daf16c5d2c01546f6ca264fc83f7aa Mon Sep 17 00:00:00 2001 From: Nate Johnston Date: Mon, 1 Jul 2019 11:59:32 -0400 Subject: [PATCH] Add base support for update_port_bulk As a complement to the create_port_bulk optimizations that took place in the Stein cycle, create the ability to have an ML2 plugin optionally expose an 'update_port_bulk' operation as well. This will permit ML2 plugins to optimize this code path for bulk operations as well. Change-Id: Id2c88a82715bccd1c23213828ef904322ab4386f --- neutron/api/v2/base.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/neutron/api/v2/base.py b/neutron/api/v2/base.py index c2482045a65..bec1a62197d 100644 --- a/neutron/api/v2/base.py +++ b/neutron/api/v2/base.py @@ -674,7 +674,11 @@ class Controller(object): msg = _('The resource could not be found.') raise webob.exc.HTTPNotFound(msg) - obj_updater = getattr(self._plugin, action) + if self._native_bulk and hasattr(self._plugin, "%s_bulk" % action): + obj_updater = getattr(self._plugin, "%s_bulk" % action) + else: + obj_updater = getattr(self._plugin, action) + kwargs = {self._resource: body} if parent_id: kwargs[self._parent_id_name] = parent_id