Commit 467ae11e authored by Guido Trotter's avatar Guido Trotter
Browse files

SetInstanceParams: handle default/none values

If the hv/be parameter lowercase value is set to "default" we'll pass
constants.VALUE_DEFAULT, if it's set to "none" we'll pass
constants.VALUE_NONE.

Reviewed-by: imsnah
parent 021f5d6f
......@@ -1046,9 +1046,20 @@ def SetInstanceParams(opts, args):
ToStderr("Please give at least one of the parameters.")
return 1
if constants.BE_MEMORY in opts.beparams:
opts.beparams[constants.BE_MEMORY] = utils.ParseUnit(
opts.beparams[constants.BE_MEMORY])
for param in opts.beparams:
if opts.beparams[param].lower() == "default":
opts.beparams[param] = constants.VALUE_DEFAULT
elif opts.beparams[param].lower() == "none":
opts.beparams[param] = constants.VALUE_NONE
elif param == constants.BE_MEMORY:
opts.beparams[constants.BE_MEMORY] = \
utils.ParseUnit(opts.beparams[constants.BE_MEMORY])
for param in opts.hypervisor:
if opts.hypervisor[param].lower() == "default":
opts.hypervisor[param] = constants.VALUE_DEFAULT
elif opts.hypervisor[param].lower() == "none":
opts.hypervisor[param] = constants.VALUE_NONE
for idx, (nic_op, nic_dict) in enumerate(opts.nics):
try:
......
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