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
This commit is contained in:
Hongbin Lu 2016-04-16 14:51:23 -04:00
parent 507d9d5247
commit 633055f65d

View File

@ -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/",