Statistics
| Branch: | Tag: | Revision:

root / lib / rpc_defs.py @ 99e222b1

History | View | Annotate | Download (23 kB)

1
#
2
#
3

    
4
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Google Inc.
5
#
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 2 of the License, or
9
# (at your option) any later version.
10
#
11
# This program is distributed in the hope that it will be useful, but
12
# WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
# General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19
# 02110-1301, USA.
20

    
21
"""RPC definitions for communication between master and node daemons.
22

23
RPC definition fields:
24

25
  - Name as string
26
  - L{SINGLE} for single-node calls, L{MULTI} for multi-node
27
  - Name resolver option(s), can be callable receiving all arguments in a tuple
28
  - Timeout (e.g. L{constants.RPC_TMO_NORMAL}), or callback receiving all
29
    arguments in a tuple to calculate timeout
30
  - List of arguments as tuples
31

32
    - Name as string
33
    - Argument kind used for encoding/decoding
34
    - Description for docstring (can be C{None})
35

36
  - Custom body encoder (e.g. for preparing per-node bodies)
37
  - Return value wrapper (e.g. for deserializing into L{objects}-based objects)
38
  - Short call description for docstring
39

40
"""
41

    
42
from ganeti import constants
43
from ganeti import utils
44
from ganeti import objects
45

    
46

    
47
# Guidelines for choosing timeouts:
48
# - call used during watcher: timeout of 1min, constants.RPC_TMO_URGENT
49
# - trivial (but be sure it is trivial)
50
#     (e.g. reading a file): 5min, constants.RPC_TMO_FAST
51
# - other calls: 15 min, constants.RPC_TMO_NORMAL
52
# - special calls (instance add, etc.):
53
#     either constants.RPC_TMO_SLOW (1h) or huge timeouts
54

    
55
SINGLE = "single-node"
56
MULTI = "multi-node"
57

    
58
ACCEPT_OFFLINE_NODE = object()
59

    
60
# Constants for encoding/decoding
61
(ED_OBJECT_DICT,
62
 ED_OBJECT_DICT_LIST,
63
 ED_INST_DICT,
64
 ED_INST_DICT_HVP_BEP_DP,
65
 ED_NODE_TO_DISK_DICT,
66
 ED_INST_DICT_OSP_DP,
67
 ED_IMPEXP_IO,
68
 ED_FILE_DETAILS,
69
 ED_FINALIZE_EXPORT_DISKS,
70
 ED_COMPRESS,
71
 ED_BLOCKDEV_RENAME,
72
 ED_DISKS_DICT_DP,
73
 ED_SINGLE_DISK_DICT_DP,
74
 ED_NIC_DICT) = range(1, 15)
75

    
76

    
77
def _Prepare(calls):
78
  """Converts list of calls to dictionary.
79

80
  """
81
  return utils.SequenceToDict(calls)
82

    
83

    
84
def _MigrationStatusPostProc(result):
85
  """Post-processor for L{rpc.RpcRunner.call_instance_get_migration_status}.
86

87
  """
88
  if not result.fail_msg and result.payload is not None:
89
    result.payload = objects.MigrationStatus.FromDict(result.payload)
90
  return result
91

    
92

    
93
def _BlockdevFindPostProc(result):
94
  """Post-processor for L{rpc.RpcRunner.call_blockdev_find}.
95

96
  """
97
  if not result.fail_msg and result.payload is not None:
98
    result.payload = objects.BlockDevStatus.FromDict(result.payload)
99
  return result
100

    
101

    
102
def _BlockdevGetMirrorStatusPostProc(result):
103
  """Post-processor for L{rpc.RpcRunner.call_blockdev_getmirrorstatus}.
104

105
  """
106
  if not result.fail_msg:
107
    result.payload = map(objects.BlockDevStatus.FromDict, result.payload)
108
  return result
109

    
110

    
111
def _BlockdevGetMirrorStatusMultiPreProc(node, args):
112
  """Prepares the appropriate node values for blockdev_getmirrorstatus_multi.
113

114
  """
115
  # there should be only one argument to this RPC, already holding a
116
  # node->disks dictionary, we just need to extract the value for the
117
  # current node
118
  assert len(args) == 1
119
  return [args[0][node]]
