From: Toni Ylenius Date: Wed, 5 Aug 2015 12:06:00 +0000 (+0300) Subject: usage_audit: Fix usage_audit to work with ML2 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=2bded62d6a6a141e610a06e5f40bb28c0b26da5c;p=openstack-build%2Fneutron-build.git usage_audit: Fix usage_audit to work with ML2 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 --- diff --git a/neutron/cmd/usage_audit.py b/neutron/cmd/usage_audit.py index a1efa7e1e..631309b0e 100644 --- a/neutron/cmd/usage_audit.py +++ b/neutron/cmd/usage_audit.py @@ -24,6 +24,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(): @@ -32,6 +33,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}) @@ -39,7 +42,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})