#
#
-# Copyright (C) 2006, 2007, 2008, 2009, 2010 Google Inc.
+# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 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
_SHUTDOWN_NODES_SEC_BY_TAGS)
-_VALUE_TRUE = "true"
-
#: default list of options for L{ListInstances}
_LIST_DEF_FIELDS = [
"name", "hypervisor", "os", "pnode", "status", "oper_ram",
@raise errors.OpPrereqError: in case any instance is missing
"""
- # TODO: change LUQueryInstances to that it actually returns None
+ # TODO: change LUInstanceQuery to that it actually returns None
# instead of raising an exception, or devise a better mechanism
result = client.QueryInstances(names, ["name"], False)
for orig_name, row in zip(names, result):
# second, if requested, ask for an OS
if opts.select_os is True:
- op = opcodes.OpDiagnoseOS(output_fields=["name", "variants"], names=[])
+ op = opcodes.OpOsDiagnose(output_fields=["name", "variants"], names=[])
result = SubmitOpCode(op, opts=opts)
if not result:
jex = JobExecutor(verbose=multi_on, opts=opts)
for instance_name in inames:
- op = opcodes.OpReinstallInstance(instance_name=instance_name,
+ op = opcodes.OpInstanceReinstall(instance_name=instance_name,
os_type=os_name,
force_variant=opts.force_variant,
osparams=opts.osparams)
if not AskUser(usertext):
return 1
- op = opcodes.OpRemoveInstance(instance_name=instance_name,
+ op = opcodes.OpInstanceRemove(instance_name=instance_name,
ignore_failures=opts.ignore_failures,
shutdown_timeout=opts.shutdown_timeout)
SubmitOrSend(op, opts, cl=cl)
" that '%s' is a FQDN. Continue?" % args[1]):
return 1
- op = opcodes.OpRenameInstance(instance_name=args[0],
+ op = opcodes.OpInstanceRename(instance_name=args[0],
new_name=args[1],
ip_check=opts.ip_check,
name_check=opts.name_check)
"""
instance_name = args[0]
- op = opcodes.OpInstanceDeactivateDisks(instance_name=instance_name)
+ op = opcodes.OpInstanceDeactivateDisks(instance_name=instance_name,
+ force=opts.force)
SubmitOrSend(op, opts)
return 0
else:
opts.disks = []
- op = opcodes.OpRecreateInstanceDisks(instance_name=instance_name,
+ op = opcodes.OpInstanceRecreateDisks(instance_name=instance_name,
disks=opts.disks)
SubmitOrSend(op, opts)
return 0
raise errors.OpPrereqError("Invalid disk index: %s" % str(err),
errors.ECODE_INVAL)
amount = utils.ParseUnit(args[2])
- op = opcodes.OpGrowDisk(instance_name=instance, disk=disk, amount=amount,
- wait_for_sync=opts.wait_for_sync)
+ op = opcodes.OpInstanceGrowDisk(instance_name=instance,
+ disk=disk, amount=amount,
+ wait_for_sync=opts.wait_for_sync)
SubmitOrSend(op, opts)
return 0
@return: the opcode needed for the operation
"""
- op = opcodes.OpStartupInstance(instance_name=name,
+ op = opcodes.OpInstanceStartup(instance_name=name,
force=opts.force,
ignore_offline_nodes=opts.ignore_offline)
# do not add these parameters to the opcode unless they're defined
@return: the opcode needed for the operation
"""
- return opcodes.OpRebootInstance(instance_name=name,
+ return opcodes.OpInstanceReboot(instance_name=name,
reboot_type=opts.reboot_type,
ignore_secondaries=opts.ignore_secondaries,
shutdown_timeout=opts.shutdown_timeout)
@return: the opcode needed for the operation
"""
- return opcodes.OpShutdownInstance(instance_name=name,
+ return opcodes.OpInstanceShutdown(instance_name=name,
timeout=opts.timeout,
ignore_offline_nodes=opts.ignore_offline)
# replace secondary
mode = constants.REPLACE_DISK_CHG
- op = opcodes.OpReplaceDisks(instance_name=args[0], disks=disks,
- remote_node=new_2ndary, mode=mode,
- iallocator=iallocator,
- early_release=opts.early_release)
+ op = opcodes.OpInstanceReplaceDisks(instance_name=args[0], disks=disks,
+ remote_node=new_2ndary, mode=mode,
+ iallocator=iallocator,
+ early_release=opts.early_release)
SubmitOrSend(op, opts)
return 0
else:
mode = opts.migration_mode
- op = opcodes.OpMigrateInstance(instance_name=instance_name, mode=mode,
+ op = opcodes.OpInstanceMigrate(instance_name=instance_name, mode=mode,
cleanup=opts.cleanup)
SubmitOpCode(op, cl=cl, opts=opts)
return 0
if not AskUser(usertext):
return 1
- op = opcodes.OpMoveInstance(instance_name=instance_name,
+ op = opcodes.OpInstanceMove(instance_name=instance_name,
target_node=opts.node,
shutdown_timeout=opts.shutdown_timeout)
SubmitOrSend(op, opts, cl=cl)
return 1
retcode = 0
- op = opcodes.OpQueryInstanceData(instances=args, static=opts.static)
+ op = opcodes.OpInstanceQueryData(instances=args, static=opts.static)
result = SubmitOpCode(op, opts=opts)
if not result:
ToStdout("No instances.")
" specifying a secondary node")
return 1
- op = opcodes.OpSetInstanceParams(instance_name=args[0],
+ op = opcodes.OpInstanceSetParams(instance_name=args[0],
nics=opts.nics,
disks=opts.disks,
disk_template=opts.disk_template,
"<instance>", "Activate an instance's disks"),
'deactivate-disks': (
DeactivateDisks, ARGS_ONE_INSTANCE,
- [SUBMIT_OPT, DRY_RUN_OPT, PRIORITY_OPT],
- "<instance>", "Deactivate an instance's disks"),
+ [FORCE_OPT, SUBMIT_OPT, DRY_RUN_OPT, PRIORITY_OPT],
+ "[-f] <instance>", "Deactivate an instance's disks"),
'recreate-disks': (
RecreateDisks, ARGS_ONE_INSTANCE,
[SUBMIT_OPT, DISKIDX_OPT, DRY_RUN_OPT, PRIORITY_OPT],