120

    
121

    
122
def _BlockdevGetMirrorStatusMultiPostProc(result):
123
  """Post-processor for L{rpc.RpcRunner.call_blockdev_getmirrorstatus_multi}.
124

125
  """
126
  if not result.fail_msg:
127
    for idx, (success, status) in enumerate(result.payload):
128
      if success:
129
        result.payload[idx] = (success, objects.BlockDevStatus.FromDict(status))
130

    
131
  return result
132

    
133

    
134
def _OsGetPostProc(result):
135
  """Post-processor for L{rpc.RpcRunner.call_os_get}.
136

137
  """
138
  if not result.fail_msg and isinstance(result.payload, dict):
139
    result.payload = objects.OS.FromDict(result.payload)
140
  return result
141

    
142

    
143
def _ImpExpStatusPostProc(result):
144
  """Post-processor for import/export status.
145

146
  @rtype: Payload containing list of L{objects.ImportExportStatus} instances
147
  @return: Returns a list of the state of each named import/export or None if
148
           a status couldn't be retrieved
149

150
  """
151
  if not result.fail_msg:
152
    decoded = []
153

    
154
    for i in result.payload:
155
      if i is None:
156
        decoded.append(None)
157
        continue
158
      decoded.append(objects.ImportExportStatus.FromDict(i))
159

    
160
    result.payload = decoded
161

    
162
  return result
163

    
164

    
165
def _TestDelayTimeout((duration, )):
166
  """Calculate timeout for "test_delay" RPC.
167

168
  """
169
  return int(duration + 5)
170

    
171

    
172
_FILE_STORAGE_CALLS = [
173
  ("file_storage_dir_create", SINGLE, None, constants.RPC_TMO_FAST, [
174
    ("file_storage_dir", None, "File storage directory"),
175
    ], None, None, "Create the given file storage directory"),
176
  ("file_storage_dir_remove", SINGLE, None, constants.RPC_TMO_FAST, [
177
    ("file_storage_dir", None, "File storage directory"),
178
    ], None, None, "Remove the given file storage directory"),
179
  ("file_storage_dir_rename", SINGLE, None, constants.RPC_TMO_FAST, [
180
    ("old_file_storage_dir", None, "Old name"),
181
    ("new_file_storage_dir", None, "New name"),
182
    ], None, None, "Rename file storage directory"),
183
  ]
184

    
185
_STORAGE_CALLS = [
186
  ("storage_list", MULTI, None, constants.RPC_TMO_NORMAL, [
187
    ("su_name", None, None),
188
    ("su_args", None, None),
189
    ("name", None, None),
190
    ("fields", None, None),
191
    ], None, None, "Get list of storage units"),
192
  ("storage_modify", SINGLE, None, constants.RPC_TMO_NORMAL, [
193
    ("su_name", None, None),
194
    ("su_args", None, None),
195
    ("name", None, None),
196
    ("changes", None, None),
197
    ], None, None, "Modify a storage unit"),
198
  ("storage_execute", SINGLE, None, constants.RPC_TMO_NORMAL, [
199
    ("su_name", None, None),
200
    ("su_args", None, None),
201
    ("name", None, None),
202
    ("op", None, None),
203
    ], None, None, "Executes an operation on a storage unit"),
204
  ]
