+ if node_success:
+ logger.console('All nodes are ready')
+ else:
+ raise RuntimeError('Failed to setup framework')
+
+
+class CleanupFramework(object):
+ """Clean up suite run on topology nodes."""
+
+ @staticmethod
+ def cleanup_framework(nodes):
+ """Perform cleaning on each node.
+
+ :param nodes: Topology nodes.
+ :type nodes: dict
+ :raises RuntimeError: If cleanup framework failed.
+ """
+ # Turn off logging since we use multiprocessing
+ log_level = BuiltIn().set_log_level('NONE')
+ params = (node for node in nodes.values())
+ pool = Pool(processes=len(nodes))
+ result = pool.map_async(cleanup_node, params)
+ pool.close()
+ pool.join()
+
+ # Turn on logging
+ BuiltIn().set_log_level(log_level)
+
+ logger.info(
+ 'Executing node cleanups in parallel, waiting for processes to end')
+ result.wait()
+
+ results = result.get()
+ node_success = all(results)
+ logger.info('Results: {0}'.format(results))
+
+ if node_success:
+ logger.console('All nodes cleaned up')
+ else:
+ raise RuntimeError('Failed to cleaned up framework')