Rename dir 'block' to 'storage'
[ganeti-local] / lib / rpc_defs.py
index 0b4f6a6..c6f9a09 100644 (file)
@@ -61,7 +61,7 @@ ACCEPT_OFFLINE_NODE = object()
 (ED_OBJECT_DICT,
  ED_OBJECT_DICT_LIST,
  ED_INST_DICT,
- ED_INST_DICT_HVP_BEP,
+ ED_INST_DICT_HVP_BEP_DP,
  ED_NODE_TO_DISK_DICT,
  ED_INST_DICT_OSP_DP,
  ED_IMPEXP_IO,
@@ -70,7 +70,8 @@ ACCEPT_OFFLINE_NODE = object()
  ED_COMPRESS,
  ED_BLOCKDEV_RENAME,
  ED_DISKS_DICT_DP,
- ED_SINGLE_DISK_DICT_DP) = range(1, 14)
+ ED_SINGLE_DISK_DICT_DP,
+ ED_NIC_DICT) = range(1, 15)
 
 
 def _Prepare(calls):
@@ -130,6 +131,17 @@ def _BlockdevGetMirrorStatusMultiPostProc(result):
   return result
 
 
+def _NodeInfoPreProc(node, args):
+  """Prepare the exclusive_storage argument for node_info calls."""
+  assert len(args) == 3
+  # The third argument is either a dictionary with one value for each node, or
+  # a fixed value to be used for all the nodes
+  if type(args[2]) is dict:
+    return [args[0], args[1], args[2][node]]
+  else:
+    return args
+
+
 def _OsGetPostProc(result):
   """Post-processor for L{rpc.RpcRunner.call_os_get}.
 
@@ -218,10 +230,12 @@ _INSTANCE_CALLS = [
     ("inst", ED_INST_DICT, "Instance object"),
     ("reboot_type", None, None),
     ("shutdown_timeout", None, None),
+    ("reason", None, "The reason for the reboot"),
     ], None, None, "Returns the list of running instances on the given nodes"),
   ("instance_shutdown", SINGLE, None, constants.RPC_TMO_NORMAL, [
     ("instance", ED_INST_DICT, "Instance object"),
     ("timeout", None, None),
+    ("reason", None, "The reason for the shutdown"),
     ], None, None, "Stops an instance"),
   ("instance_balloon_memory", SINGLE, None, constants.RPC_TMO_NORMAL, [
     ("instance", ED_INST_DICT, "Instance object"),
@@ -263,8 +277,9 @@ _INSTANCE_CALLS = [
     ("instance", ED_INST_DICT, "Instance object"),
     ], None, _MigrationStatusPostProc, "Report migration status"),
   ("instance_start", SINGLE, None, constants.RPC_TMO_NORMAL, [
-    ("instance_hvp_bep", ED_INST_DICT_HVP_BEP, None),
+    ("instance_hvp_bep", ED_INST_DICT_HVP_BEP_DP, None),
     ("startup_paused", None, None),
+    ("reason", None, "The reason for the startup"),
     ], None, None, "Starts an instance"),
   ("instance_os_add", SINGLE, None, constants.RPC_TMO_1DAY, [
     ("instance_osp", ED_INST_DICT_OSP_DP, None),
@@ -331,6 +346,7 @@ _BLOCKDEV_CALLS = [
     ("owner", None, None),
     ("on_primary", None, None),
     ("info", None, None),
+    ("exclusive_storage", None, None),
     ], None, None, "Request creation of a given block device"),
   ("blockdev_wipe", SINGLE, None, constants.RPC_TMO_SLOW, [
     ("bdev", ED_SINGLE_DISK_DICT_DP, None),
@@ -418,6 +434,10 @@ _BLOCKDEV_CALLS = [
     ], _BlockdevGetMirrorStatusMultiPreProc,
    _BlockdevGetMirrorStatusMultiPostProc,
     "Request status of (mirroring) devices from multiple nodes"),
+  ("blockdev_setinfo", SINGLE, None, constants.RPC_TMO_NORMAL, [
+    ("disk", ED_OBJECT_DICT, None),
+    ("info", None, None),
+    ], None, None, "Sets metadata information on a given block device"),
   ]
 
 _OS_CALLS = [
@@ -434,6 +454,11 @@ _OS_CALLS = [
     ], None, _OsGetPostProc, "Returns an OS definition"),
   ]
 
+_EXTSTORAGE_CALLS = [
+  ("extstorage_diagnose", MULTI, None, constants.RPC_TMO_FAST, [], None, None,
+   "Request a diagnose of ExtStorage Providers"),
+  ]
+
 _NODE_CALLS = [
   ("node_has_ip_address", SINGLE, None, constants.RPC_TMO_FAST, [
     ("address", None, "IP address"),
@@ -443,7 +468,9 @@ _NODE_CALLS = [
      "Names of the volume groups to ask for disk space information"),
     ("hv_names", None,
      "Names of the hypervisors to ask for node information"),
-    ], None, None, "Return node information"),
+    ("exclusive_storage", None,
+     "Whether exclusive storage is enabled"),
+    ], _NodeInfoPreProc, None, "Return node information"),
   ("node_verify", MULTI, None, constants.RPC_TMO_NORMAL, [
     ("checkdict", None, None),
     ("cluster_name", None, None),
@@ -475,6 +502,9 @@ _MISC_CALLS = [
     ], None, None, "Modify hosts file with name"),
   ("drbd_helper", MULTI, None, constants.RPC_TMO_URGENT, [],
    None, None, "Gets DRBD helper"),
+  ("restricted_command", MULTI, None, constants.RPC_TMO_SLOW, [
+    ("cmd", None, "Command name"),
+    ], None, None, "Runs restricted command"),
   ("run_oob", SINGLE, None, constants.RPC_TMO_NORMAL, [
     ("oob_program", None, None),
     ("command", None, None),
@@ -497,13 +527,18 @@ _MISC_CALLS = [
     ("hvname", None, "Hypervisor name"),
     ("hvfull", None, "Parameters to be validated"),
     ], None, None, "Validate hypervisor params"),
+  ("get_watcher_pause", SINGLE, None, constants.RPC_TMO_URGENT, [],
+    None, None, "Get watcher pause end"),
+  ("set_watcher_pause", MULTI, None, constants.RPC_TMO_URGENT, [
+    ("until", None, None),
+    ], None, None, "Set watcher pause end"),
   ]
 
 CALLS = {
   "RpcClientDefault":
     _Prepare(_IMPEXP_CALLS + _X509_CALLS + _OS_CALLS + _NODE_CALLS +
              _FILE_STORAGE_CALLS + _MISC_CALLS + _INSTANCE_CALLS +
-             _BLOCKDEV_CALLS + _STORAGE_CALLS),
+             _BLOCKDEV_CALLS + _STORAGE_CALLS + _EXTSTORAGE_CALLS),
   "RpcClientJobQueue": _Prepare([
     ("jobqueue_update", MULTI, None, constants.RPC_TMO_URGENT, [
       ("file_name", None, None),
@@ -514,6 +549,9 @@ CALLS = {
     ("jobqueue_rename", MULTI, None, constants.RPC_TMO_URGENT, [
       ("rename", None, None),
       ], None, None, "Rename job queue file"),
+    ("jobqueue_set_drain_flag", MULTI, None, constants.RPC_TMO_URGENT, [
+      ("flag", None, None),
+      ], None, None, "Set job queue drain flag"),
     ]),
   "RpcClientBootstrap": _Prepare([
     ("node_start_master_daemons", SINGLE, None, constants.RPC_TMO_FAST, [
@@ -549,6 +587,10 @@ CALLS = {
   "RpcClientDnsOnly": _Prepare([
     ("version", MULTI, ACCEPT_OFFLINE_NODE, constants.RPC_TMO_URGENT, [], None,
      None, "Query node version"),
+    ("node_verify_light", MULTI, None, constants.RPC_TMO_NORMAL, [
+      ("checkdict", None, None),
+      ("cluster_name", None, None),
+      ], None, None, "Request verification of given parameters"),
     ]),
   "RpcClientConfig": _Prepare([
     ("upload_file", MULTI, None, constants.RPC_TMO_NORMAL, [