205

    
206
_INSTANCE_CALLS = [
207
  ("instance_info", SINGLE, None, constants.RPC_TMO_URGENT, [
208
    ("instance", None, "Instance name"),
209
    ("hname", None, "Hypervisor type"),
210
    ], None, None, "Returns information about a single instance"),
211
  ("all_instances_info", MULTI, None, constants.RPC_TMO_URGENT, [
212
    ("hypervisor_list", None, "Hypervisors to query for instances"),
213
    ], None, None,
214
   "Returns information about all instances on the given nodes"),
215
  ("instance_list", MULTI, None, constants.RPC_TMO_URGENT, [
216
    ("hypervisor_list", None, "Hypervisors to query for instances"),
217
    ], None, None, "Returns the list of running instances on the given nodes"),
218
  ("instance_reboot", SINGLE, None, constants.RPC_TMO_NORMAL, [
219
    ("inst", ED_INST_DICT, "Instance object"),
220
    ("reboot_type", None, None),
221
    ("shutdown_timeout", None, None),
222
    ], None, None, "Returns the list of running instances on the given nodes"),
223
  ("instance_shutdown", SINGLE, None, constants.RPC_TMO_NORMAL, [
224
    ("instance", ED_INST_DICT, "Instance object"),
225
    ("timeout", None, None),
226
    ], None, None, "Stops an instance"),
227
  ("instance_balloon_memory", SINGLE, None, constants.RPC_TMO_NORMAL, [
228
    ("instance", ED_INST_DICT, "Instance object"),
229
    ("memory", None, None),
230
    ], None, None, "Modify the amount of an instance's runtime memory"),
231
  ("instance_run_rename", SINGLE, None, constants.RPC_TMO_SLOW, [
232
    ("instance", ED_INST_DICT, "Instance object"),
233
    ("old_name", None, None),
234
    ("debug", None, None),
235
    ], None, None, "Run the OS rename script for an instance"),
236
  ("instance_migratable", SINGLE, None, constants.RPC_TMO_NORMAL, [
237
    ("instance", ED_INST_DICT, "Instance object"),
238
    ], None, None, "Checks whether the given instance can be migrated"),
239
  ("migration_info", SINGLE, None, constants.RPC_TMO_NORMAL, [
240
    ("instance", ED_INST_DICT, "Instance object"),
241
    ], None, None,
242
    "Gather the information necessary to prepare an instance migration"),
243
  ("accept_instance", SINGLE, None, constants.RPC_TMO_NORMAL, [
244
    ("instance", ED_INST_DICT, "Instance object"),
245
    ("info", None, "Result for the call_migration_info call"),
246
    ("target", None, "Target hostname (usually an IP address)"),
247
    ], None, None, "Prepare a node to accept an instance"),
248
  ("instance_finalize_migration_dst", SINGLE, None, constants.RPC_TMO_NORMAL, [
249
    ("instance", ED_INST_DICT, "Instance object"),
250
    ("info", None, "Result for the call_migration_info call"),
251
    ("success", None, "Whether the migration was a success or failure"),
252
    ], None, None, "Finalize any target-node migration specific operation"),
253
  ("instance_migrate", SINGLE, None, constants.RPC_TMO_SLOW, [
254
    ("instance", ED_INST_DICT, "Instance object"),
255
    ("target", None, "Target node name"),
256
    ("live", None, "Whether the migration should be done live or not"),
257
    ], None, None, "Migrate an instance"),
258
  ("instance_finalize_migration_src", SINGLE, None, constants.RPC_TMO_SLOW, [
259
    ("instance", ED_INST_DICT, "Instance object"),
260
    ("success", None, "Whether the migration succeeded or not"),
261
    ("live", None, "Whether the user requested a live migration or not"),
262
    ], None, None, "Finalize the instance migration on the source node"),
263
  ("instance_get_migration_status", SINGLE, None, constants.RPC_TMO_SLOW, [
264
    ("instance", ED_INST_DICT, "Instance object"),
265
    ], None, _MigrationStatusPostProc, "Report migration status"),
266
  ("instance_start", SINGLE, None, constants.RPC_TMO_NORMAL, [
267
    ("instance_hvp_bep", ED_INST_DICT_HVP_BEP_DP, None),
268
    ("startup_paused", None, None),
269
    ], None, None, "Starts an instance"),
270
  ("instance_os_add", SINGLE, None, constants.RPC_TMO_1DAY, [
271
    ("instance_osp", ED_INST_DICT_OSP_DP, None),
272
    ("reinstall", None, None),
273
    ("debug", None, None),
274
    ], None, None, "Starts an instance"),
275
  ]
