Revision 1456df62
b/lib/opcodes.py | ||
---|---|---|
153 | 153 |
_TestNicDef = ht.TDictOf(ht.TElemOf(constants.INIC_PARAMS), |
154 | 154 |
ht.TOr(ht.TNone, ht.TNonEmptyString)) |
155 | 155 |
|
156 |
_TSetParamsResultItemItems = [ |
|
157 |
ht.Comment("name of changed parameter")(ht.TNonEmptyString), |
|
158 |
ht.TAny, |
|
159 |
] |
|
160 |
|
|
161 |
_TSetParamsResult = \ |
|
162 |
ht.TListOf(ht.TAnd(ht.TIsLength(len(_TSetParamsResultItemItems)), |
|
163 |
ht.TItems(_TSetParamsResultItemItems))) |
|
164 |
|
|
156 | 165 |
_SUMMARY_PREFIX = { |
157 | 166 |
"CLUSTER_": "C_", |
158 | 167 |
"GROUP_": "G_", |
... | ... | |
429 | 438 |
TNoRelativeJobDependencies = _BuildJobDepCheck(False) |
430 | 439 |
|
431 | 440 |
#: List of submission status and job ID as returned by C{SubmitManyJobs} |
432 |
TJobIdList = \ |
|
433 |
ht.TListOf(ht.TAnd(ht.TIsLength(2), |
|
434 |
ht.TItems([ht.TBool, ht.TOr(ht.TString, ht.TJobId)]))) |
|
441 |
_TJobIdListItem = \ |
|
442 |
ht.TAnd(ht.TIsLength(2), |
|
443 |
ht.TItems([ht.Comment("success")(ht.TBool), |
|
444 |
ht.Comment("Job ID if successful, error message" |
|
445 |
" otherwise")(ht.TOr(ht.TString, |
|
446 |
ht.TJobId))])) |
|
447 |
TJobIdList = ht.TListOf(_TJobIdListItem) |
|
435 | 448 |
|
436 | 449 |
#: Result containing only list of submitted jobs |
437 | 450 |
TJobIdListOnly = ht.TStrictDict(True, True, { |
438 |
constants.JOB_IDS_KEY: TJobIdList,
|
|
451 |
constants.JOB_IDS_KEY: ht.Comment("List of submitted jobs")(TJobIdList),
|
|
439 | 452 |
}) |
440 | 453 |
|
441 | 454 |
|
... | ... | |
953 | 966 |
("powered", None, ht.TMaybeBool, |
954 | 967 |
"Whether the node should be marked as powered"), |
955 | 968 |
] |
969 |
OP_RESULT = _TSetParamsResult |
|
956 | 970 |
|
957 | 971 |
|
958 | 972 |
class OpNodePowercycle(OpCode): |
... | ... | |
988 | 1002 |
("mode", ht.NoDefault, ht.TElemOf(constants.IALLOCATOR_NEVAC_MODES), |
989 | 1003 |
"Node evacuation mode"), |
990 | 1004 |
] |
1005 |
OP_RESULT = TJobIdListOnly |
|
991 | 1006 |
|
992 | 1007 |
|
993 | 1008 |
# instance opcodes |
... | ... | |
1063 | 1078 |
("start", True, ht.TBool, "Whether to start instance after creation"), |
1064 | 1079 |
("tags", ht.EmptyList, ht.TListOf(ht.TNonEmptyString), "Instance tags"), |
1065 | 1080 |
] |
1081 |
OP_RESULT = ht.Comment("instance nodes")(ht.TListOf(ht.TNonEmptyString)) |
|
1066 | 1082 |
|
1067 | 1083 |
|
1068 | 1084 |
class OpInstanceReinstall(OpCode): |
... | ... | |
1095 | 1111 |
("new_name", ht.NoDefault, ht.TNonEmptyString, "New instance name"), |
1096 | 1112 |
("ip_check", False, ht.TBool, _PIpCheckDoc), |
1097 | 1113 |
] |
1114 |
OP_RESULT = ht.Comment("New instance name")(ht.TNonEmptyString) |
|
1098 | 1115 |
|
1099 | 1116 |
|
1100 | 1117 |
class OpInstanceStartup(OpCode): |
... | ... | |
1298 | 1315 |
("wait_for_sync", True, ht.TBool, |
1299 | 1316 |
"Whether to wait for the disk to synchronize, when changing template"), |
1300 | 1317 |
] |
1318 |
OP_RESULT = _TSetParamsResult |
|
1301 | 1319 |
|
1302 | 1320 |
|
1303 | 1321 |
class OpInstanceGrowDisk(OpCode): |
... | ... | |
1322 | 1340 |
("target_groups", None, ht.TOr(ht.TNone, ht.TListOf(ht.TNonEmptyString)), |
1323 | 1341 |
"Destination group names or UUIDs (defaults to \"all but current group\""), |
1324 | 1342 |
] |
1343 |
OP_RESULT = TJobIdListOnly |
|
1325 | 1344 |
|
1326 | 1345 |
|
1327 | 1346 |
# Node group opcodes |
... | ... | |
1364 | 1383 |
_PNodeGroupAllocPolicy, |
1365 | 1384 |
_PGroupNodeParams, |
1366 | 1385 |
] |
1386 |
OP_RESULT = _TSetParamsResult |
|
1367 | 1387 |
|
1368 | 1388 |
|
1369 | 1389 |
class OpGroupRemove(OpCode): |
... | ... | |
1380 | 1400 |
_PGroupName, |
1381 | 1401 |
("new_name", ht.NoDefault, ht.TNonEmptyString, "New group name"), |
1382 | 1402 |
] |
1403 |
OP_RESULT = ht.Comment("New group name")(ht.TNonEmptyString) |
|
1383 | 1404 |
|
1384 | 1405 |
|
1385 | 1406 |
class OpGroupEvacuate(OpCode): |
... | ... | |
1392 | 1413 |
("target_groups", None, ht.TOr(ht.TNone, ht.TListOf(ht.TNonEmptyString)), |
1393 | 1414 |
"Destination group names or UUIDs"), |
1394 | 1415 |
] |
1416 |
OP_RESULT = TJobIdListOnly |
|
1395 | 1417 |
|
1396 | 1418 |
|
1397 | 1419 |
# OS opcodes |
Also available in: Unified diff