Commit 614e7e26 authored by Iustin Pop's avatar Iustin Pop
Browse files

Add a CheckNodeVmCapable helper in cmdlib

Also changes the error code for the other CheckNode* helpers to
ECODE_STATE, not ECODE_INVAL: ECODE_INVAL is for requests that are
invalid (e.g. create drbd instance with one node), whereas ECODE_STATE
denote requests that are not satisfiable due to cluster/node/instance
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarMichael Hanselmann <>
parent 7b4978ad
......@@ -603,7 +603,7 @@ def _CheckNodeOnline(lu, node):
if lu.cfg.GetNodeInfo(node).offline:
raise errors.OpPrereqError("Can't use offline node %s" % node,
def _CheckNodeNotDrained(lu, node):
......@@ -616,7 +616,20 @@ def _CheckNodeNotDrained(lu, node):
if lu.cfg.GetNodeInfo(node).drained:
raise errors.OpPrereqError("Can't use drained node %s" % node,
def _CheckNodeVmCapable(lu, node):
"""Ensure that a given node is vm capable.
@param lu: the LU on behalf of which we make the check
@param node: the node to check
@raise errors.OpPrereqError: if the node is not vm capable
if not lu.cfg.GetNodeInfo(node).vm_capable:
raise errors.OpPrereqError("Can't use non-vm_capable node %s" % node,
def _CheckNodeHasOS(lu, node, os_name, force_variant):
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