diff --git a/neutron/debug/commands.py b/neutron/debug/commands.py index 775b0fe75..464966d25 100644 --- a/neutron/debug/commands.py +++ b/neutron/debug/commands.py @@ -18,6 +18,7 @@ from neutronclient.common import utils from neutronclient.neutron import v2_0 as client from neutronclient.neutron.v2_0 import port +from neutron.openstack.common.gettextutils import _LI from neutron.openstack.common import log as logging @@ -102,8 +103,8 @@ class ClearProbe(ProbeCommand): def run(self, parsed_args): self.log.debug('run(%s)' % parsed_args) debug_agent = self.get_debug_agent() - debug_agent.clear_probe() - self.log.info(_('All Probes deleted ')) + cleared_probes_count = debug_agent.clear_probes() + self.log.info(_LI('%d probe(s) deleted') % cleared_probes_count) class ExecProbe(ProbeCommand): diff --git a/neutron/debug/debug_agent.py b/neutron/debug/debug_agent.py index cbcbbe306..c5d2d06ac 100644 --- a/neutron/debug/debug_agent.py +++ b/neutron/debug/debug_agent.py @@ -93,7 +93,8 @@ class NeutronDebugAgent(): network.subnets = obj_subnet return network - def clear_probe(self): + def clear_probes(self): + """Returns number of deleted probes""" ports = self.client.list_ports( device_id=socket.gethostname(), device_owner=[DEVICE_OWNER_NETWORK_PROBE, @@ -101,6 +102,7 @@ class NeutronDebugAgent(): info = ports['ports'] for port in info: self.delete_probe(port['id']) + return len(info) def delete_probe(self, port_id): port = dhcp.DictModel(self.client.show_port(port_id)['port'])