Commit d027b72b authored by Jose A. Lopes's avatar Jose A. Lopes

Fix instance create and import parameters

Move OS parameter related constants to 'ganeti.cli' so they are used
both by instance create and instance import from the CLI.
Signed-off-by: default avatarJose A. Lopes <jabolopes@google.com>
Reviewed-by: default avatarHelga Velroyen <helgav@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent 31d3b918
......@@ -1751,6 +1751,8 @@ COMMON_CREATE_OPTS = [
NONICS_OPT,
NWSYNC_OPT,
OSPARAMS_OPT,
OSPARAMS_PRIVATE_OPT,
OSPARAMS_SECRET_OPT,
OS_SIZE_OPT,
SUBMIT_OPT,
PRINT_JOBID_OPT,
......@@ -2755,6 +2757,9 @@ def GenericInstanceCreate(mode, opts, args):
utils.ForceDictType(hvparams, constants.HVS_PARAMETER_TYPES)
FixHvParams(hvparams)
osparams_private = opts.osparams_private or serializer.PrivateDict()
osparams_secret = opts.osparams_secret or serializer.PrivateDict()
if mode == constants.INSTANCE_CREATE:
start = opts.start
os_type = opts.os
......@@ -2778,9 +2783,6 @@ def GenericInstanceCreate(mode, opts, args):
else:
raise errors.ProgrammerError("Invalid creation mode %s" % mode)
osparams_private = opts.osparams_private or serializer.PrivateDict()
osparams_secret = opts.osparams_private or serializer.PrivateDict()
op = opcodes.OpInstanceCreate(instance_name=instance,
disks=disks,
disk_template=opts.disk_template,
......
......@@ -1488,7 +1488,7 @@ add_opts = [
commands = {
"add": (
AddInstance, [ArgHost(min=1, max=1)],
COMMON_CREATE_OPTS + add_opts + [OSPARAMS_PRIVATE_OPT, OSPARAMS_SECRET_OPT],
COMMON_CREATE_OPTS + add_opts,
"[...] -t disk-type -n node[:secondary-node] -o os-type <name>",
"Creates and adds a new instance to the cluster"),
"batch-create": (
......
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