Browse Source

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
tags/14.0.0.0b1
Hongbin Lu 9 months ago
parent
commit
38309ca4dc

+ 2
- 7
neutron/services/metering/drivers/iptables/iptables_driver.py View File

@@ -15,9 +15,8 @@
15 15
 from oslo_config import cfg
16 16
 from oslo_log import helpers as log_helpers
17 17
 from oslo_log import log as logging
18
-from oslo_utils import importutils
19 18
 
20
-from neutron._i18n import _
19
+from neutron.agent.common import utils as common_utils
21 20
 from neutron.agent.l3 import dvr_snat_ns
22 21
 from neutron.agent.l3 import namespaces
23 22
 from neutron.agent.linux import ip_lib
@@ -107,11 +106,7 @@ class IptablesMeteringDriver(abstract_driver.MeteringAbstractDriver):
107 106
         self.conf = conf or cfg.CONF
108 107
         self.routers = {}
109 108
 
110
-        if not self.conf.interface_driver:
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)
109
+        self.driver = common_utils.load_interface_driver(self.conf)
115 110
 
116 111
     def _update_router(self, router):
117 112
         r = self.routers.get(router['id'],

+ 7
- 0
releasenotes/notes/metering-iptables-driver-load-interface-driver-ca397f1db40ec643.yaml View File

@@ -0,0 +1,7 @@
1
+---
2
+other:
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``

Loading…
Cancel
Save