Add basic support for disk parameters
[ganeti-local] / lib / opcodes.py
index 076d578..73c9564 100644 (file)
@@ -141,6 +141,13 @@ _PIgnoreErrors = ("ignore_errors", ht.EmptyList,
                   ht.TListOf(ht.TElemOf(constants.CV_ALL_ECODES_STRINGS)),
                   "List of error codes that should be treated as warnings")
 
+# Disk parameters
+_PDiskParams = ("diskparams", None,
+                ht.TOr(
+                  ht.TDictOf(ht.TElemOf(constants.DISK_TEMPLATES), ht.TDict),
+                  ht.TNone),
+                "Disk templates' parameter defaults")
+
 #: OP_ID conversion regular expression
 _OPID_RE = re.compile("([a-z])([A-Z])")
 
@@ -762,6 +769,7 @@ class OpClusterSetParams(OpCode):
     ("osparams", None, ht.TOr(ht.TDictOf(ht.TNonEmptyString, ht.TDict),
                               ht.TNone),
      "Cluster-wide OS parameter defaults"),
+    _PDiskParams,
     ("candidate_pool_size", None, ht.TOr(ht.TStrictPositiveInt, ht.TNone),
      "Master candidate pool size"),
     ("uid_pool", None, ht.NoType,
@@ -1025,6 +1033,7 @@ class OpNodeMigrate(OpCode):
     ("iallocator", None, ht.TMaybeString,
      "Iallocator for deciding the target node for shared-storage instances"),
     ]
+  OP_RESULT = TJobIdListOnly
 
 
 class OpNodeEvacuate(OpCode):
@@ -1035,7 +1044,7 @@ class OpNodeEvacuate(OpCode):
     _PNodeName,
     ("remote_node", None, ht.TMaybeString, "New secondary node"),
     ("iallocator", None, ht.TMaybeString, "Iallocator for computing solution"),
-    ("mode", ht.NoDefault, ht.TElemOf(constants.IALLOCATOR_NEVAC_MODES),
+    ("mode", ht.NoDefault, ht.TElemOf(constants.NODE_EVAC_MODES),
      "Node evacuation mode"),
     ]
   OP_RESULT = TJobIdListOnly
@@ -1351,6 +1360,10 @@ class OpInstanceSetParams(OpCode):
     ("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"),
+    ("offline_inst", False, ht.TBool,
+     "Whether to turn off the down instance completely"),
+    ("online_inst", False, ht.TBool,
+     "Whether to enable the offline instance"),
     ]
   OP_RESULT = _TSetParamsResult
 
@@ -1389,6 +1402,7 @@ class OpGroupAdd(OpCode):
     _PGroupName,
     _PNodeGroupAllocPolicy,
     _PGroupNodeParams,
+    _PDiskParams,
     ]
 
 
@@ -1419,6 +1433,7 @@ class OpGroupSetParams(OpCode):
     _PGroupName,
     _PNodeGroupAllocPolicy,
     _PGroupNodeParams,
+    _PDiskParams,
     ]
   OP_RESULT = _TSetParamsResult