Commit 06073e85 authored by Guido Trotter's avatar Guido Trotter

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: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarOlivier Tharan <olive@google.com>
parent 47804ec9
......@@ -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")
......
......@@ -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,
......
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