Commit 877b849b authored by Iustin Pop's avatar Iustin Pop
Browse files

Prevent moving/creating instances on non-vm nodes

This small patch modifies LUCreateInstance, LUReplaceDisks and
LUMoveInstance to not use non-vm_capable nodes.
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarMichael Hanselmann <>
parent 614e7e26
......@@ -5777,6 +5777,7 @@ class LUMoveInstance(LogicalUnit):
_CheckNodeOnline(self, target_node)
_CheckNodeNotDrained(self, target_node)
_CheckNodeVmCapable(self, target_node)
if instance.admin_up:
# check memory requirements on the secondary node
......@@ -7365,6 +7366,9 @@ class LUCreateInstance(LogicalUnit):
if pnode.drained:
raise errors.OpPrereqError("Cannot use drained primary node '%s'" %, errors.ECODE_STATE)
if not pnode.vm_capable:
raise errors.OpPrereqError("Cannot use non-vm_capable primary node"
" '%s'" %, errors.ECODE_STATE)
self.secondaries = []
......@@ -7375,6 +7379,7 @@ class LUCreateInstance(LogicalUnit):
" primary node.", errors.ECODE_INVAL)
_CheckNodeOnline(self, self.op.snode)
_CheckNodeNotDrained(self, self.op.snode)
_CheckNodeVmCapable(self, self.op.snode)
nodenames = [] + self.secondaries
......@@ -7956,6 +7961,7 @@ class TLReplaceDisks(Tasklet):
check_nodes = [self.new_node, self.other_node]
_CheckNodeNotDrained(, remote_node)
_CheckNodeVmCapable(, remote_node)
old_node_info = self.cfg.GetNodeInfo(secondary_node)
assert old_node_info is not None
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