Commit eeaa5f6c authored by Bernardo Dal Seno's avatar Bernardo Dal Seno
Browse files

Remove duplicate filling of instance policy



Instance policy fields were manually filled in CreateIPolicyFromOpts() and
then filled again by the caller. Now they are filled once inside the
function.
Signed-off-by: default avatarBernardo Dal Seno <bdalseno@google.com>
Reviewed-by: default avatarHelga Velroyen <helgav@google.com>
parent a6fdce9e
......@@ -3739,16 +3739,6 @@ def CreateIPolicyFromOpts(ispecs_mem_size=None,
for key, val in specs.items(): # {min: .. ,max: .., std: ..}
ipolicy_out[key][name] = val
# no filldict for non-dicts
if not group_ipolicy and fill_all:
if ipolicy_disk_templates is None:
ipolicy_disk_templates = constants.DISK_TEMPLATES
if ipolicy_vcpu_ratio is None:
ipolicy_vcpu_ratio = \
constants.IPOLICY_DEFAULTS[constants.IPOLICY_VCPU_RATIO]
if ipolicy_spindle_ratio is None:
ipolicy_spindle_ratio = \
constants.IPOLICY_DEFAULTS[constants.IPOLICY_SPINDLE_RATIO]
if ipolicy_disk_templates is not None:
ipolicy_out[constants.IPOLICY_DTS] = list(ipolicy_disk_templates)
if ipolicy_vcpu_ratio is not None:
......@@ -3758,6 +3748,9 @@ def CreateIPolicyFromOpts(ispecs_mem_size=None,
assert not (frozenset(ipolicy_out.keys()) - constants.IPOLICY_ALL_KEYS)
if not group_ipolicy and fill_all:
ipolicy_out = objects.FillIPolicy(constants.IPOLICY_DEFAULTS, ipolicy_out)
return ipolicy_out
......
#
#
# Copyright (C) 2006, 2007, 2010, 2011, 2012 Google Inc.
# Copyright (C) 2006, 2007, 2010, 2011, 2012, 2013 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -144,7 +144,7 @@ def InitCluster(opts, args):
utils.ForceDictType(diskparams[templ], constants.DISK_DT_TYPES)
# prepare ipolicy dict
ipolicy_raw = CreateIPolicyFromOpts(
ipolicy = CreateIPolicyFromOpts(
ispecs_mem_size=opts.ispecs_mem_size,
ispecs_cpu_count=opts.ispecs_cpu_count,
ispecs_disk_count=opts.ispecs_disk_count,
......@@ -154,7 +154,6 @@ def InitCluster(opts, args):
ipolicy_vcpu_ratio=opts.ipolicy_vcpu_ratio,
ipolicy_spindle_ratio=opts.ipolicy_spindle_ratio,
fill_all=True)
ipolicy = objects.FillIPolicy(constants.IPOLICY_DEFAULTS, ipolicy_raw)
if opts.candidate_pool_size is None:
opts.candidate_pool_size = constants.MASTER_POOL_SIZE_DEFAULT
......
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