Commit 9c24736c authored by Iustin Pop's avatar Iustin Pop
Browse files

Fix HV/OS parameter validation on non-vm nodes

Currently, there is at least one LU that does wrong validation of HV
parameters (against all nodes, LUClusterSetParams). It's possible to
fix this case, but I went and modified the base functions to filter
out non-vm_capable nodes so all callers are protected.

Note: the _CheckOSParams function is never called with all nodes list,
so modifying it shouldn't be needed. However, I think it's safe to do
so (and it shouldn't hurt as an instance's node shouldn't ever lack
the vm_capable bit).
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarMichael Hanselmann <>
parent effab4ca
......@@ -6819,6 +6819,21 @@ def _ComputeDiskSize(disk_template, disks):
return req_size_dict[disk_template]
def _FilterVmNodes(lu, nodenames):
"""Filters out non-vm_capable nodes from a list.
@type lu: L{LogicalUnit}
@param lu: the logical unit for which we check
@type nodenames: list
@param nodenames: the list of nodes on which we should check
@rtype: list
@return: the list of vm-capable nodes
vm_nodes = frozenset(lu.cfg.GetNonVmCapableNodeList())
return [name for name in nodenames if name not in vm_nodes]
def _CheckHVParams(lu, nodenames, hvname, hvparams):
"""Hypervisor parameter validation.
......@@ -6836,6 +6851,7 @@ def _CheckHVParams(lu, nodenames, hvname, hvparams):
@raise errors.OpPrereqError: if the parameters are not valid
nodenames = _FilterVmNodes(lu, nodenames)
hvinfo = lu.rpc.call_hypervisor_validate_params(nodenames,
......@@ -6863,6 +6879,7 @@ def _CheckOSParams(lu, required, nodenames, osname, osparams):
@raise errors.OpPrereqError: if the parameters are not valid
nodenames = _FilterVmNodes(lu, nodenames)
result = lu.rpc.call_os_validate(required, nodenames, osname,
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