diff options
author | Martin Schwenke <martin@meltin.net> | 2010-08-03 11:51:14 +1000 |
---|---|---|
committer | Martin Schwenke <martin@meltin.net> | 2010-08-03 11:51:14 +1000 |
commit | 807567e9921c9db4c11e5a0ea3a4992baba8d9a2 (patch) | |
tree | 1ab34d67000b531dccc56c0834d9b96035f3bb0b /ctdb/tests/takeover | |
parent | 4ffb6495ff08e28a7a60bc3acf8e93b814665b6c (diff) | |
download | samba-807567e9921c9db4c11e5a0ea3a4992baba8d9a2.tar.gz samba-807567e9921c9db4c11e5a0ea3a4992baba8d9a2.tar.xz samba-807567e9921c9db4c11e5a0ea3a4992baba8d9a2.zip |
Testing: IP allocation simulation - add option to change odds of a failure.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit b2a2e301025d7fbfe5eeaac436693cde6d404490)
Diffstat (limited to 'ctdb/tests/takeover')
-rwxr-xr-x | ctdb/tests/takeover/ctdb_takeover.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/ctdb/tests/takeover/ctdb_takeover.py b/ctdb/tests/takeover/ctdb_takeover.py index f7b0175e8e0..b87e35f29ff 100755 --- a/ctdb/tests/takeover/ctdb_takeover.py +++ b/ctdb/tests/takeover/ctdb_takeover.py @@ -66,6 +66,9 @@ def process_args(extra_options=[]): action="store", type="int", dest="iterations", default=1000, help="number of iterations to run in test [default: %default]") + parser.add_option("-o", "--odds", + action="store", type="int", dest="odds", default=4, + help="make the chances of a failover 1 in ODDS [default: %default]") def seed_callback(option, opt, value, parser): random.seed(value) @@ -192,8 +195,8 @@ class Cluster(object): """Make a random node healthy or unhealthy. If all nodes are healthy or unhealthy, then invert one of - them. Otherwise, there's a 1/4 chance of making another node - unhealthy.""" + them. Otherwise, there's a 1 in options.odds chance of making + another node unhealthy.""" num_nodes = len(self.nodes) healthy_pnns = [i for (i,n) in enumerate(self.nodes) if n.healthy] @@ -203,7 +206,7 @@ class Cluster(object): self.unhealthy(random.randint(0, num_nodes-1)) elif num_healthy == 0: self.healthy(random.randint(0, num_nodes-1)) - elif random.randint(1, 4) == 1: + elif random.randint(1, options.odds) == 1: self.unhealthy(random.choice(healthy_pnns)) else: all_pnns = range(num_nodes) |