From 06073e857e3b518c7195d57306ae01793240c0c2 Mon Sep 17 00:00:00 2001 From: Guido Trotter <ultrotter@google.com> Date: Fri, 2 Oct 2009 16:47:36 +0100 Subject: [PATCH] Allow --force-variant for instance add/reinstall Passing this option makes an undeclared variant be passed to the os "as is", hoping it'll be able to figure it out (as per the design doc). Signed-off-by: Guido Trotter <ultrotter@google.com> Reviewed-by: Olivier Tharan <olive@google.com> --- lib/cli.py | 7 ++++++- scripts/gnt-instance | 10 +++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/cli.py b/lib/cli.py index d4dfee675..2d6e7f74a 100644 --- a/lib/cli.py +++ b/lib/cli.py @@ -62,6 +62,8 @@ __all__ = [ "FIELDS_OPT", "FILESTORE_DIR_OPT", "FILESTORE_DRIVER_OPT", + "FORCE_OPT", + "FORCE_VARIANT_OPT", "GLOBAL_FILEDIR_OPT", "HVLIST_OPT", "HVOPTS_OPT", @@ -71,7 +73,6 @@ __all__ = [ "IGNORE_FAILURES_OPT", "IGNORE_SECONDARIES_OPT", "IGNORE_SIZE_OPT", - "FORCE_OPT", "MAC_PREFIX_OPT", "MASTER_NETDEV_OPT", "MC_OPT", @@ -567,6 +568,10 @@ OS_OPT = cli_option("-o", "--os-type", dest="os", help="What OS to run", metavar="<os>", completion_suggest=OPT_COMPL_ONE_OS) +FORCE_VARIANT_OPT = cli_option("--force-variant", dest="force_variant", + action="store_true", default=False, + help="Force an unknown variant") + BACKEND_OPT = cli_option("-B", "--backend-parameters", dest="beparams", type="keyval", default={}, help="Backend parameters") diff --git a/scripts/gnt-instance b/scripts/gnt-instance index 062e02bbb..194e69771 100755 --- a/scripts/gnt-instance +++ b/scripts/gnt-instance @@ -440,6 +440,7 @@ def BatchCreate(opts, args): disk_template=specs['template'], mode=constants.INSTANCE_CREATE, os_type=specs['os'], + force_variant=opts.force_variant, pnode=specs['primary_node'], snode=specs['secondary_node'], nics=tmp_nics, @@ -529,7 +530,8 @@ def ReinstallInstance(opts, args): jex = JobExecutor(verbose=multi_on) for instance_name in inames: op = opcodes.OpReinstallInstance(instance_name=instance_name, - os_type=os_name) + os_type=os_name, + force_variant=opts.force_variant) jex.QueueJob(instance_name, op) jex.WaitOrShow(not opts.submit_only) @@ -1266,6 +1268,7 @@ add_opts = [ NOSTART_OPT, NWSYNC_OPT, OS_OPT, + FORCE_VARIANT_OPT, OS_SIZE_OPT, SUBMIT_OPT, ] @@ -1317,8 +1320,9 @@ commands = { ), 'reinstall': ( ReinstallInstance, [ArgInstance()], - [FORCE_OPT, OS_OPT, m_force_multi, m_node_opt, m_pri_node_opt, - m_sec_node_opt, m_clust_opt, m_inst_opt, SELECT_OS_OPT, SUBMIT_OPT], + [FORCE_OPT, OS_OPT, FORCE_VARIANT_OPT, m_force_multi, m_node_opt, + m_pri_node_opt, m_sec_node_opt, m_clust_opt, m_inst_opt, SELECT_OS_OPT, + SUBMIT_OPT], "[-f] <instance>", "Reinstall a stopped instance"), 'remove': ( RemoveInstance, ARGS_ONE_INSTANCE, -- GitLab