Testing: Add Python IP allocation simulation.
[metze/ctdb/wip.git] / tests / takeover / node_pool_simple.py
1 #!/usr/bin/env python
2
3 # This example demonstrates a simple, sensible node pool
4 # configuration.  When run with deterministic IPs (use "-d" to show
5 # the problem) it does many gratuitous IP reassignments.
6
7 from ctdb_takeover import Cluster, Node
8
9 addresses1 = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']
10 addresses2 = ['I', 'J', 'K']
11
12 c = Cluster()
13
14 for i in range(4):
15     c.add_node(Node(addresses1))
16
17 for i in range(3):
18     c.add_node(Node(addresses2))
19
20 c.add_node(Node([]))
21
22 c.recover()
23
24 c.random_iterations()