276

    
277
_IMPEXP_CALLS = [
278
  ("import_start", SINGLE, None, constants.RPC_TMO_NORMAL, [
279
    ("opts", ED_OBJECT_DICT, None),
280
    ("instance", ED_INST_DICT, None),
281
    ("component", None, None),
282
    ("dest", ED_IMPEXP_IO, "Import destination"),
283
    ], None, None, "Starts an import daemon"),
284
  ("export_start", SINGLE, None, constants.RPC_TMO_NORMAL, [
285
    ("opts", ED_OBJECT_DICT, None),
286
    ("host", None, None),
287
    ("port", None, None),
288
    ("instance", ED_INST_DICT, None),
289
    ("component", None, None),
290
    ("source", ED_IMPEXP_IO, "Export source"),
291
    ], None, None, "Starts an export daemon"),
292
  ("impexp_status", SINGLE, None, constants.RPC_TMO_FAST, [
293
    ("names", None, "Import/export names"),
294
    ], None, _ImpExpStatusPostProc, "Gets the status of an import or export"),
295
  ("impexp_abort", SINGLE, None, constants.RPC_TMO_NORMAL, [
296
    ("name", None, "Import/export name"),
297
    ], None, None, "Aborts an import or export"),
298
  ("impexp_cleanup", SINGLE, None, constants.RPC_TMO_NORMAL, [
299
    ("name", None, "Import/export name"),
300
    ], None, None, "Cleans up after an import or export"),
301
  ("export_info", SINGLE, None, constants.RPC_TMO_FAST, [
302
    ("path", None, None),
303
    ], None, None, "Queries the export information in a given path"),
304
  ("finalize_export", SINGLE, None, constants.RPC_TMO_NORMAL, [
305
    ("instance", ED_INST_DICT, None),
306
    ("snap_disks", ED_FINALIZE_EXPORT_DISKS, None),
307
    ], None, None, "Request the completion of an export operation"),
308
  ("export_list", MULTI, None, constants.RPC_TMO_FAST, [], None, None,
309
   "Gets the stored exports list"),
310
  ("export_remove", SINGLE, None, constants.RPC_TMO_FAST, [
311
    ("export", None, None),
312
    ], None, None, "Requests removal of a given export"),
313
  ]
314

    
315
_X509_CALLS = [
316
  ("x509_cert_create", SINGLE, None, constants.RPC_TMO_NORMAL, [
317
    ("validity", None, "Validity in seconds"),
318
    ], None, None, "Creates a new X509 certificate for SSL/TLS"),
319
  ("x509_cert_remove", SINGLE, None, constants.RPC_TMO_NORMAL, [
320
    ("name", None, "Certificate name"),
321
    ], None, None, "Removes a X509 certificate"),
322
  ]
