summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHongbin Lu <hongbin.lu@huawei.com>2018-08-09 21:02:01 +0000
committerHongbin Lu <hongbin.lu@huawei.com>2018-08-10 15:44:50 +0000
commit38309ca4dc79e033a7b8384f4e9f1224c5a69524 (patch)
tree97c641bbe74b367ba9088702506b88dfe0c657ba
parent5226e50c68084dd3d76861d1247f9f292949b616 (diff)
Update metering driver to load interface driver
Currently the metering iptables driver is using the old method to load the interface driver. This patch allows it to load interface driver via stevedore aliases. Change-Id: I9e3027c1ec695ec3a09db0c53a0388e406e4ced6 Related-Bug: #1504536
Notes
Notes (review): Code-Review+2: Akihiro Motoki <amotoki@gmail.com> Code-Review+1: Nate Johnston <nate.johnston@redhat.com> Code-Review+1: Yushiro FURUKAWA <y.furukawa_2@jp.fujitsu.com> Verified+1: Mellanox CI <mlnx-openstack-ci@dev.mellanox.co.il> Code-Review+2: Brian Haley <haleyb.dev@gmail.com> Workflow+1: Akihiro Motoki <amotoki@gmail.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Sat, 11 Aug 2018 14:41:34 +0000 Reviewed-on: https://review.openstack.org/590514 Project: openstack/neutron Branch: refs/heads/master
-rw-r--r--neutron/services/metering/drivers/iptables/iptables_driver.py9
-rw-r--r--releasenotes/notes/metering-iptables-driver-load-interface-driver-ca397f1db40ec643.yaml7
2 files changed, 9 insertions, 7 deletions
diff --git a/neutron/services/metering/drivers/iptables/iptables_driver.py b/neutron/services/metering/drivers/iptables/iptables_driver.py
index e00d515..69c3955 100644
--- a/neutron/services/metering/drivers/iptables/iptables_driver.py
+++ b/neutron/services/metering/drivers/iptables/iptables_driver.py
@@ -15,9 +15,8 @@
15from oslo_config import cfg 15from oslo_config import cfg
16from oslo_log import helpers as log_helpers 16from oslo_log import helpers as log_helpers
17from oslo_log import log as logging 17from oslo_log import log as logging
18from oslo_utils import importutils
19 18
20from neutron._i18n import _ 19from neutron.agent.common import utils as common_utils
21from neutron.agent.l3 import dvr_snat_ns 20from neutron.agent.l3 import dvr_snat_ns
22from neutron.agent.l3 import namespaces 21from neutron.agent.l3 import namespaces
23from neutron.agent.linux import ip_lib 22from neutron.agent.linux import ip_lib
@@ -107,11 +106,7 @@ class IptablesMeteringDriver(abstract_driver.MeteringAbstractDriver):
107 self.conf = conf or cfg.CONF 106 self.conf = conf or cfg.CONF
108 self.routers = {} 107 self.routers = {}
109 108
110 if not self.conf.interface_driver: 109 self.driver = common_utils.load_interface_driver(self.conf)
111 raise SystemExit(_('An interface driver must be specified'))
112 LOG.info("Loading interface driver %s", self.conf.interface_driver)
113 self.driver = importutils.import_object(self.conf.interface_driver,
114 self.conf)
115 110
116 def _update_router(self, router): 111 def _update_router(self, router):
117 r = self.routers.get(router['id'], 112 r = self.routers.get(router['id'],
diff --git a/releasenotes/notes/metering-iptables-driver-load-interface-driver-ca397f1db40ec643.yaml b/releasenotes/notes/metering-iptables-driver-load-interface-driver-ca397f1db40ec643.yaml
new file mode 100644
index 0000000..997b232
--- /dev/null
+++ b/releasenotes/notes/metering-iptables-driver-load-interface-driver-ca397f1db40ec643.yaml
@@ -0,0 +1,7 @@
1---
2other:
3 - |
4 The metering agent iptables driver can now load its interface driver by
5 using a stevedore alias in the ``metering_agent.ini`` file. For example,
6 ``interface_driver = openvswitch`` instead of
7 ``interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver``