From 8705eb96e3d9c12096cd750ebc65edca23a0ea89 Mon Sep 17 00:00:00 2001 From: Iustin Pop Date: Tue, 14 Oct 2008 10:21:20 +0000 Subject: [PATCH] Fix a bug with instance creation and hvparameters When creating an instance, we need to check not the opcode hvparams, but the final, filled hvparams against validity. While we do this for the remote node calls (i.e. ValidateParams), we didn't do this for CheckParameterSyntax. Reviewed-by: imsnah --- lib/cmdlib.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index a3f5209..630ddc2 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -3218,7 +3218,8 @@ class LUCreateInstance(LogicalUnit): if self.op.hypervisor is None: self.op.hypervisor = self.cfg.GetHypervisorType() - enabled_hvs = self.cfg.GetClusterInfo().enabled_hypervisors + cluster = self.cfg.GetClusterInfo() + enabled_hvs = cluster.enabled_hypervisors if self.op.hypervisor not in enabled_hvs: raise errors.OpPrereqError("Selected hypervisor (%s) not enabled in the" " cluster (%s)" % (self.op.hypervisor, @@ -3226,8 +3227,10 @@ class LUCreateInstance(LogicalUnit): # check hypervisor parameter syntax (locally) + filled_hvp = cluster.FillDict(cluster.hvparams[self.op.hypervisor], + self.op.hvparams) hv_type = hypervisor.GetHypervisor(self.op.hypervisor) - hv_type.CheckParameterSyntax(self.op.hvparams) + hv_type.CheckParameterSyntax(filled_hvp) #### instance parameters check -- 1.7.10.4