SubmitOpCode(op)
+
def ImportInstance(opts, args):
"""Add an instance to the cluster.
"""
instance = args[0]
+ (pnode, snode) = SplitNodeOption(opts.node)
+
op = opcodes.OpCreateInstance(instance_name=instance, mem_size=opts.mem,
disk_size=opts.size, swap_size=opts.swap,
disk_template=opts.disk_template,
mode=constants.INSTANCE_IMPORT,
- pnode=opts.node, snode=opts.snode,
+ pnode=pnode, snode=snode,
vcpus=opts.vcpus, ip_check=opts.ip_check,
ip=opts.ip, bridge=opts.bridge, start=False,
src_node=opts.src_node, src_path=opts.src_dir,
return 0
-# options used in more than one cmd
-node_opt = make_option("-n", "--node", dest="node", help="Target node",
- metavar="<node>")
-
# this is defined separately due to readability only
import_opts = [
DEBUG_OPT,
- node_opt,
- cli_option("-s", "--os-size", dest="size", help="Disk size",
+ make_option("-n", "--node", dest="node",
+ help="Target node and optional secondary node",
+ metavar="<pnode>[:<snode>]"),
+ cli_option("-s", "--os-size", dest="size", help="Disk size, in MiB unless"
+ " a suffix is used",
default=20 * 1024, type="unit", metavar="<size>"),
cli_option("--swap-size", dest="swap", help="Swap size",
default=4 * 1024, type="unit", metavar="<size>"),
default='none', type="string", metavar="<ADDRESS>"),
make_option("--no-wait-for-sync", dest="wait_for_sync", default=True,
action="store_false", help="Don't wait for sync (DANGEROUS!)"),
- make_option("--secondary-node", dest="snode",
- help="Secondary node for remote_raid1 disk layout",
- metavar="<node>"),
make_option("-b", "--bridge", dest="bridge",
help="Bridge to connect this instance to",
default=None, metavar="<bridge>"),
commands = {
'list': (PrintExportList, ARGS_NONE,
[DEBUG_OPT,
- make_option("--nodes", dest="nodes", default=[], action="append",
- help="List only backups stored on these nodes"),
+ make_option("--node", dest="nodes", default=[], action="append",
+ help="List only backups stored on this node"
+ " (can be used multiple times)"),
],
"", "Lists instance exports available in the ganeti cluster"),
'export': (ExportInstance, ARGS_ONE,
- [node_opt, DEBUG_OPT, FORCE_OPT,
+ [DEBUG_OPT, FORCE_OPT,
+ make_option("-n", "--node", dest="node", help="Target node",
+ metavar="<node>"),
make_option("","--noshutdown", dest="shutdown",
action="store_false", default=True,
help="Don't shutdown the instance (unsafe)"), ],