]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Clarify message when no probes are cleared
authorJacek Swiderski <jacek.swiderski@codilime.com>
Wed, 27 Aug 2014 11:59:19 +0000 (13:59 +0200)
committerJacek Swiderski <jacek.swiderski@codilime.com>
Mon, 1 Sep 2014 16:21:30 +0000 (18:21 +0200)
Log number of probes which were deleted by
using neutron-debug probe-clear
Closes-Bug: #1333103

Change-Id: I5b53f0c4651c6df491d414d7d65f98c4a84a5987

neutron/debug/commands.py
neutron/debug/debug_agent.py

index 775b0fe758709be95f3317aa6fdaf1d57061fe24..464966d253a6e7f11c38a1376fd4f3805cd6205f 100644 (file)
@@ -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):
index cbcbbe306b463f4b3719d5936dab78118b052f96..c5d2d06ac4e057cfcbeb371571ee879a64dd0d81 100644 (file)
@@ -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'])