summaryrefslogtreecommitdiffstats
path: root/ctdb/tests/takeover
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2011-07-21 15:53:35 +1000
committerMartin Schwenke <martin@meltin.net>2011-07-29 14:32:07 +1000
commit540c2cbcfd1cae51807200c543f2417bc35ed227 (patch)
tree8772eaf4efe2c70c8dbdc9087bea4a702c18eca8 /ctdb/tests/takeover
parenta17ae8a8bed982b9ecd064ccca0be88a61d2ec85 (diff)
downloadsamba-540c2cbcfd1cae51807200c543f2417bc35ed227.tar.gz
samba-540c2cbcfd1cae51807200c543f2417bc35ed227.tar.xz
samba-540c2cbcfd1cae51807200c543f2417bc35ed227.zip
IP allocation simulation - add debug output using -vv.
-v can now be provided more than once to increase verbosity. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit ce4fb56c9972a854bd139429b6f4a26e8d5c3956)
Diffstat (limited to 'ctdb/tests/takeover')
-rwxr-xr-xctdb/tests/takeover/ctdb_takeover.py28
1 files changed, 22 insertions, 6 deletions
diff --git a/ctdb/tests/takeover/ctdb_takeover.py b/ctdb/tests/takeover/ctdb_takeover.py
index b87e35f29f..aecb8e302e 100755
--- a/ctdb/tests/takeover/ctdb_takeover.py
+++ b/ctdb/tests/takeover/ctdb_takeover.py
@@ -54,7 +54,7 @@ def process_args(extra_options=[]):
action="store_false", dest="show", default=True,
help="don't show IP address layout after each event")
parser.add_option("-v", "--verbose",
- action="store_true", dest="verbose", default=False,
+ action="count", dest="verbose", default=0,
help="print information and actions taken to stdout")
parser.add_option("--hack",
action="store", type="int", dest="hack", default=0,
@@ -85,23 +85,39 @@ def process_args(extra_options=[]):
if len(args) != 0:
parser.error("too many argumentss")
-def print_begin(t):
- print "=" * 40
+def print_begin(t, delim='='):
+ print delim * 40
print "%s:" % (t)
def print_end():
print "-" * 40
def verbose_begin(t):
- if options.verbose:
+ if options.verbose > 0:
print_begin(t)
def verbose_end():
- if options.verbose:
+ if options.verbose > 0:
print_end()
def verbose_print(t):
- if options.verbose:
+ if options.verbose > 0:
+ if not type(t) == list:
+ t = [t]
+ if t != []:
+ print "\n".join([str(i) for i in t])
+
+# more than this and we switch to the logging module... :-)
+def debug_begin(t):
+ if options.verbose > 1:
+ print_begin(t, '-')
+
+def debug_end():
+ if options.verbose > 1:
+ print_end()
+
+def debug_print(t):
+ if options.verbose > 1:
if not type(t) == list:
t = [t]
if t != []: