#
#
-# Copyright (C) 2006, 2007, 2010, 2011 Google Inc.
+# Copyright (C) 2006, 2007, 2010, 2011, 2012 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
"""Debugging commands"""
-# pylint: disable-msg=W0401,W0614,C0103
+# pylint: disable=W0401,W0614,C0103
# W0401: Wildcard import ganeti.cli
# W0614: Unused import %s from wildcard import (since we need cli)
# C0103: Invalid name gnt-backup
on_master=opts.on_master,
on_nodes=opts.on_nodes,
repeat=opts.repeat)
- SubmitOpCode(op, opts=opts)
+ SubmitOrSend(op, opts)
return 0
ToStdout("Loading...")
for job_idx in range(opts.rep_job):
for fname in args:
- # pylint: disable-msg=W0142
+ # pylint: disable=W0142
op_data = simplejson.loads(utils.ReadFile(fname))
op_list = [opcodes.OpCode.LoadOpCode(val) for val in op_data]
op_list = op_list * opts.rep_op
t3 = time.time()
ToStdout("C:op %4d" % op_cnt)
ToStdout("C:job %4d" % job_cnt)
- ToStdout("T:submit %4.4f" % (t2-t1))
- ToStdout("T:exec %4.4f" % (t3-t2))
- ToStdout("T:total %4.4f" % (t3-t1))
+ ToStdout("T:submit %4.4f" % (t2 - t1))
+ ToStdout("T:exec %4.4f" % (t3 - t2))
+ ToStdout("T:total %4.4f" % (t3 - t1))
return 0
vcpus=opts.vcpus,
tags=opts.tags,
direction=opts.direction,
- allocator=opts.iallocator,
+ iallocator=opts.iallocator,
evac_mode=opts.evac_mode,
- target_groups=target_groups)
+ target_groups=target_groups,
+ spindle_use=opts.spindle_use,
+ count=opts.count)
result = SubmitOpCode(op, opts=opts)
ToStdout("%s" % result)
return 0
SubmitOpCode(opcodes.OpTestDelay(duration=0, depends=[(-1, None)]), cl=cl)
except errors.GenericError, err:
if opts.debug:
- ToStdout("Ignoring error: %s", err)
+ ToStdout("Ignoring error for 'wrong dependencies' test: %s", err)
else:
raise errors.OpExecError("Submitting plain opcode with relative job ID"
" did not fail as expected")
cl.SubmitJob(ops)
except errors.GenericError, err:
if opts.debug:
- ToStdout("Ignoring error: %s", err)
+ ToStdout("Ignoring error for 'wrong priority' test: %s", err)
else:
raise errors.OpExecError("Submitting opcode with priority %s did not"
" fail when it should (allowed are %s)" %
result = cl.SubmitManyJobs(jobs)
if not (len(result) == 2 and
compat.all(len(i) == 2 for i in result) and
- compat.all(isinstance(i[1], basestring) for i in result) and
+ isinstance(result[0][1], int) and
+ isinstance(result[1][1], basestring) and
result[0][0] and not result[1][0]):
raise errors.OpExecError("Submitting multiple jobs did not work as"
" expected, result %s" % result)
TM_MULTISUCCESS,
TM_FAIL,
TM_PARTFAIL) = range(4)
- TM_ALL = frozenset([TM_SUCCESS, TM_MULTISUCCESS, TM_FAIL, TM_PARTFAIL])
+ TM_ALL = compat.UniqueFrozenset([
+ TM_SUCCESS,
+ TM_MULTISUCCESS,
+ TM_FAIL,
+ TM_PARTFAIL,
+ ])
for mode in TM_ALL:
test_messages = [
opcodes.OpTestJqueue(notify_waitlock=True,
notify_exec=True,
log_messages=test_messages,
- fail=fail)
+ fail=fail),
]
expect_messages = [test_messages]
expect_resultlen = 1
except errors.OpExecError, err:
if not fail:
raise
- ToStdout("Ignoring error: %s", err)
+ ToStdout("Ignoring error for 'job fail' test: %s", err)
else:
if fail:
raise errors.OpExecError("Job didn't fail when it should")
return 0
-def ListLocks(opts, args): # pylint: disable-msg=W0613
+def ListLocks(opts, args): # pylint: disable=W0613
"""List all locks.
@param opts: the command line options selected by the user
action="append", help="Select nodes to sleep on"),
cli_option("-r", "--repeat", type="int", default="0", dest="repeat",
help="Number of times to repeat the sleep"),
- DRY_RUN_OPT, PRIORITY_OPT,
+ DRY_RUN_OPT, PRIORITY_OPT, SUBMIT_OPT,
],
"[opts...] <duration>", "Executes a TestDelay OpCode"),
"submit-job": (
utils.CommaJoin(constants.IALLOCATOR_NEVAC_MODES))),
cli_option("--target-groups", help="Target groups for relocation",
default=[], action="append"),
+ cli_option("--spindle-use", help="How many spindles to use",
+ default=1, type="int"),
+ cli_option("--count", help="How many instances to allocate",
+ default=2, type="int"),
DRY_RUN_OPT, PRIORITY_OPT,
],
"{opts...} <instance>", "Executes a TestAllocator OpCode"),
"allocator": "iallocator",
}
+
def Main():
return GenericMain(commands, aliases=aliases)