Commit e9d622bc authored by Guido Trotter's avatar Guido Trotter
Browse files

gnt-instance: support no_PARAMETER value

Since parameters get set to False if a no_ is prefixed don't try to
interpret those boolean values, and pass them unchanged.

Reviewed-by: iustinp
parent 7a735d6a
...@@ -1182,19 +1182,21 @@ def SetInstanceParams(opts, args): ...@@ -1182,19 +1182,21 @@ def SetInstanceParams(opts, args):
return 1 return 1
for param in opts.beparams: for param in opts.beparams:
if opts.beparams[param].lower() == "default": if isinstance(opts.beparams[param], basestring):
opts.beparams[param] = constants.VALUE_DEFAULT if opts.beparams[param].lower() == "default":
elif opts.beparams[param].lower() == "none": opts.beparams[param] = constants.VALUE_DEFAULT
opts.beparams[param] = constants.VALUE_NONE elif opts.beparams[param].lower() == "none":
elif param == constants.BE_MEMORY: opts.beparams[param] = constants.VALUE_NONE
opts.beparams[constants.BE_MEMORY] = \ elif param == constants.BE_MEMORY:
utils.ParseUnit(opts.beparams[constants.BE_MEMORY]) opts.beparams[constants.BE_MEMORY] = \
for param in opts.hypervisor: for param in opts.hypervisor:
if opts.hypervisor[param].lower() == "default": if isinstance(opts.hypervisor[param], basestring):
opts.hypervisor[param] = constants.VALUE_DEFAULT if opts.hypervisor[param].lower() == "default":
elif opts.hypervisor[param].lower() == "none": opts.hypervisor[param] = constants.VALUE_DEFAULT
opts.hypervisor[param] = constants.VALUE_NONE elif opts.hypervisor[param].lower() == "none":
opts.hypervisor[param] = constants.VALUE_NONE
for idx, (nic_op, nic_dict) in enumerate(opts.nics): for idx, (nic_op, nic_dict) in enumerate(opts.nics):
try: 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