323

    
324
_BLOCKDEV_CALLS = [
325
  ("bdev_sizes", MULTI, None, constants.RPC_TMO_URGENT, [
326
    ("devices", None, None),
327
    ], None, None,
328
   "Gets the sizes of requested block devices present on a node"),
329
  ("blockdev_create", SINGLE, None, constants.RPC_TMO_NORMAL, [
330
    ("bdev", ED_OBJECT_DICT, None),
331
    ("size", None, None),
332
    ("owner", None, None),
333
    ("on_primary", None, None),
334
    ("info", None, None),
335
    ], None, None, "Request creation of a given block device"),
336
  ("blockdev_wipe", SINGLE, None, constants.RPC_TMO_SLOW, [
337
    ("bdev", ED_SINGLE_DISK_DICT_DP, None),
338
    ("offset", None, None),
339
    ("size", None, None),
340
    ], None, None,
341
    "Request wipe at given offset with given size of a block device"),
342
  ("blockdev_remove", SINGLE, None, constants.RPC_TMO_NORMAL, [
343
    ("bdev", ED_OBJECT_DICT, None),
344
    ], None, None, "Request removal of a given block device"),
345
  ("blockdev_pause_resume_sync", SINGLE, None, constants.RPC_TMO_NORMAL, [
346
    ("disks", ED_DISKS_DICT_DP, None),
347
    ("pause", None, None),
348
    ], None, None, "Request a pause/resume of given block device"),
349
  ("blockdev_assemble", SINGLE, None, constants.RPC_TMO_NORMAL, [
350
    ("disk", ED_SINGLE_DISK_DICT_DP, None),
351
    ("owner", None, None),
352
    ("on_primary", None, None),
353
    ("idx", None, None),
354
    ], None, None, "Request assembling of a given block device"),
355
  ("blockdev_shutdown", SINGLE, None, constants.RPC_TMO_NORMAL, [
356
    ("disk", ED_SINGLE_DISK_DICT_DP, None),
357
    ], None, None, "Request shutdown of a given block device"),
358
  ("blockdev_addchildren", SINGLE, None, constants.RPC_TMO_NORMAL, [
359
    ("bdev", ED_SINGLE_DISK_DICT_DP, None),
360
    ("ndevs", ED_OBJECT_DICT_LIST, None),
361
    ], None, None,
362
   "Request adding a list of children to a (mirroring) device"),
363
  ("blockdev_removechildren", SINGLE, None, constants.RPC_TMO_NORMAL, [
364
    ("bdev", ED_OBJECT_DICT, None),
365
    ("ndevs", ED_OBJECT_DICT_LIST, None),
366
    ], None, None,
367
   "Request removing a list of children from a (mirroring) device"),
368
  ("blockdev_close", SINGLE, None, constants.RPC_TMO_NORMAL, [
369
    ("instance_name", None, None),
370
    ("disks", ED_OBJECT_DICT_LIST, None),
371
    ], None, None, "Closes the given block devices"),
372
  ("blockdev_getsize", SINGLE, None, constants.RPC_TMO_NORMAL, [
373
    ("disks", ED_OBJECT_DICT_LIST, None),
374
    ], None, None, "Returns the size of the given disks"),
375
  ("drbd_disconnect_net", MULTI, None, constants.RPC_TMO_NORMAL, [
376
    ("nodes_ip", None, None),
377
    ("disks", ED_OBJECT_DICT_LIST, None),
378
    ], None, None, "Disconnects the network of the given drbd devices"),
379
  ("drbd_attach_net", MULTI, None, constants.RPC_TMO_NORMAL, [
380
    ("nodes_ip", None, None),
381
    ("disks", ED_DISKS_DICT_DP, None),
382
    ("instance_name", None, None),
383
    ("multimaster", None, None),
384
    ], None, None, "Connects the given DRBD devices"),
385
  ("drbd_wait_sync", MULTI, None, constants.RPC_TMO_SLOW, [
386
    ("nodes_ip", None, None),
387
    ("disks", ED_DISKS_DICT_DP, None),
388
    ], None, None,
389
   "Waits for the synchronization of drbd devices is complete"),
390
  ("blockdev_grow", SINGLE, None, constants.RPC_TMO_NORMAL, [
391
    ("cf_bdev", ED_SINGLE_DISK_DICT_DP, None),
392
    ("amount", None, None),
393
    ("dryrun", None, None),
394
    ("backingstore", None, None),
395
    ], None, None, "Request growing of the given block device by a"
396
   " given amount"),
397
  ("blockdev_export", SINGLE, None, constants.RPC_TMO_1DAY, [
398
    ("cf_bdev", ED_SINGLE_DISK_DICT_DP, None),
399
    ("dest_node", None, None),
400
    ("dest_path", None, None),
401
    ("cluster_name", None, None),
402
    ], None, None, "Export a given disk to another node"),
403
  ("blockdev_snapshot", SINGLE, None, constants.RPC_TMO_NORMAL, [
404
    ("cf_bdev", ED_SINGLE_DISK_DICT_DP, None),
405
    ], None, None, "Export a given disk to another node"),
406
  ("blockdev_rename", SINGLE, None, constants.RPC_TMO_NORMAL, [
407
    ("devlist", ED_BLOCKDEV_RENAME, None),
408
    ], None, None, "Request rename of the given block devices"),
409
  ("blockdev_find", SINGLE, None, constants.RPC_TMO_NORMAL, [
410
    ("disk", ED_OBJECT_DICT, None),
411
    ], None, _BlockdevFindPostProc,
412
    "Request identification of a given block device"),
413
  ("blockdev_getmirrorstatus", SINGLE, None, constants.RPC_TMO_NORMAL, [
414
    ("disks", ED_DISKS_DICT_DP, None),
415
    ], None, _BlockdevGetMirrorStatusPostProc,
416
    "Request status of a (mirroring) device"),
417
  ("blockdev_getmirrorstatus_multi", MULTI, None, constants.RPC_TMO_NORMAL, [
418
    ("node_disks", ED_NODE_TO_DISK_DICT, None),
419
    ], _BlockdevGetMirrorStatusMultiPreProc,
420
   _BlockdevGetMirrorStatusMultiPostProc,
421
    "Request status of (mirroring) devices from multiple nodes"),
422
  ("blockdev_setinfo", SINGLE, None, constants.RPC_TMO_NORMAL, [
423
    ("disk", ED_OBJECT_DICT, None),
424
    ("info", None, None),
425
    ], None, None, "Sets metadata information on a given block device"),
426
  ]
