From dd197db312f4bc5a2a661c86125b06d71c45e742 Mon Sep 17 00:00:00 2001 From: Toni Ylenius Date: Wed, 5 Aug 2015 15:06:00 +0300 Subject: [PATCH] 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 (cherry picked from commit 2bded62d6a6a141e610a06e5f40bb28c0b26da5c) --- neutron/cmd/usage_audit.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/neutron/cmd/usage_audit.py b/neutron/cmd/usage_audit.py index 72fdaf127..402d92c54 100644 --- a/neutron/cmd/usage_audit.py +++ b/neutron/cmd/usage_audit.py @@ -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}) -- 2.45.2