cli.JobExecutor: Handle empty name, allow adding job IDs
[ganeti-local] / lib / opcodes.py
index 747422f..6a5f3be 100644 (file)
@@ -114,6 +114,14 @@ _PQueryWhat = ("what", ht.NoDefault, ht.TElemOf(constants.QR_VIA_OP),
 
 _PIpCheckDoc = "Whether to ensure instance's IP address is inactive"
 
+#: Do not remember instance state changes
+_PNoRemember = ("no_remember", False, ht.TBool,
+                "Do not remember the state change")
+
+#: Target node for instance migration/failover
+_PMigrationTargetNode = ("target_node", None, ht.TMaybeString,
+                         "Target node for shared-storage instances")
+
 #: OP_ID conversion regular expression
 _OPID_RE = re.compile("([a-z])([A-Z])")
 
@@ -509,8 +517,19 @@ class OpClusterQuery(OpCode):
   """Query cluster information."""
 
 
-class OpClusterVerify(OpCode):
-  """Verify the cluster state.
+class OpClusterVerifyConfig(OpCode):
+  """Verify the cluster config.
+
+  """
+  OP_PARAMS = [
+    ("verbose", False, ht.TBool, None),
+    ("error_codes", False, ht.TBool, None),
+    ("debug_simulate_errors", False, ht.TBool, None),
+    ]
+
+
+class OpClusterVerifyGroup(OpCode):
+  """Run verify on a node group from the cluster.
 
   @type skip_checks: C{list}
   @ivar skip_checks: steps to be skipped from the verify process; this
@@ -519,7 +538,9 @@ class OpClusterVerify(OpCode):
                      only L{constants.VERIFY_NPLUSONE_MEM} can be passed
 
   """
+  OP_DSC_FIELD = "group_name"
   OP_PARAMS = [
+    ("group_name", ht.NoDefault, ht.TNonEmptyString, None),
     ("skip_checks", ht.EmptyList,
      ht.TListOf(ht.TElemOf(constants.VERIFY_OPTIONAL_CHECKS)), None),
     ("verbose", False, ht.TBool, None),
@@ -857,6 +878,7 @@ class OpNodeMigrate(OpCode):
     _PNodeName,
     _PMigrationMode,
     _PMigrationLive,
+    _PMigrationTargetNode,
     ("iallocator", None, ht.TMaybeString,
      "Iallocator for deciding the target node for shared-storage instances"),
     ]
@@ -988,6 +1010,7 @@ class OpInstanceStartup(OpCode):
     ("hvparams", ht.EmptyDict, ht.TDict,
      "Temporary hypervisor parameters, hypervisor-dependent"),
     ("beparams", ht.EmptyDict, ht.TDict, "Temporary backend parameters"),
+    _PNoRemember,
     ]
 
 
@@ -999,6 +1022,7 @@ class OpInstanceShutdown(OpCode):
     _PIgnoreOfflineNodes,
     ("timeout", constants.DEFAULT_SHUTDOWN_TIMEOUT, ht.TPositiveInt,
      "How long to wait for instance to shut down"),
+    _PNoRemember,
     ]
 
 
@@ -1039,10 +1063,9 @@ class OpInstanceFailover(OpCode):
     _PInstanceName,
     _PShutdownTimeout,
     _PIgnoreConsistency,
+    _PMigrationTargetNode,
     ("iallocator", None, ht.TMaybeString,
      "Iallocator for deciding the target node for shared-storage instances"),
-    ("target_node", None, ht.TMaybeString,
-     "Target node for shared-storage instances"),
     ]
 
 
@@ -1061,12 +1084,11 @@ class OpInstanceMigrate(OpCode):
     _PInstanceName,
     _PMigrationMode,
     _PMigrationLive,
+    _PMigrationTargetNode,
     ("cleanup", False, ht.TBool,
      "Whether a previously failed migration should be cleaned up"),
     ("iallocator", None, ht.TMaybeString,
      "Iallocator for deciding the target node for shared-storage instances"),
-    ("target_node", None, ht.TMaybeString,
-     "Target node for shared-storage instances"),
     ("allow_failover", False, ht.TBool,
      "Whether we can fallback to failover if migration is not possible"),
     ]
@@ -1087,6 +1109,7 @@ class OpInstanceMove(OpCode):
     _PInstanceName,
     _PShutdownTimeout,
     ("target_node", ht.NoDefault, ht.TNonEmptyString, "Target node"),
+    _PIgnoreConsistency,
     ]
 
 
@@ -1123,6 +1146,8 @@ class OpInstanceRecreateDisks(OpCode):
     _PInstanceName,
     ("disks", ht.EmptyList, ht.TListOf(ht.TPositiveInt),
      "List of disk indexes"),
+    ("nodes", ht.EmptyList, ht.TListOf(ht.TNonEmptyString),
+     "New instance nodes, if relocation is desired"),
     ]
 
 
@@ -1173,6 +1198,8 @@ class OpInstanceSetParams(OpCode):
     ("os_name", None, ht.TMaybeString,
      "Change instance's OS name. Does not reinstall the instance."),
     ("osparams", None, ht.TMaybeDict, "Per-instance OS parameters"),
+    ("wait_for_sync", True, ht.TBool,
+     "Whether to wait for the disk to synchronize, when changing template"),
     ]
 
 
@@ -1414,7 +1441,7 @@ class OpTestAllocator(OpCode):
     ("mode", ht.NoDefault, ht.TElemOf(constants.VALID_IALLOCATOR_MODES), None),
     ("name", ht.NoDefault, ht.TNonEmptyString, None),
     ("nics", ht.NoDefault, ht.TOr(ht.TNone, ht.TListOf(
-     ht.TDictOf(ht.TElemOf(["mac", "ip", "bridge"]),
+     ht.TDictOf(ht.TElemOf([constants.INIC_MAC, constants.INIC_IP, "bridge"]),
                 ht.TOr(ht.TNone, ht.TNonEmptyString)))), None),
     ("disks", ht.NoDefault, ht.TOr(ht.TNone, ht.TList), None),
     ("hypervisor", None, ht.TMaybeString, None),
@@ -1426,6 +1453,12 @@ class OpTestAllocator(OpCode):
     ("disk_template", None, ht.TMaybeString, None),
     ("evac_nodes", None, ht.TOr(ht.TNone, ht.TListOf(ht.TNonEmptyString)),
      None),
+    ("instances", None, ht.TOr(ht.TNone, ht.TListOf(ht.TNonEmptyString)),
+     None),
+    ("reloc_mode", None,
+     ht.TOr(ht.TNone, ht.TElemOf(constants.IALLOCATOR_MRELOC_MODES)), None),
+    ("target_groups", None, ht.TOr(ht.TNone, ht.TListOf(ht.TNonEmptyString)),
+     None),
     ]