# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
+"""Debugging commands"""
-# pylint: disable-msg=W0401,W0614
+# pylint: disable-msg=W0401,W0614,C0103
# W0401: Wildcard import ganeti.cli
# W0614: Unused import %s from wildcard import (since we need cli)
+# C0103: Invalid name gnt-backup
import sys
import simplejson
from ganeti.cli import *
from ganeti import cli
from ganeti import opcodes
-from ganeti import constants
from ganeti import utils
from ganeti import errors
delay = float(args[0])
op = opcodes.OpTestDelay(duration=delay,
on_master=opts.on_master,
- on_nodes=opts.on_nodes)
- SubmitOpCode(op)
+ on_nodes=opts.on_nodes,
+ repeat=opts.repeat)
+ SubmitOpCode(op, opts=opts)
return 0
def GenericOpCodes(opts, args):
"""Send any opcode to the master.
- @todo: The function is broken and needs to be converted to the
- current job queue API
@param opts: the command line options selected by the user
@type args: list
@param args: should contain only one element, the path of
"""
cl = cli.GetClient()
- jex = cli.JobExecutor(cl=cl, verbose=opts.verbose)
+ jex = cli.JobExecutor(cl=cl, verbose=opts.verbose, opts=opts)
job_cnt = 0
op_cnt = 0
ToStdout("Loading...")
for job_idx in range(opts.rep_job):
for fname in args:
+ # pylint: disable-msg=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
t1 = time.time()
ToStdout("Submitting...")
- jex.SubmitPending()
+ jex.SubmitPending(each=opts.each)
if opts.timing_stats:
t2 = time.time()
op = opcodes.OpTestAllocator(mode=opts.mode,
name=args[0],
+ evac_nodes=args,
mem_size=opts.mem,
disks=disks,
disk_template=opts.disk_template,
nics=nic_dict,
- os=opts.os_type,
+ os=opts.os,
vcpus=opts.vcpus,
tags=opts.tags,
direction=opts.direction,
- allocator=opts.allocator,
+ allocator=opts.iallocator,
)
- result = SubmitOpCode(op)
+ result = SubmitOpCode(op, opts=opts)
ToStdout("%s" % result)
return 0
action="store_false", help="Do not sleep in the master code"),
cli_option("-n", dest="on_nodes", default=[],
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"),
],
"[opts...] <duration>", "Executes a TestDelay OpCode"),
'submit-job': (
help="Repeat the job this number of times"),
cli_option("--timing-stats", default=False,
action="store_true", help="Show timing stats"),
+ cli_option("--each", default=False, action="store_true",
+ help="Submit each job separately"),
],
"<op_list_file...>", "Submits jobs built from json files"
" containing a list of serialized opcodes"),
'allocator': (
- TestAllocator, ARGS_ONE_INSTANCE,
+ TestAllocator, [ArgUnknown(min=1)],
[cli_option("--dir", dest="direction",
default="in", choices=["in", "out"],
help="Show allocator input (in) or allocator"
" results (out)"),
IALLOCATOR_OPT,
cli_option("-m", "--mode", default="relocate",
- choices=["relocate", "allocate"],
+ choices=["relocate", "allocate", "multi-evacuate"],
help="Request mode, either allocate or relocate"),
cli_option("--mem", default=128, type="unit",
help="Memory size for the instance (MiB)"),