# this are practically structures, so disable the message about too
# few public methods:
-# pylint: disable-msg=R0903
+# pylint: disable=R0903
import logging
import re
_TestNicDef = ht.TDictOf(ht.TElemOf(constants.INIC_PARAMS),
ht.TOr(ht.TNone, ht.TNonEmptyString))
+_TSetParamsResultItemItems = [
+ ht.Comment("name of changed parameter")(ht.TNonEmptyString),
+ ht.TAny,
+ ]
+
+_TSetParamsResult = \
+ ht.TListOf(ht.TAnd(ht.TIsLength(len(_TSetParamsResultItemItems)),
+ ht.TItems(_TSetParamsResultItemItems)))
+
_SUMMARY_PREFIX = {
"CLUSTER_": "C_",
"GROUP_": "G_",
field handling.
"""
- # pylint: disable-msg=E1101
+ # pylint: disable=E1101
# as OP_ID is dynamically defined
__metaclass__ = _AutoOpParamSlots
TNoRelativeJobDependencies = _BuildJobDepCheck(False)
#: List of submission status and job ID as returned by C{SubmitManyJobs}
-TJobIdList = \
- ht.TListOf(ht.TAnd(ht.TIsLength(2),
- ht.TItems([ht.TBool, ht.TOr(ht.TString, ht.TJobId)])))
+_TJobIdListItem = \
+ ht.TAnd(ht.TIsLength(2),
+ ht.TItems([ht.Comment("success")(ht.TBool),
+ ht.Comment("Job ID if successful, error message"
+ " otherwise")(ht.TOr(ht.TString,
+ ht.TJobId))]))
+TJobIdList = ht.TListOf(_TJobIdListItem)
#: Result containing only list of submitted jobs
TJobIdListOnly = ht.TStrictDict(True, True, {
- constants.JOB_IDS_KEY: TJobIdList,
+ constants.JOB_IDS_KEY: ht.Comment("List of submitted jobs")(TJobIdList),
})
@ivar priority: Opcode priority for queue
"""
- # pylint: disable-msg=E1101
+ # pylint: disable=E1101
# as OP_ID is dynamically defined
WITH_LU = True
OP_PARAMS = [
OP_DSC_FIELD = "what"
OP_PARAMS = [
_PQueryWhat,
+ _PUseLocking,
("fields", ht.NoDefault, ht.TListOf(ht.TNonEmptyString),
"Requested fields"),
("filter", None, ht.TOr(ht.TNone, ht.TListOf),
("powered", None, ht.TMaybeBool,
"Whether the node should be marked as powered"),
]
+ OP_RESULT = _TSetParamsResult
class OpNodePowercycle(OpCode):
("mode", ht.NoDefault, ht.TElemOf(constants.IALLOCATOR_NEVAC_MODES),
"Node evacuation mode"),
]
+ OP_RESULT = TJobIdListOnly
# instance opcodes
("start", True, ht.TBool, "Whether to start instance after creation"),
("tags", ht.EmptyList, ht.TListOf(ht.TNonEmptyString), "Instance tags"),
]
+ OP_RESULT = ht.Comment("instance nodes")(ht.TListOf(ht.TNonEmptyString))
class OpInstanceReinstall(OpCode):
("new_name", ht.NoDefault, ht.TNonEmptyString, "New instance name"),
("ip_check", False, ht.TBool, _PIpCheckDoc),
]
+ OP_RESULT = ht.Comment("New instance name")(ht.TNonEmptyString)
class OpInstanceStartup(OpCode):
("wait_for_sync", True, ht.TBool,
"Whether to wait for the disk to synchronize, when changing template"),
]
+ OP_RESULT = _TSetParamsResult
class OpInstanceGrowDisk(OpCode):
("target_groups", None, ht.TOr(ht.TNone, ht.TListOf(ht.TNonEmptyString)),
"Destination group names or UUIDs (defaults to \"all but current group\""),
]
+ OP_RESULT = TJobIdListOnly
# Node group opcodes
_PNodeGroupAllocPolicy,
_PGroupNodeParams,
]
+ OP_RESULT = _TSetParamsResult
class OpGroupRemove(OpCode):
_PGroupName,
("new_name", ht.NoDefault, ht.TNonEmptyString, "New group name"),
]
+ OP_RESULT = ht.Comment("New group name")(ht.TNonEmptyString)
class OpGroupEvacuate(OpCode):
("target_groups", None, ht.TOr(ht.TNone, ht.TListOf(ht.TNonEmptyString)),
"Destination group names or UUIDs"),
]
+ OP_RESULT = TJobIdListOnly
# OS opcodes
("name", ht.NoDefault, ht.TMaybeString, None),
]
+
# Test opcodes
class OpTestDelay(OpCode):
"""Sleeps for a configured amount of time.