----- Original Message -----
From: "Ondrej Lichtner" <olichtne(a)redhat.com>
To: csfakian(a)redhat.com
Cc: lnst-developers(a)lists.fedorahosted.org
Sent: Friday, March 8, 2019 7:44:16 PM
Subject: Re: [PATCH-next 1/1] lnst.Recipes.ENRT: ensure deconfiguration stage
On Fri, Mar 08, 2019 at 01:03:10PM +0100, csfakian(a)redhat.com wrote:
> From: Christos Sfakianakis <csfakian(a)redhat.com>
>
> Add error handling in BaseEnrtRecipe to make sure hosts are
> deconfigured (e.g offloads back to all-'on', iptable rules
> reverted) in case of errors during perf tests (e.g iperf3:
> unrecognized option '--sctp').
>
> Signed-off-by: Christos Sfakianakis <csfakian(a)redhat.com>
> ---
> lnst/Recipes/ENRT/BaseEnrtRecipe.py | 34 +++++++++++++++--------------
> 1 file changed, 18 insertions(+), 16 deletions(-)
>
> diff --git a/lnst/Recipes/ENRT/BaseEnrtRecipe.py
> b/lnst/Recipes/ENRT/BaseEnrtRecipe.py
> index d97902a..43cfaa5 100644
> --- a/lnst/Recipes/ENRT/BaseEnrtRecipe.py
> +++ b/lnst/Recipes/ENRT/BaseEnrtRecipe.py
> @@ -96,22 +96,24 @@ class BaseEnrtRecipe(PingTestAndEvaluate, PerfRecipe):
> def test(self):
> main_config = self.test_wide_configuration()
>
> - for sub_config in self.generate_sub_configurations(main_config):
> - self.apply_sub_configuration(main_config, sub_config)
> -
> - for ping_config in
> self.generate_ping_configurations(main_config,
> -
> sub_config):
> - result = self.ping_test(ping_config)
> - self.ping_evaluate_and_report(ping_config, result)
> -
> - for perf_config in
> self.generate_perf_configurations(main_config,
> -
> sub_config):
> - result = self.perf_test(perf_config)
> - self.perf_report_and_evaluate(result)
> -
> - self.remove_sub_configuration(main_config, sub_config)
> -
> - self.test_wide_deconfiguration(main_config)
> + try:
> + for sub_config in
> self.generate_sub_configurations(main_config):
> + self.apply_sub_configuration(main_config, sub_config)
> +
> + for ping_config in
> self.generate_ping_configurations(main_config,
> +
> sub_config):
> + result = self.ping_test(ping_config)
> + self.ping_evaluate_and_report(ping_config, result)
> +
> + try:
I think this try: block should start right after the
apply_sub_configuration method call, just in case there's an exception
during the ping test...
Makes sense.
> > + for perf_config in
> > self.generate_perf_configurations(main_config,
> > +
> > sub_config):
> > + result = self.perf_test(perf_config)
> > + self.perf_report_and_evaluate(result)
> > + finally:
> > + self.remove_sub_configuration(main_config, sub_config)
> > + finally:
> > + self.test_wide_deconfiguration(main_config)
> >
> > def test_wide_configuration(self):
> > raise NotImplementedError("Method must be defined by a child
> > class.")
> > --
> > 2.17.1
> > _______________________________________________
> > LNST-developers mailing list -- lnst-developers(a)lists.fedorahosted.org
> > To unsubscribe send an email to
> > lnst-developers-leave(a)lists.fedorahosted.org
> > Fedora Code of Conduct:
https://getfedora.org/code-of-conduct.html
> > List Guidelines:
https://fedoraproject.org/wiki/Mailing_list_guidelines
> > List Archives:
> >
https://lists.fedorahosted.org/archives/list/lnst-developers@lists.fedora...
>