427

    
428
_OS_CALLS = [
429
  ("os_diagnose", MULTI, None, constants.RPC_TMO_FAST, [], None, None,
430
   "Request a diagnose of OS definitions"),
431
  ("os_validate", MULTI, None, constants.RPC_TMO_FAST, [
432
    ("required", None, None),
433
    ("name", None, None),
434
    ("checks", None, None),
435
    ("params", None, None),
436
    ], None, None, "Run a validation routine for a given OS"),
437
  ("os_get", SINGLE, None, constants.RPC_TMO_FAST, [
438
    ("name", None, None),
439
    ], None, _OsGetPostProc, "Returns an OS definition"),
440
  ]
441

    
442
_NODE_CALLS = [
443
  ("node_has_ip_address", SINGLE, None, constants.RPC_TMO_FAST, [
444
    ("address", None, "IP address"),
445
    ], None, None, "Checks if a node has the given IP address"),
446
  ("node_info", MULTI, None, constants.RPC_TMO_URGENT, [
447
    ("vg_names", None,
448
     "Names of the volume groups to ask for disk space information"),
449
    ("hv_names", None,
450
     "Names of the hypervisors to ask for node information"),
451
    ], None, None, "Return node information"),
452
  ("node_verify", MULTI, None, constants.RPC_TMO_NORMAL, [
453
    ("checkdict", None, None),
454
    ("cluster_name", None, None),
455
    ], None, None, "Request verification of given parameters"),
456
  ("node_volumes", MULTI, None, constants.RPC_TMO_FAST, [], None, None,
457
   "Gets all volumes on node(s)"),
458
  ("node_demote_from_mc", SINGLE, None, constants.RPC_TMO_FAST, [], None, None,
459
   "Demote a node from the master candidate role"),
460
  ("node_powercycle", SINGLE, ACCEPT_OFFLINE_NODE, constants.RPC_TMO_NORMAL, [
461
    ("hypervisor", None, "Hypervisor type"),
462
    ], None, None, "Tries to powercycle a node"),
463
  ]
464

    
465
_MISC_CALLS = [
466
  ("lv_list", MULTI, None, constants.RPC_TMO_URGENT, [
467
    ("vg_name", None, None),
468
    ], None, None, "Gets the logical volumes present in a given volume group"),
469
  ("vg_list", MULTI, None, constants.RPC_TMO_URGENT, [], None, None,
470
   "Gets the volume group list"),
471
  ("bridges_exist", SINGLE, None, constants.RPC_TMO_URGENT, [
472
    ("bridges_list", None, "Bridges which must be present on remote node"),
473
    ], None, None, "Checks if a node has all the bridges given"),
474
  ("etc_hosts_modify", SINGLE, None, constants.RPC_TMO_NORMAL, [
475
    ("mode", None,
476
     "Mode to operate; currently L{constants.ETC_HOSTS_ADD} or"
477
     " L{constants.ETC_HOSTS_REMOVE}"),
478
    ("name", None, "Hostname to be modified"),
479
    ("ip", None, "IP address (L{constants.ETC_HOSTS_ADD} only)"),
480
    ], None, None, "Modify hosts file with name"),
481
  ("drbd_helper", MULTI, None, constants.RPC_TMO_URGENT, [],
482
   None, None, "Gets DRBD helper"),
483
  ("restricted_command", MULTI, None, constants.RPC_TMO_SLOW, [
484
    ("cmd", None, "Command name"),
485
    ], None, None, "Runs restricted command"),
486
  ("run_oob", SINGLE, None, constants.RPC_TMO_NORMAL, [
487
    ("oob_program", None, None),
488
    ("command", None, None),
489
    ("remote_node", None, None),
490
    ("timeout", None, None),
491
    ], None, None, "Runs out-of-band command"),
492
  ("hooks_runner", MULTI, None, constants.RPC_TMO_NORMAL, [
493
    ("hpath", None, None),
494
    ("phase", None, None),
495
    ("env", None, None),
496
    ], None, None, "Call the hooks runner"),
497
  ("iallocator_runner", SINGLE, None, constants.RPC_TMO_NORMAL, [
498
    ("name", None, "Iallocator name"),
499
    ("idata", None, "JSON-encoded input string"),
500
    ], None, None, "Call an iallocator on a remote node"),
501
  ("test_delay", MULTI, None, _TestDelayTimeout, [
502
    ("duration", None, None),
503
    ], None, None, "Sleep for a fixed time on given node(s)"),
504
  ("hypervisor_validate_params", MULTI, None, constants.RPC_TMO_NORMAL, [
505
    ("hvname", None, "Hypervisor name"),
506
    ("hvfull", None, "Parameters to be validated"),
507
    ], None, None, "Validate hypervisor params"),
508
  ("set_watcher_pause", MULTI, None, constants.RPC_TMO_URGENT, [
509
    ("until", None, None),
510
    ], None, None, "Set watcher pause end"),
511
  ]
