Revision c363310d

b/lib/opcodes.py
622 622
  after the cluster has been initialized.
623 623

  
624 624
  """
625
  OP_RESULT = ht.TBool
625 626

  
626 627

  
627 628
class OpClusterDestroy(OpCode):
......
631 632
  lost after the execution of this opcode.
632 633

  
633 634
  """
635
  OP_RESULT = ht.TNonEmptyString
634 636

  
635 637

  
636 638
class OpClusterQuery(OpCode):
......
743 745
  OP_PARAMS = [
744 746
    ("instances", ht.EmptyList, ht.TListOf(ht.TNonEmptyString), None),
745 747
    ]
748
  OP_RESULT = ht.TListOf(ht.TAnd(ht.TIsLength(3),
749
                                 ht.TItems([ht.TNonEmptyString,
750
                                            ht.TPositiveInt,
751
                                            ht.TPositiveInt])))
746 752

  
747 753

  
748 754
class OpClusterConfigQuery(OpCode):
......
750 756
  OP_PARAMS = [
751 757
    _POutputFields
752 758
    ]
759
  OP_RESULT = ht.TListOf(ht.TAny)
753 760

  
754 761

  
755 762
class OpClusterRename(OpCode):
......
765 772
  OP_PARAMS = [
766 773
    ("name", ht.NoDefault, ht.TNonEmptyString, None),
767 774
    ]
775
  OP_RESULT = ht.TNonEmptyString
768 776

  
769 777

  
770 778
class OpClusterSetParams(OpCode):
......
833 841
    ("use_external_mip_script", None, ht.TMaybeBool,
834 842
     "Whether to use an external master IP address setup script"),
835 843
    ]
844
  OP_RESULT = ht.TNone
836 845

  
837 846

  
838 847
class OpClusterRedistConf(OpCode):
839 848
  """Force a full push of the cluster configuration.
840 849

  
841 850
  """
851
  OP_RESULT = ht.TNone
842 852

  
843 853

  
844 854
class OpClusterActivateMasterIp(OpCode):
845 855
  """Activate the master IP on the master node.
846 856

  
847 857
  """
858
  OP_RESULT = ht.TNone
848 859

  
849 860

  
850 861
class OpClusterDeactivateMasterIp(OpCode):
851 862
  """Deactivate the master IP on the master node.
852 863

  
853 864
  """
865
  OP_RESULT = ht.TNone
854 866

  
855 867

  
856 868
class OpQuery(OpCode):
......
901 913
    ("power_delay", constants.OOB_POWER_DELAY, ht.TPositiveFloat,
902 914
     "Time in seconds to wait between powering on nodes"),
903 915
    ]
916
  # Fixme: Make it more specific with all the special cases in LUOobCommand
917
  OP_RESULT = ht.TListOf(ht.TAnd(ht.TIsLength(2),
918
                                 ht.TItems([ht.TElemOf(constants.RS_ALL),
919
                                            ht.TAny])))
904 920

  
905 921

  
906 922
# node opcodes
......
917 933
  OP_PARAMS = [
918 934
    _PNodeName,
919 935
    ]
936
  OP_RESULT = ht.TNone
920 937

  
921 938

  
922 939
class OpNodeAdd(OpCode):
......
962 979
     "Whether node can host instances"),
963 980
    ("ndparams", None, ht.TMaybeDict, "Node parameters"),
964 981
    ]
982
  OP_RESULT = ht.TNone
965 983

  
966 984

  
967 985
class OpNodeQuery(OpCode):
......
981 999
    ("nodes", ht.EmptyList, ht.TListOf(ht.TNonEmptyString),
982 1000
     "Empty list to query all nodes, node names otherwise"),
983 1001
    ]
1002
  OP_RESULT = ht.TListOf(ht.TAny)
984 1003

  
985 1004

  
986 1005
class OpNodeQueryStorage(OpCode):
......
1001 1020
    _PStorageName,
1002 1021
    ("changes", ht.NoDefault, ht.TDict, "Requested changes"),
1003 1022
    ]
1023
  OP_RESULT = ht.TNone
1004 1024

  
1005 1025

  
1006 1026
class OpRepairNodeStorage(OpCode):
......
1012 1032
    _PStorageName,
1013 1033
    _PIgnoreConsistency,
1014 1034
    ]
1035
  OP_RESULT = ht.TNone
1015 1036

  
1016 1037

  
1017 1038
class OpNodeSetParams(OpCode):
......
1050 1071
    _PNodeName,
1051 1072
    _PForce,
1052 1073
    ]
1074
  OP_RESULT = ht.TMaybeString
1053 1075

  
1054 1076

  
1055 1077
class OpNodeMigrate(OpCode):
......
1166 1188
    ("os_type", None, ht.TMaybeString, "Instance operating system"),
1167 1189
    ("osparams", None, ht.TMaybeDict, "Temporary OS parameters"),
1168 1190
    ]
1191
  OP_RESULT = ht.TNone
1169 1192

  
1170 1193

  
1171 1194
class OpInstanceRemove(OpCode):
......
1177 1200
    ("ignore_failures", False, ht.TBool,
1178 1201
     "Whether to ignore failures during removal"),
1179 1202
    ]
1203
  OP_RESULT = ht.TNone
