diff --git a/lib/cli.py b/lib/cli.py index 9d304055bec855346df8f2d89e06f88d52b00998..f288cb1cea1615ad5d0be3825b279b16e25d84a3 100644 --- a/lib/cli.py +++ b/lib/cli.py @@ -159,6 +159,7 @@ __all__ = [ "SUBMIT_OPT", "STATIC_OPT", "SYNC_OPT", + "TAG_ADD_OPT", "TAG_SRC_OPT", "TIMEOUT_OPT", "UIDPOOL_OPT", @@ -657,6 +658,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") @@ -2117,6 +2122,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) @@ -2160,6 +2170,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) diff --git a/lib/client/gnt_instance.py b/lib/client/gnt_instance.py index f132ee4de0ee70505f5e08b2e32f9b09f4214bcf..1e529acd772997dd5a6d5204b37baff8aaf8b227 100644 --- a/lib/client/gnt_instance.py +++ b/lib/client/gnt_instance.py @@ -1387,6 +1387,7 @@ add_opts = [ OS_OPT, FORCE_VARIANT_OPT, NO_INSTALL_OPT, + TAG_ADD_OPT, ] commands = {