512

    
513
CALLS = {
514
  "RpcClientDefault":
515
    _Prepare(_IMPEXP_CALLS + _X509_CALLS + _OS_CALLS + _NODE_CALLS +
516
             _FILE_STORAGE_CALLS + _MISC_CALLS + _INSTANCE_CALLS +
517
             _BLOCKDEV_CALLS + _STORAGE_CALLS),
518
  "RpcClientJobQueue": _Prepare([
519
    ("jobqueue_update", MULTI, None, constants.RPC_TMO_URGENT, [
520
      ("file_name", None, None),
521
      ("content", ED_COMPRESS, None),
522
      ], None, None, "Update job queue file"),
523
    ("jobqueue_purge", SINGLE, None, constants.RPC_TMO_NORMAL, [], None, None,
524
     "Purge job queue"),
525
    ("jobqueue_rename", MULTI, None, constants.RPC_TMO_URGENT, [
526
      ("rename", None, None),
527
      ], None, None, "Rename job queue file"),
528
    ("jobqueue_set_drain_flag", MULTI, None, constants.RPC_TMO_URGENT, [
529
      ("flag", None, None),
530
      ], None, None, "Set job queue drain flag"),
531
    ]),
532
  "RpcClientBootstrap": _Prepare([
533
    ("node_start_master_daemons", SINGLE, None, constants.RPC_TMO_FAST, [
534
      ("no_voting", None, None),
535
      ], None, None, "Starts master daemons on a node"),
536
    ("node_activate_master_ip", SINGLE, None, constants.RPC_TMO_FAST, [
537
      ("master_params", ED_OBJECT_DICT, "Network parameters of the master"),
538
      ("use_external_mip_script", None,
539
       "Whether to use the user-provided master IP address setup script"),
540
      ], None, None,
541
      "Activates master IP on a node"),
542
    ("node_stop_master", SINGLE, None, constants.RPC_TMO_FAST, [], None, None,
543
     "Deactivates master IP and stops master daemons on a node"),
544
    ("node_deactivate_master_ip", SINGLE, None, constants.RPC_TMO_FAST, [
545
      ("master_params", ED_OBJECT_DICT, "Network parameters of the master"),
546
      ("use_external_mip_script", None,
547
       "Whether to use the user-provided master IP address setup script"),
548
      ], None, None,
549
     "Deactivates master IP on a node"),
550
    ("node_change_master_netmask", SINGLE, None, constants.RPC_TMO_FAST, [
551
      ("old_netmask", None, "The old value of the netmask"),
552
      ("netmask", None, "The new value of the netmask"),
553
      ("master_ip", None, "The master IP"),
554
      ("master_netdev", None, "The master network device"),
555
      ], None, None, "Change master IP netmask"),
556
    ("node_leave_cluster", SINGLE, None, constants.RPC_TMO_NORMAL, [
557
      ("modify_ssh_setup", None, None),
558
      ], None, None,
559
     "Requests a node to clean the cluster information it has"),
560
    ("master_info", MULTI, None, constants.RPC_TMO_URGENT, [], None, None,
561
     "Query master info"),
562
    ]),
563
  "RpcClientDnsOnly": _Prepare([
564
    ("version", MULTI, ACCEPT_OFFLINE_NODE, constants.RPC_TMO_URGENT, [], None,
565
     None, "Query node version"),
566
    ]),
567
  "RpcClientConfig": _Prepare([
568
    ("upload_file", MULTI, None, constants.RPC_TMO_NORMAL, [
569
      ("file_name", ED_FILE_DETAILS, None),
570
      ], None, None, "Upload a file"),
571
    ("write_ssconf_files", MULTI, None, constants.RPC_TMO_NORMAL, [
572
      ("values", None, None),
573
      ], None, None, "Write ssconf files"),
574
    ]),
575
  }