1180 1204

  
1181 1205

  
1182 1206
class OpInstanceRename(OpCode):
......
1203 1227
    _PNoRemember,
1204 1228
    _PStartupPaused,
1205 1229
    ]
1230
  OP_RESULT = ht.TNone
1206 1231

  
1207 1232

  
1208 1233
class OpInstanceShutdown(OpCode):
......
1215 1240
     "How long to wait for instance to shut down"),
1216 1241
    _PNoRemember,
1217 1242
    ]
1243
  OP_RESULT = ht.TNone
1218 1244

  
1219 1245

  
1220 1246
class OpInstanceReboot(OpCode):
......
1228 1254
    ("reboot_type", ht.NoDefault, ht.TElemOf(constants.REBOOT_TYPES),
1229 1255
     "How to reboot instance"),
1230 1256
    ]
1257
  OP_RESULT = ht.TNone
1231 1258

  
1232 1259

  
1233 1260
class OpInstanceReplaceDisks(OpCode):
......
1245 1272
    ("iallocator", None, ht.TMaybeString,
1246 1273
     "Iallocator for deciding new secondary node"),
1247 1274
    ]
1275
  OP_RESULT = ht.TNone
1248 1276

  
1249 1277

  
1250 1278
class OpInstanceFailover(OpCode):
......
1259 1287
    ("iallocator", None, ht.TMaybeString,
1260 1288
     "Iallocator for deciding the target node for shared-storage instances"),
1261 1289
    ]
1290
  OP_RESULT = ht.TNone
1262 1291

  
1263 1292

  
1264 1293
class OpInstanceMigrate(OpCode):
......
1286 1315
    ("allow_failover", False, ht.TBool,
1287 1316
     "Whether we can fallback to failover if migration is not possible"),
1288 1317
    ]
1318
  OP_RESULT = ht.TNone
1289 1319

  
1290 1320

  
1291 1321
class OpInstanceMove(OpCode):
......
1306 1336
    ("target_node", ht.NoDefault, ht.TNonEmptyString, "Target node"),
1307 1337
    _PIgnoreConsistency,
1308 1338
    ]
1339
  OP_RESULT = ht.TNone
1309 1340

  
1310 1341

  
1311 1342
class OpInstanceConsole(OpCode):
......
1314 1345
  OP_PARAMS = [
1315 1346
    _PInstanceName
1316 1347
    ]
1348
  OP_RESULT = ht.TDict
1317 1349

  
1318 1350

  
1319 1351
class OpInstanceActivateDisks(OpCode):
......
1323 1355
    _PInstanceName,
1324 1356
    ("ignore_size", False, ht.TBool, "Whether to ignore recorded size"),
1325 1357
    ]
1358
  OP_RESULT = ht.TListOf(ht.TAnd(ht.TIsLength(3),
1359
                                 ht.TItems([ht.TNonEmptyString,
1360
                                            ht.TNonEmptyString,
1361
                                            ht.TNonEmptyString])))
1326 1362

  
1327 1363

  
1328 1364
class OpInstanceDeactivateDisks(OpCode):
......
1332 1368
    _PInstanceName,
1333 1369
    _PForce,
1334 1370
    ]
1371
  OP_RESULT = ht.TNone
1335 1372

  
1336 1373

  
1337 1374
class OpInstanceRecreateDisks(OpCode):
......
1351 1388
    ("nodes", ht.EmptyList, ht.TListOf(ht.TNonEmptyString),
1352 1389
     "New instance nodes, if relocation is desired"),
1353 1390
    ]
1391
  OP_RESULT = ht.TNone
1354 1392

  
1355 1393

  
1356 1394
class OpInstanceQuery(OpCode):
......
1452 1490
    ("amount", ht.NoDefault, ht.TInt,
1453 1491
     "Amount of disk space to add (megabytes)"),
1454 1492
    ]
1493
  OP_RESULT = ht.TNone
1455 1494

  
1456 1495

  
1457 1496
class OpInstanceChangeGroup(OpCode):
......
1482 1521
    ("ipolicy", None, ht.TMaybeDict,
1483 1522
     "Group-wide :ref:`instance policy <rapi-ipolicy>` specs"),
1484 1523
    ]
1524
  OP_RESULT = ht.TNone
1485 1525

  
1486 1526

  
1487 1527
class OpGroupAssignNodes(OpCode):
......
1493 1533
    ("nodes", ht.NoDefault, ht.TListOf(ht.TNonEmptyString),
1494 1534
     "List of nodes to assign"),
1495 1535
    ]
1536
  OP_RESULT = ht.TNone
1496 1537

  
1497 1538

  
1498 1539
class OpGroupQuery(OpCode):
......
1525 1566
  OP_PARAMS = [
1526 1567
    _PGroupName,
1527 1568
    ]
1569
  OP_RESULT = ht.TNone
1528 1570

  
1529 1571

  
1530 1572
class OpGroupRename(OpCode):
......
1582 1624
    ("mode", ht.NoDefault, ht.TElemOf(constants.EXPORT_MODES),
1583 1625
     "Export mode"),
1584 1626
    ]
1627
  OP_RESULT = ht.TOr(ht.TNone, ht.TDict)
1585 1628

  
1586 1629

  
1587 1630
class OpBackupExport(OpCode):

Also available in: Unified diff