Commit b6cd72b2 authored by Iustin Pop's avatar Iustin Pop
Browse files

Fix create/import verification of hvparams



Currently the instance creation checks the cluster hv defaults + the new
parameters for validity, ignoring the os-specific hvparams (this was an
oversight during the implementation of the os hvp). This patch uses the
new GetHVDefaults method to provide the defaults, instead of reading
directly the attributes of the cluster object.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent d63479b5
......@@ -6256,6 +6256,8 @@ class LUCreateInstance(LogicalUnit):
that declares them.
"""
self.op.os_type = einfo.get(constants.INISECT_EXP, "os")
if self.op.disk_template is None:
if einfo.has_option(constants.INISECT_INS, "disk_template"):
self.op.disk_template = einfo.get(constants.INISECT_INS,
......@@ -6339,7 +6341,8 @@ class LUCreateInstance(LogicalUnit):
# check hypervisor parameter syntax (locally)
utils.ForceDictType(self.op.hvparams, constants.HVS_PARAMETER_TYPES)
filled_hvp = objects.FillDict(cluster.hvparams[self.op.hypervisor],
filled_hvp = objects.FillDict(cluster.GetHVDefaults(self.op.hypervisor,
self.op.os_type),
self.op.hvparams)
hv_type = hypervisor.GetHypervisor(self.op.hypervisor)
hv_type.CheckParameterSyntax(filled_hvp)
......@@ -6454,7 +6457,6 @@ class LUCreateInstance(LogicalUnit):
(instance_disks, export_disks),
errors.ECODE_INVAL)
self.op.os_type = export_info.get(constants.INISECT_EXP, 'os')
disk_images = []
for idx in range(export_disks):
option = 'disk%d_dump' % idx
......
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