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

gnt-cluster, pass hvparams directly to dict()

If hvparams is not set it will be [], so dict() will transform it to an
empty dict, which is safe in all cases.

Reviewed-by: iustinp
parent f2ffd244
...@@ -69,13 +69,7 @@ def InitCluster(opts, args): ...@@ -69,13 +69,7 @@ def InitCluster(opts, args):
(opts.default_hypervisor, hvlist)) (opts.default_hypervisor, hvlist))
return 1 return 1
hvparams = opts.hvparams hvparams = dict(opts.hvparams)
if hvparams:
# a list of (name, dict) we can pass directly to dict()
hvparams = dict(opts.hvparams)
else:
# otherwise init as empty dict
hvparams = {}
beparams = opts.beparams beparams = opts.beparams
# check for invalid parameters # check for invalid parameters
...@@ -473,10 +467,8 @@ def SetClusterParams(opts, args): ...@@ -473,10 +467,8 @@ def SetClusterParams(opts, args):
if hvlist is not None: if hvlist is not None:
hvlist = hvlist.split(",") hvlist = hvlist.split(",")
hvparams = opts.hvparams # a list of (name, dict) we can pass directly to dict() (or [])
if hvparams: hvparams = dict(opts.hvparams)
# a list of (name, dict) we can pass directly to dict()
hvparams = dict(opts.hvparams)
for hv, hv_params in hvparams.iteritems(): for hv, hv_params in hvparams.iteritems():
utils.ForceDictType(hv_params, constants.HVS_PARAMETER_TYPES) utils.ForceDictType(hv_params, constants.HVS_PARAMETER_TYPES)
......
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