commit f1f478b8d9f3014ef39aae19302587fa9f25c83e
Author: Jiri Pirko <jiri(a)resnulli.us>
Date: Mon Sep 29 14:07:22 2014 +0200
NetTestController: make "packet_capture" a constructor parameter
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst-ctl | 3 ++-
lnst/Controller/NetTestController.py | 8 +++++---
2 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/lnst-ctl b/lnst-ctl
index 71d5522..0ee16f1 100755
--- a/lnst-ctl
+++ b/lnst-ctl
@@ -76,11 +76,12 @@ def process_recipe(action, file_path, log_ctl, res_serializer,
nettestctl = NetTestController(file_path, log_ctl,
res_serializer=res_serializer,
pool_checks=pool_checks,
+ packet_capture=packet_capture,
defined_aliases=defined_aliases,
overriden_aliases=overriden_aliases,
reduce_sync=reduce_sync)
if action == "run":
- return nettestctl.run_recipe(packet_capture)
+ return nettestctl.run_recipe()
elif action == "config_only":
return nettestctl.config_only_recipe()
elif action == "match_setup":
diff --git a/lnst/Controller/NetTestController.py b/lnst/Controller/NetTestController.py
index 0848a22..da7df41 100644
--- a/lnst/Controller/NetTestController.py
+++ b/lnst/Controller/NetTestController.py
@@ -51,6 +51,7 @@ def ignore_event(**kwarg):
class NetTestController:
def __init__(self, recipe_path, log_ctl,
res_serializer=None, pool_checks=True,
+ packet_capture=False,
defined_aliases=None, overriden_aliases=None,
reduce_sync=False):
self._res_serializer = res_serializer
@@ -58,6 +59,7 @@ class NetTestController:
self._log_ctl = log_ctl
self._recipe_path = recipe_path
self._msg_dispatcher = MessageDispatcher(log_ctl)
+ self._packet_capture = packet_capture
self._reduce_sync = reduce_sync
self._parser = RecipeParser(recipe_path)
@@ -593,7 +595,7 @@ class NetTestController:
self._cleanup_slaves(deconfigure=False)
return {"passed": True}
- def run_recipe(self, packet_capture=False):
+ def run_recipe(self):
try:
self._prepare_provisioning()
self._prepare_tasks()
@@ -604,7 +606,7 @@ class NetTestController:
self._cleanup_slaves()
raise
- if packet_capture:
+ if self._packet_capture:
self._start_packet_capture()
err = None
@@ -614,7 +616,7 @@ class NetTestController:
logging.error("Recipe execution terminated by unexpected
exception")
raise
finally:
- if packet_capture:
+ if self._packet_capture:
self._stop_packet_capture()
self._gather_capture_files()
self._cleanup_slaves()
Show replies by date