Commit a57981c5 authored by Apollon Oikonomopoulos's avatar Apollon Oikonomopoulos Committed by Iustin Pop
Browse files

Add tagging option to gnt-instance create



Add TAG_ADD_OPT option to cli.py and use it in gnt-instance. Modify
cli.GenericInstanceCreate() accordingly.
Signed-off-by: default avatarApollon Oikonomopoulos <apollon@noc.grnet.gr>
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 720f56c8
......@@ -162,6 +162,7 @@ __all__ = [
"SUBMIT_OPT",
"STATIC_OPT",
"SYNC_OPT",
"TAG_ADD_OPT",
"TAG_SRC_OPT",
"TIMEOUT_OPT",
"UIDPOOL_OPT",
......@@ -634,6 +635,10 @@ IGNORE_OFFLINE_OPT = cli_option("--ignore-offline", dest="ignore_offline",
help=("Ignore offline nodes and do as much"
" as possible"))
TAG_ADD_OPT = cli_option("--tags", dest="tags",
default=None, help="Comma-separated list of instance"
" tags")
TAG_SRC_OPT = cli_option("--from", dest="tags_source",
default=None, help="File with tag names")
......@@ -2113,6 +2118,11 @@ def GenericInstanceCreate(mode, opts, args):
" disk %d" % didx)
disks[didx] = ddict
if opts.tags is not None:
tags = opts.tags.split(',')
else:
tags = []
utils.ForceDictType(opts.beparams, constants.BES_PARAMETER_TYPES)
utils.ForceDictType(hvparams, constants.HVS_PARAMETER_TYPES)
......@@ -2156,6 +2166,7 @@ def GenericInstanceCreate(mode, opts, args):
force_variant=force_variant,
src_node=src_node,
src_path=src_path,
tags=tags,
no_install=no_install,
identify_defaults=identify_defaults)
......
......@@ -1357,6 +1357,7 @@ add_opts = [
OS_OPT,
FORCE_VARIANT_OPT,
NO_INSTALL_OPT,
TAG_ADD_OPT,
]
commands = {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment