When an instance creation uses opportunistic locks, the iallocator might
not be able to find an allocation solution if not enough node locks (or
a suboptimal subset thereof) were acquired. As per the design document
<doc/design-opportunistic-locking.rst> a new error code denoting
temporary failures is added.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
ial.Run(self.op.iallocator)
if not ial.success:
+ # When opportunistic locks are used only a temporary failure is generated
+ if self.op.opportunistic_locking:
+ ecode = errors.ECODE_TEMP_NORES
+ else:
+ ecode = errors.ECODE_NORES
+
raise errors.OpPrereqError("Can't compute nodes using"
" iallocator '%s': %s" %
(self.op.iallocator, ial.info),
- errors.ECODE_NORES)
+ ecode)
+
self.op.pnode = ial.result[0]
self.LogInfo("Selected nodes for instance %s via iallocator %s: %s",
self.op.instance_name, self.op.iallocator,
#: Not enough resources (iallocator failure, disk space, memory, etc.)
ECODE_NORES = "insufficient_resources"
+#: Temporarily out of resources; operation can be tried again
+ECODE_TEMP_NORES = "insufficient_resources"
+
#: Wrong arguments (at syntax level)
ECODE_INVAL = "wrong_input"
ECODE_ALL = frozenset([
ECODE_RESOLVER,
ECODE_NORES,
+ ECODE_TEMP_NORES,
ECODE_INVAL,
ECODE_STATE,
ECODE_NOENT,