]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
usage_audit: Fix usage_audit to work with ML2
authorToni Ylenius <toni.ylenius@cybercom.com>
Wed, 5 Aug 2015 12:06:00 +0000 (15:06 +0300)
committerKyle Mestery <mestery@mestery.com>
Fri, 2 Oct 2015 15:59:19 +0000 (15:59 +0000)
The script didn't work with the ML2 plugin as router related
functionality is moved to the L3 router service plugin. The fix assumes
that the L3 router service plugin is in use, and this seems to apply to
most of the current core plugins.

Change-Id: If3eb7bde4a5b8b9ca2ac0bd7327325f6c0ad620a
Closes-Bug: 1481692
(cherry picked from commit 2bded62d6a6a141e610a06e5f40bb28c0b26da5c)

neutron/cmd/usage_audit.py

index 72fdaf127e18a7a529697b01c9d9fbced6b815fc..402d92c54239760c47a8ab7a44393417fe22a92a 100644 (file)
@@ -23,6 +23,7 @@ from neutron.common import config
 from neutron.common import rpc as n_rpc
 from neutron import context
 from neutron import manager
+from neutron.plugins.common import constants
 
 
 def main():
@@ -31,6 +32,8 @@ def main():
 
     cxt = context.get_admin_context()
     plugin = manager.NeutronManager.get_plugin()
+    l3_plugin = manager.NeutronManager.get_service_plugins().get(
+            constants.L3_ROUTER_NAT)
     notifier = n_rpc.get_notifier('network')
     for network in plugin.get_networks(cxt):
         notifier.info(cxt, 'network.exists', {'network': network})
@@ -38,7 +41,7 @@ def main():
         notifier.info(cxt, 'subnet.exists', {'subnet': subnet})
     for port in plugin.get_ports(cxt):
         notifier.info(cxt, 'port.exists', {'port': port})
-    for router in plugin.get_routers(cxt):
+    for router in l3_plugin.get_routers(cxt):
         notifier.info(cxt, 'router.exists', {'router': router})
-    for floatingip in plugin.get_floatingips(cxt):
+    for floatingip in l3_plugin.get_floatingips(cxt):
         notifier.info(cxt, 'floatingip.exists', {'floatingip': floatingip})