Hs2Py constants: add remaining '_autoconf.*' constants
[ganeti-local] / lib / rpc_defs.py
index 9e167c4..b5f03b9 100644 (file)
@@ -62,7 +62,7 @@ ACCEPT_OFFLINE_NODE = object()
  ED_OBJECT_DICT_LIST,
  ED_INST_DICT,
  ED_INST_DICT_HVP_BEP_DP,
- ED_NODE_TO_DISK_DICT,
+ ED_NODE_TO_DISK_DICT_DP,
  ED_INST_DICT_OSP_DP,
  ED_IMPEXP_IO,
  ED_FILE_DETAILS,
@@ -70,7 +70,9 @@ ACCEPT_OFFLINE_NODE = object()
  ED_COMPRESS,
  ED_BLOCKDEV_RENAME,
  ED_DISKS_DICT_DP,
- ED_SINGLE_DISK_DICT_DP) = range(1, 14)
+ ED_MULTI_DISKS_DICT_DP,
+ ED_SINGLE_DISK_DICT_DP,
+ ED_NIC_DICT) = range(1, 16)
 
 
 def _Prepare(calls):
@@ -130,6 +132,17 @@ def _BlockdevGetMirrorStatusMultiPostProc(result):
   return result
 
 
+def _NodeInfoPreProc(node, args):
+  """Prepare the storage_units argument for node_info calls."""
+  assert len(args) == 2
+  # The storage_units 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[0]) is dict:
+    return [args[0][node], args[1]]
+  else:
+    return args
+
+
 def _OsGetPostProc(result):
   """Post-processor for L{rpc.RpcRunner.call_os_get}.
 
@@ -206,22 +219,27 @@ _INSTANCE_CALLS = [
   ("instance_info", SINGLE, None, constants.RPC_TMO_URGENT, [
     ("instance", None, "Instance name"),
     ("hname", None, "Hypervisor type"),
+    ("hvparams", None, "Hypervisor parameters"),
     ], None, None, "Returns information about a single instance"),
   ("all_instances_info", MULTI, None, constants.RPC_TMO_URGENT, [
     ("hypervisor_list", None, "Hypervisors to query for instances"),
+    ("all_hvparams", None, "Dictionary mapping hypervisor names to hvparams"),
     ], None, None,
    "Returns information about all instances on the given nodes"),
   ("instance_list", MULTI, None, constants.RPC_TMO_URGENT, [
     ("hypervisor_list", None, "Hypervisors to query for instances"),
+    ("hvparams", None, "Hvparams of all hypervisors"),
     ], None, None, "Returns the list of running instances on the given nodes"),
   ("instance_reboot", SINGLE, None, constants.RPC_TMO_NORMAL, [
     ("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"),
@@ -250,6 +268,7 @@ _INSTANCE_CALLS = [
     ("success", None, "Whether the migration was a success or failure"),
     ], None, None, "Finalize any target-node migration specific operation"),
   ("instance_migrate", SINGLE, None, constants.RPC_TMO_SLOW, [
+    ("cluster_name", None, "Cluster name"),
     ("instance", ED_INST_DICT, "Instance object"),
     ("target", None, "Target node name"),
     ("live", None, "Whether the migration should be done live or not"),
@@ -265,6 +284,7 @@ _INSTANCE_CALLS = [
   ("instance_start", SINGLE, None, constants.RPC_TMO_NORMAL, [
     ("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),
@@ -326,11 +346,12 @@ _BLOCKDEV_CALLS = [
     ], None, None,
    "Gets the sizes of requested block devices present on a node"),
   ("blockdev_create", SINGLE, None, constants.RPC_TMO_NORMAL, [
-    ("bdev", ED_OBJECT_DICT, None),
+    ("bdev", ED_SINGLE_DISK_DICT_DP, None),
     ("size", None, None),
     ("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),
@@ -339,7 +360,7 @@ _BLOCKDEV_CALLS = [
     ], None, None,
     "Request wipe at given offset with given size of a block device"),
   ("blockdev_remove", SINGLE, None, constants.RPC_TMO_NORMAL, [
-    ("bdev", ED_OBJECT_DICT, None),
+    ("bdev", ED_SINGLE_DISK_DICT_DP, None),
     ], None, None, "Request removal of a given block device"),
   ("blockdev_pause_resume_sync", SINGLE, None, constants.RPC_TMO_NORMAL, [
     ("disks", ED_DISKS_DICT_DP, None),
@@ -356,41 +377,44 @@ _BLOCKDEV_CALLS = [
     ], None, None, "Request shutdown of a given block device"),
   ("blockdev_addchildren", SINGLE, None, constants.RPC_TMO_NORMAL, [
     ("bdev", ED_SINGLE_DISK_DICT_DP, None),
-    ("ndevs", ED_OBJECT_DICT_LIST, None),
+    ("ndevs", ED_DISKS_DICT_DP, None),
     ], None, None,
    "Request adding a list of children to a (mirroring) device"),
   ("blockdev_removechildren", SINGLE, None, constants.RPC_TMO_NORMAL, [
-    ("bdev", ED_OBJECT_DICT, None),
-    ("ndevs", ED_OBJECT_DICT_LIST, None),
+    ("bdev", ED_SINGLE_DISK_DICT_DP, None),
+    ("ndevs", ED_DISKS_DICT_DP, None),
     ], None, None,
    "Request removing a list of children from a (mirroring) device"),
   ("blockdev_close", SINGLE, None, constants.RPC_TMO_NORMAL, [
     ("instance_name", None, None),
-    ("disks", ED_OBJECT_DICT_LIST, None),
+    ("disks", ED_DISKS_DICT_DP, None),
     ], None, None, "Closes the given block devices"),
-  ("blockdev_getsize", SINGLE, None, constants.RPC_TMO_NORMAL, [
-    ("disks", ED_OBJECT_DICT_LIST, None),
-    ], None, None, "Returns the size of the given disks"),
+  ("blockdev_getdimensions", SINGLE, None, constants.RPC_TMO_NORMAL, [
+    ("disks", ED_MULTI_DISKS_DICT_DP, None),
+    ], None, None, "Returns size and spindles of the given disks"),
   ("drbd_disconnect_net", MULTI, None, constants.RPC_TMO_NORMAL, [
-    ("nodes_ip", None, None),
-    ("disks", ED_OBJECT_DICT_LIST, None),
-    ], None, None, "Disconnects the network of the given drbd devices"),
+    ("disks", ED_DISKS_DICT_DP, None),
+    ], None, None,
+   "Disconnects the network of the given drbd devices"),
   ("drbd_attach_net", MULTI, None, constants.RPC_TMO_NORMAL, [
-    ("nodes_ip", None, None),
     ("disks", ED_DISKS_DICT_DP, None),
     ("instance_name", None, None),
     ("multimaster", None, None),
     ], None, None, "Connects the given DRBD devices"),
   ("drbd_wait_sync", MULTI, None, constants.RPC_TMO_SLOW, [
-    ("nodes_ip", None, None),
     ("disks", ED_DISKS_DICT_DP, None),
     ], None, None,
    "Waits for the synchronization of drbd devices is complete"),
+  ("drbd_needs_activation", SINGLE, None, constants.RPC_TMO_NORMAL, [
+    ("disks", ED_MULTI_DISKS_DICT_DP, None),
+    ], None, None,
+   "Returns the drbd disks which need activation"),
   ("blockdev_grow", SINGLE, None, constants.RPC_TMO_NORMAL, [
     ("cf_bdev", ED_SINGLE_DISK_DICT_DP, None),
     ("amount", None, None),
     ("dryrun", None, None),
     ("backingstore", None, None),
+    ("es_flag", None, None),
     ], None, None, "Request growing of the given block device by a"
    " given amount"),
   ("blockdev_export", SINGLE, None, constants.RPC_TMO_1DAY, [
@@ -406,7 +430,7 @@ _BLOCKDEV_CALLS = [
     ("devlist", ED_BLOCKDEV_RENAME, None),
     ], None, None, "Request rename of the given block devices"),
   ("blockdev_find", SINGLE, None, constants.RPC_TMO_NORMAL, [
-    ("disk", ED_OBJECT_DICT, None),
+    ("disk", ED_SINGLE_DISK_DICT_DP, None),
     ], None, _BlockdevFindPostProc,
     "Request identification of a given block device"),
   ("blockdev_getmirrorstatus", SINGLE, None, constants.RPC_TMO_NORMAL, [
@@ -414,12 +438,12 @@ _BLOCKDEV_CALLS = [
     ], None, _BlockdevGetMirrorStatusPostProc,
     "Request status of a (mirroring) device"),
   ("blockdev_getmirrorstatus_multi", MULTI, None, constants.RPC_TMO_NORMAL, [
-    ("node_disks", ED_NODE_TO_DISK_DICT, None),
+    ("node_disks", ED_NODE_TO_DISK_DICT_DP, None),
     ], _BlockdevGetMirrorStatusMultiPreProc,
    _BlockdevGetMirrorStatusMultiPostProc,
     "Request status of (mirroring) devices from multiple nodes"),
   ("blockdev_setinfo", SINGLE, None, constants.RPC_TMO_NORMAL, [
-    ("disk", ED_OBJECT_DICT, None),
+    ("disk", ED_SINGLE_DISK_DICT_DP, None),
     ("info", None, None),
     ], None, None, "Sets metadata information on a given block device"),
   ]
@@ -438,19 +462,27 @@ _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"),
     ], None, None, "Checks if a node has the given IP address"),
   ("node_info", MULTI, None, constants.RPC_TMO_URGENT, [
-    ("vg_names", None,
-     "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"),
+    ("storage_units", None,
+     "List of tuples '<storage_type>,<key>,[<param>]' to ask for disk space"
+     " information; the parameter list varies depending on the storage_type"),
+    ("hv_specs", None,
+     "List of hypervisor specification (name, hvparams) to ask for node "
+     "information"),
+    ], _NodeInfoPreProc, None, "Return node information"),
   ("node_verify", MULTI, None, constants.RPC_TMO_NORMAL, [
-    ("checkdict", None, None),
-    ("cluster_name", None, None),
+    ("checkdict", None, "What to verify"),
+    ("cluster_name", None, "Cluster name"),
+    ("all_hvparams", None, "Dictionary mapping hypervisor names to hvparams"),
     ], None, None, "Request verification of given parameters"),
   ("node_volumes", MULTI, None, constants.RPC_TMO_FAST, [], None, None,
    "Gets all volumes on node(s)"),
@@ -458,7 +490,12 @@ _NODE_CALLS = [
    "Demote a node from the master candidate role"),
   ("node_powercycle", SINGLE, ACCEPT_OFFLINE_NODE, constants.RPC_TMO_NORMAL, [
     ("hypervisor", None, "Hypervisor type"),
+    ("hvparams", None, "Hypervisor parameters"),
     ], None, None, "Tries to powercycle a node"),
+  ("node_configure_ovs", SINGLE, None, constants.RPC_TMO_NORMAL, [
+    ("ovs_name", None, "Name of the OpenvSwitch to create"),
+    ("ovs_link", None, "Link of the OpenvSwitch to the outside"),
+    ], None, None, "This will create and setup the OpenvSwitch"),
   ]
 
 _MISC_CALLS = [
@@ -504,13 +541,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),
@@ -521,6 +563,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, [
@@ -556,6 +601,11 @@ 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, "What to verify"),
+      ("cluster_name", None, "Cluster name"),
+      ("hvparams", None, "Dictionary mapping hypervisor names to hvparams"),
+      ], None, None, "Request verification of given parameters"),
     ]),
   "RpcClientConfig": _Prepare([
     ("upload_file", MULTI, None, constants.RPC_TMO_NORMAL, [