'Create ``per_node`` containers and datasets in each node of the
cluster.
:return Deferred: once all the requests to create the datasets and
containers are made.'

def deploy(self, per_node):

    d = self.client.list_nodes()
    def start_containers(nodes):
        Message.log(message_type='flocker.benchmark.container_setup:start', containers_per_node=per_node, total_nodes=len(nodes))
        total = (per_node * len(nodes))
        def log_progress():
            Message.log(message_type='flocker.benchmark.container_setup:progress', container_count=self.container_count, error_count=self.error_count, total_containers=total)
        loop = LoopingCall(log_progress)
        loop.start(10, now=False)
        deferred_list = []
        for node in nodes:
            d = succeed(None)
            for count in range(per_node):
                d.addCallback((lambda _ignore, n=node, i=count: self.create_stateful_container(n, i)))
            deferred_list.append(d)
        d = gather_deferreds(deferred_list)
        def stop_loop(result):
            loop.stop()
            return result
        d.addBoth(stop_loop)
        return d
    d.addCallback(start_containers)
    def log_totals(result):
        Message.log(message_type='flocker.benchmark.container_setup:finish', container_count=self.container_count, error_count=self.error_count)
        return result
    d.addBoth(log_totals)
    return d
