From cced4c39ded685daefa063a0fc57b6db9d79fbca Mon Sep 17 00:00:00 2001 From: Iustin Pop Date: Thu, 11 Mar 2010 09:48:54 +0100 Subject: [PATCH] Validate the os-specific hypervisor parameters MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This adds a validation similar to the one for cluster-wide hypervisor paramters. Signed-off-by: Iustin Pop Reviewed-by: René Nussbaumer --- lib/cmdlib.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 39e7d06..b9d4804 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -2110,6 +2110,20 @@ class LUSetClusterParams(LogicalUnit): hv_class.CheckParameterSyntax(hv_params) _CheckHVParams(self, node_list, hv_name, hv_params) + if self.op.os_hvp: + # no need to check any newly-enabled hypervisors, since the + # defaults have already been checked in the above code-block + for os_name, os_hvp in self.new_os_hvp.items(): + for hv_name, hv_params in os_hvp.items(): + utils.ForceDictType(hv_params, constants.HVS_PARAMETER_TYPES) + # we need to fill in the new os_hvp on top of the actual hv_p + cluster_defaults = self.new_hvparams.get(hv_name, {}) + new_osp = objects.FillDict(cluster_defaults, hv_params) + hv_class = hypervisor.GetHypervisor(hv_name) + hv_class.CheckParameterSyntax(new_osp) + _CheckHVParams(self, node_list, hv_name, new_osp) + + def Exec(self, feedback_fn): """Change the parameters of the cluster. -- 1.7.10.4