genMaybe (pure []) <*> genMaybe genNodeNameNE <*>
arbitrary <*> genMaybe genNodeNameNE <*>
genMaybe genNodeNameNE <*> genMaybe genNameNE <*>
- arbitrary <*> (genTags >>= mapM mkNonEmpty)
+ arbitrary <*> arbitrary <*> (genTags >>= mapM mkNonEmpty)
"OP_INSTANCE_MULTI_ALLOC" ->
OpCodes.OpInstanceMultiAlloc <$> genMaybe genNameNE <*> pure []
"OP_INSTANCE_REINSTALL" ->
, pIgnoreConsistency
, pStorageName
, pUseLocking
+ , pOpportunisticLocking
, pNameCheck
, pNodeGroupAllocPolicy
, pGroupNodeParams
pUseLocking :: Field
pUseLocking = defaultFalse "use_locking"
+-- | Whether to employ opportunistic locking for nodes, meaning nodes already
+-- locked by another opcode won't be considered for instance allocation (only
+-- when an iallocator is used).
+pOpportunisticLocking :: Field
+pOpportunisticLocking = defaultFalse "opportunistic_locking"
+
-- | Whether to check name.
pNameCheck :: Field
pNameCheck = defaultTrue "name_check"
_PHvState = ("hv_state", None, ht.TMaybeDict, "Set hypervisor states")
_PDiskState = ("disk_state", None, ht.TMaybeDict, "Set disk states")
+#: Opportunistic locking
+_POpportunisticLocking = \
+ ("opportunistic_locking", False, ht.TBool,
+ ("Whether to employ opportunistic locking for nodes, meaning nodes"
+ " already locked by another opcode won't be considered for instance"
+ " allocation (only when an iallocator is used)"))
_PIgnoreIpolicy = ("ignore_ipolicy", False, ht.TBool,
"Whether to ignore ipolicy violations")
_PWaitForSync,
_PNameCheck,
_PIgnoreIpolicy,
+ _POpportunisticLocking,
("beparams", ht.EmptyDict, ht.TDict, "Backend parameters for instance"),
("disks", ht.NoDefault, ht.TListOf(_TDiskParams),
"Disk descriptions, for example ``[{\"%s\": 100}, {\"%s\": 5}]``;"
"""
OP_PARAMS = [
+ _POpportunisticLocking,
_PIAllocFromDesc("Iallocator used to allocate all the instances"),
("instances", ht.EmptyList, ht.TListOf(ht.TInstanceOf(OpInstanceCreate)),
"List of instance create opcodes describing the instances to allocate"),