From 6ea2bb8c9f47ab3109312b54c506b58cf1eb0fdb Mon Sep 17 00:00:00 2001 From: Bernardo Dal Seno <bdalseno@google.com> Date: Mon, 25 Feb 2013 14:16:40 +0100 Subject: [PATCH] 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 2cc673a3e (and released with 2.6.0). Added QA for this and another similar case. Signed-off-by: Bernardo Dal Seno <bdalseno@google.com> Reviewed-by: Guido Trotter <ultrotter@google.com> --- lib/cmdlib.py | 2 +- qa/qa_group.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index e9a820b41..e3b8927ef 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -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): diff --git a/qa/qa_group.py b/qa/qa_group.py index 2e872ba29..67211b22a 100644 --- a/qa/qa_group.py +++ b/qa/qa_group.py @@ -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"): -- GitLab