From: Sridhar K. N. Rao Date: Wed, 21 Dec 2016 15:24:05 +0000 (+0530) Subject: pkt_gen: STC - Handle Results DB file synchronization failures. X-Git-Tag: danube.1.RC1~52^2 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=d478c32bd174a5bf19d1a3384bb3b4e03f442920;p=vswitchperf.git pkt_gen: STC - Handle Results DB file synchronization failures. If the downloading of results-database file fails, the CSV file and corresponding results are not generated - eventhough the test was successful. This small patch handles such cases. Updated the logging to be more explicit. JIRA: VSPERF-435 Change-Id: I14bf519fbca2ea362777e29920bc1759494965e0 Signed-off-by: Sridhar K. N. Rao --- diff --git a/tools/pkt_gen/testcenter/testcenter-rfc2544-rest.py b/tools/pkt_gen/testcenter/testcenter-rfc2544-rest.py index 538d8a8a..8da8ed17 100644 --- a/tools/pkt_gen/testcenter/testcenter-rfc2544-rest.py +++ b/tools/pkt_gen/testcenter/testcenter-rfc2544-rest.py @@ -490,8 +490,13 @@ def main(): resultsdb = args.results_dir + \ lab_server_resultsdb.split("/Results")[1] - logger.info( - "The local summary DB file has been saved to %s", resultsdb) + if not os.path.exists(resultsdb): + resultsdb = lab_server_resultsdb + logger.info("Failed to create the local summary DB File, using" + " the remote DB file instead.") + else: + logger.info( + "The local summary DB file has been saved to %s", resultsdb) # The returns the "RFC2544ThroughputTestResultDetailedSummaryView" # table view from the results database. diff --git a/tools/pkt_gen/testcenter/testcenter-rfc2889-rest.py b/tools/pkt_gen/testcenter/testcenter-rfc2889-rest.py index cfa425e8..ddb64562 100644 --- a/tools/pkt_gen/testcenter/testcenter-rfc2889-rest.py +++ b/tools/pkt_gen/testcenter/testcenter-rfc2889-rest.py @@ -265,8 +265,13 @@ def main(): resultsdb = args.results_dir + \ lab_server_resultsdb.split("/Results")[1] - logger.info( - "The local summary DB file has been saved to %s", resultsdb) + if not os.path.exists(resultsdb): + resultsdb = lab_server_resultsdb + logger.info("Failed to create the local summary DB file, using" + " the remote DB file instead.") + else: + logger.info( + "The local summary DB file has been saved to %s", resultsdb) resultsdict = ( stc.perform("QueryResult",