commit 490df9f97f74316421cf06d4bb854e7e440dd845
Author: Radek Pazdera <rpazdera(a)redhat.com>
Date: Thu Jul 19 22:26:06 2012 +0200
NetTestController: Fix behavior of -c parameter
I "fixed" what I thought was a bad behavior of the cleanup option in
commit 791fd48e6a95a10dfef60ac442f2a34f225e672a [1]. As it turns out,
my understanding of the purpose of -c option was wrong and the current
behavior is in fact a regression.
This commit reverts the changes and takes the semantics of '-c' option
back to the original.
If you pass -c option to `nettestctl.py', the machines will be cleaned
up *before* the recipe is executed. The option now has no effect on the
cleanup, that takes place after the recipe was run. This is done always
automatically.
[1] NetTestController: Adding missing cleanup
https://fedorahosted.org/pipermail/lnst-developers/2012-June/000149.html
Reported-by: Jan Tluka <jtluka(a)redhat.com>
Signed-off-by: Radek Pazdera <rpazdera(a)redhat.com>
NetTest/NetTestController.py | 28 ++++++++++++++--------------
1 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/NetTest/NetTestController.py b/NetTest/NetTestController.py
index 4daf070..6c047d3 100644
--- a/NetTest/NetTestController.py
+++ b/NetTest/NetTestController.py
@@ -158,27 +158,25 @@ class NetTestController:
ip_addr = get_corespond_local_ip(hostname)
rpc.set_logging(ip_addr, LoggingServer.DEFAULT_PORT)
- def _cleanup_slave(self, machine_id):
- info = self._get_machineinfo(machine_id)
-
- if self._docleanup:
+ def _deconfigure_slaves(self):
+ for machine_id in self._recipe["machines"]:
+ info = self._get_machineinfo(machine_id)
rpc = self._get_machinerpc(machine_id)
for if_id in reversed(info["configured_interfaces"]):
rpc.deconfigure_interface(if_id)
- if self._remoteexec and "session" in info:
- info["session"].kill()
- info["session"].wait()
+ def _disconnect_slaves(self):
+ for machine_id in self._recipe["machines"]:
+ info = self._get_machineinfo(machine_id)
+ if self._remoteexec and "session" in info:
+ info["session"].kill()
+ info["session"].wait()
def _prepare(self):
# All the perparations are made within the recipe parsing
# This is achieved by handling parser events (by registering
self._ntparse.parse_recipe()
- def _cleanup(self):
- for machine_id in self._recipe["machines"]:
- self._cleanup_slave(machine_id)
-
def _run_command(self, command):
machine_id = command["machine_id"]
try:
@@ -236,12 +234,13 @@ class NetTestController:
def dump_recipe(self):
self._prepare()
pprint(self._recipe)
- self._cleanup()
+ self._deconfigure_slaves()
+ self._disconnect_slaves()
return True
def config_only_recipe(self):
self._prepare()
- self._cleanup()
+ self._disconnect_slaves()
return True
def run_recipe(self, packet_capture=False):
@@ -260,7 +259,8 @@ class NetTestController:
self._stop_packet_capture()
self._gather_capture_files()
- self._cleanup()
+ self._deconfigure_slaves()
+ self._disconnect_slaves()
if not err:
return res