Statistics
| Branch: | Tag: | Revision:

root / lib / rpc_defs.py @ 2ff587d4

History | View | Annotate | Download (22.4 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,
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) = range(1, 14)
74

    
75

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

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

    
82

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

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

    
91

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

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

    
100

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

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

    
109

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

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

    
120

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

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

    
130
  return result
131

    
132

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

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

    
141

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

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

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

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

    
159
    result.payload = decoded
160

    
161
  return result
162

    
163

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

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

    
170

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

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

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

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

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

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

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

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

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

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