Commit 6ea2bb8c authored by Bernardo Dal Seno's avatar Bernardo Dal Seno
Browse files

Fix restoring default instance specs in group policies

"default" was not accepted as a valid input value for instance specs in
group policies, due to a bug introduced in 2cc673a3

 (and released with
2.6.0). Added QA for this and another similar case.
Signed-off-by: default avatarBernardo Dal Seno <bdalseno@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 5dd7d15b
......@@ -827,10 +827,10 @@ def _GetUpdatedIPolicy(old_ipolicy, new_ipolicy, group_policy=False):
raise errors.OpPrereqError("Invalid key in new ipolicy: %s" % key,
errors.ECODE_INVAL)
if key in constants.IPOLICY_ISPECS:
utils.ForceDictType(value, constants.ISPECS_PARAMETER_TYPES)
ipolicy[key] = _GetUpdatedParams(old_ipolicy.get(key, {}), value,
use_none=use_none,
use_default=use_default)
utils.ForceDictType(ipolicy[key], constants.ISPECS_PARAMETER_TYPES)
else:
if (not value or value == [constants.VALUE_DEFAULT] or
value == constants.VALUE_DEFAULT):
......
......@@ -98,6 +98,12 @@ def TestGroupModify():
"min=%s,max=%s,std=0" % (min_v, max_v), group1], fail=True)
AssertCommand(["gnt-group", "modify", "--specs-mem-size",
"min=%s,max=%s" % (min_v, max_v), group1])
AssertCommand(["gnt-group", "modify", "--specs-mem-size",
"min=default,max=default", group1])
AssertCommand(["gnt-group", "modify", "--ipolicy-vcpu-ratio",
"3.5", group1])
AssertCommand(["gnt-group", "modify", "--ipolicy-vcpu-ratio",
"default", group1])
AssertCommand(["gnt-group", "modify",
"--node-parameters", "spindle_count=10", group1])
if qa_config.TestEnabled("htools"):
......
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