From 633055f65d4f8bd32f7de0a1df3251b8008fa355 Mon Sep 17 00:00:00 2001 From: Hongbin Lu Date: Sat, 16 Apr 2016 14:51:23 -0400 Subject: [PATCH] Copy logs if test failed and bay nodes existed If the bay is pending on CREATE_IN_PROCESS, it won't contain the IP addresses of the nodes. Therefore, we need to get them from the Heat stack if missing. Closes-Bug: #1571272 Change-Id: I487f9000b4c229be3e1b576258473e39cda66f9e --- magnum/tests/functional/common/base.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/magnum/tests/functional/common/base.py b/magnum/tests/functional/common/base.py index 5ff303a..1620580 100644 --- a/magnum/tests/functional/common/base.py +++ b/magnum/tests/functional/common/base.py @@ -185,7 +185,7 @@ class BaseMagnumTest(base.BaseTestCase): def int_copy_logs(exec_info): try: - cls.LOG.debug("Copying logs...") + cls.LOG.info("Copying logs...") fn = exec_info[2].tb_frame.f_locals['fn'] func_name = fn.im_self._get_test_method().__name__ msg = "Failed to copy logs for bay" @@ -199,6 +199,8 @@ class BaseMagnumTest(base.BaseTestCase): full_location = os.path.join(base_path, COPY_LOG_HELPER) def do_copy_logs(prefix, nodes_address): + cls.LOG.info("copy logs from : %s" % + ','.join(nodes_address)) log_name = prefix + "-" + func_name for node_address in nodes_address: try: @@ -212,7 +214,7 @@ class BaseMagnumTest(base.BaseTestCase): str(keypair) ]) except Exception: - cls.LOG.exception(msg) + cls.LOG.error(msg) cls.LOG.exception( "failed to copy from %s to %s%s-%s" % (node_address, "/opt/stack/logs/bay-nodes/",