diff options
author | Martin Schwenke <martin@meltin.net> | 2010-08-02 15:46:23 +1000 |
---|---|---|
committer | Martin Schwenke <martin@meltin.net> | 2010-08-02 15:46:23 +1000 |
commit | 8cc6ed1d0e9a754c3540e7a4f135ad625a514c90 (patch) | |
tree | 257d2553be2c0d4292adaf98f86579014b25a474 /ctdb/tests | |
parent | 326514f15205a4bb4a6f75f0827ae42ee4046f2c (diff) | |
download | samba-8cc6ed1d0e9a754c3540e7a4f135ad625a514c90.tar.gz samba-8cc6ed1d0e9a754c3540e7a4f135ad625a514c90.tar.xz samba-8cc6ed1d0e9a754c3540e7a4f135ad625a514c90.zip |
Testing: IP allocation simulation - make usage/failure more obvious.
Tweak the usage message for -g option.
Print an error if no node groups defined, instead of curious Python
error.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 8b883eb9346b8278d268e35b56ac680cd9526b97)
Diffstat (limited to 'ctdb/tests')
-rwxr-xr-x | ctdb/tests/takeover/node_group.py | 8 | ||||
-rwxr-xr-x | ctdb/tests/takeover/node_pool_extra.py | 31 | ||||
-rwxr-xr-x | ctdb/tests/takeover/node_pool_simple.py | 26 |
3 files changed, 7 insertions, 58 deletions
diff --git a/ctdb/tests/takeover/node_group.py b/ctdb/tests/takeover/node_group.py index b0a5648539..bf7de58aa9 100755 --- a/ctdb/tests/takeover/node_group.py +++ b/ctdb/tests/takeover/node_group.py @@ -8,12 +8,14 @@ # reassignments. Running with --nd fixes this. import ctdb_takeover +import sys from optparse import make_option import string ctdb_takeover.process_args([ make_option("-g", "--group", - action="append", type="string", dest="groups"), + action="append", type="string", dest="groups", + help="define a node group using N@IPs syntax"), ]) def expand_range(r): @@ -32,6 +34,10 @@ def add_node_group(s): c = ctdb_takeover.Cluster() +if ctdb_takeover.options.groups is None: + print "Error: no node groups defined." + sys.exit(1) + for g in ctdb_takeover.options.groups: add_node_group(g) diff --git a/ctdb/tests/takeover/node_pool_extra.py b/ctdb/tests/takeover/node_pool_extra.py deleted file mode 100755 index b4ae892bcc..0000000000 --- a/ctdb/tests/takeover/node_pool_extra.py +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env python - -# This example demonstrates a node pool configuration. Is it meant to -# be the same as node_pool_simple.py, but with a couple of nodes added -# later, so they are listed after the management node. - -# When run with deterministic IPs (use "-d" to show the problem) it -# does many gratuitous IP reassignments. - -from ctdb_takeover import Cluster, Node, process_args - -process_args() - -addresses1 = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'] + ['P', 'Q', 'R', 'S', 'T', 'U'] -addresses2 = ['I', 'J', 'K', 'L'] - -c = Cluster() - -for i in range(4): - c.add_node(Node(addresses1)) - -for i in range(3): - c.add_node(Node(addresses2)) - -c.add_node(Node([])) -c.add_node(Node(addresses1)) -c.add_node(Node(addresses2)) - -c.recover() - -c.random_iterations() diff --git a/ctdb/tests/takeover/node_pool_simple.py b/ctdb/tests/takeover/node_pool_simple.py deleted file mode 100755 index 86c5d10fd4..0000000000 --- a/ctdb/tests/takeover/node_pool_simple.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python - -# This example demonstrates a simple, sensible node pool -# configuration. When run with deterministic IPs (use "-d" to show -# the problem) it does many gratuitous IP reassignments. - -from ctdb_takeover import Cluster, Node, process_args - -process_args() - -addresses1 = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'] -addresses2 = ['I', 'J', 'K'] - -c = Cluster() - -for i in range(4): - c.add_node(Node(addresses1)) - -for i in range(3): - c.add_node(Node(addresses2)) - -c.add_node(Node([])) - -c.recover() - -c.random_iterations() |