Revision 2ff587d4 lib/rpc_defs.py
b/lib/rpc_defs.py | ||
---|---|---|
25 | 25 |
- Name as string |
26 | 26 |
- L{SINGLE} for single-node calls, L{MULTI} for multi-node |
27 | 27 |
- Name resolver option(s), can be callable receiving all arguments in a tuple |
28 |
- Timeout (e.g. L{TMO_NORMAL}), or callback receiving all arguments in a
|
|
29 |
tuple to calculate timeout |
|
28 |
- Timeout (e.g. L{constants.RPC_TMO_NORMAL}), or callback receiving all
|
|
29 |
arguments in a tuple to calculate timeout
|
|
30 | 30 |
- List of arguments as tuples |
31 | 31 |
|
32 | 32 |
- Name as string |
... | ... | |
39 | 39 |
|
40 | 40 |
""" |
41 | 41 |
|
42 |
from ganeti import constants |
|
42 | 43 |
from ganeti import utils |
43 | 44 |
from ganeti import objects |
44 | 45 |
|
45 | 46 |
|
46 | 47 |
# Guidelines for choosing timeouts: |
47 |
# - call used during watcher: timeout of 1min, _TMO_URGENT |
|
48 |
# - trivial (but be sure it is trivial) (e.g. reading a file): 5min, _TMO_FAST |
|
49 |
# - other calls: 15 min, _TMO_NORMAL |
|
50 |
# - special calls (instance add, etc.): either _TMO_SLOW (1h) or huge timeouts |
|
51 |
TMO_URGENT = 60 # one minute |
|
52 |
TMO_FAST = 5 * 60 # five minutes |
|
53 |
TMO_NORMAL = 15 * 60 # 15 minutes |
|
54 |
TMO_SLOW = 3600 # one hour |
|
55 |
TMO_4HRS = 4 * 3600 |
|
56 |
TMO_1DAY = 86400 |
|
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 |
|
57 | 54 |
|
58 | 55 |
SINGLE = "single-node" |
59 | 56 |
MULTI = "multi-node" |
... | ... | |
172 | 169 |
|
173 | 170 |
|
174 | 171 |
_FILE_STORAGE_CALLS = [ |
175 |
("file_storage_dir_create", SINGLE, None, TMO_FAST, [ |
|
172 |
("file_storage_dir_create", SINGLE, None, constants.RPC_TMO_FAST, [
|
|
176 | 173 |
("file_storage_dir", None, "File storage directory"), |
177 | 174 |
], None, None, "Create the given file storage directory"), |
178 |
("file_storage_dir_remove", SINGLE, None, TMO_FAST, [ |
|
175 |
("file_storage_dir_remove", SINGLE, None, constants.RPC_TMO_FAST, [
|
|
179 | 176 |
("file_storage_dir", None, "File storage directory"), |
180 | 177 |
], None, None, "Remove the given file storage directory"), |
181 |
("file_storage_dir_rename", SINGLE, None, TMO_FAST, [ |
|
178 |
("file_storage_dir_rename", SINGLE, None, constants.RPC_TMO_FAST, [
|
|
182 | 179 |
("old_file_storage_dir", None, "Old name"), |
183 | 180 |
("new_file_storage_dir", None, "New name"), |
184 | 181 |
], None, None, "Rename file storage directory"), |
185 | 182 |
] |
186 | 183 |
|
187 | 184 |
_STORAGE_CALLS = [ |
188 |
("storage_list", MULTI, None, TMO_NORMAL, [ |
|
185 |
("storage_list", MULTI, None, constants.RPC_TMO_NORMAL, [
|
|
189 | 186 |
("su_name", None, None), |
190 | 187 |
("su_args", None, None), |
191 | 188 |
("name", None, None), |
192 | 189 |
("fields", None, None), |
193 | 190 |
], None, None, "Get list of storage units"), |
194 |
("storage_modify", SINGLE, None, TMO_NORMAL, [ |
|
191 |
("storage_modify", SINGLE, None, constants.RPC_TMO_NORMAL, [
|
|
195 | 192 |
("su_name", None, None), |
196 | 193 |
("su_args", None, None), |
197 | 194 |
("name", None, None), |
198 | 195 |
("changes", None, None), |
199 | 196 |
], None, None, "Modify a storage unit"), |
200 |
("storage_execute", SINGLE, None, TMO_NORMAL, [ |
|
197 |
("storage_execute", SINGLE, None, constants.RPC_TMO_NORMAL, [
|
|
201 | 198 |
("su_name", None, None), |
202 | 199 |
("su_args", None, None), |
203 | 200 |
("name", None, None), |
... | ... | |
206 | 203 |
] |
207 | 204 |
|
208 | 205 |
_INSTANCE_CALLS = [ |
209 |
("instance_info", SINGLE, None, TMO_URGENT, [ |
|
206 |
("instance_info", SINGLE, None, constants.RPC_TMO_URGENT, [
|
|
210 | 207 |
("instance", None, "Instance name"), |
211 | 208 |
("hname", None, "Hypervisor type"), |
212 | 209 |
], None, None, "Returns information about a single instance"), |
213 |
("all_instances_info", MULTI, None, TMO_URGENT, [ |
|
210 |
("all_instances_info", MULTI, None, constants.RPC_TMO_URGENT, [
|
|
214 | 211 |
("hypervisor_list", None, "Hypervisors to query for instances"), |
215 | 212 |
], None, None, |
216 | 213 |
"Returns information about all instances on the given nodes"), |
217 |
("instance_list", MULTI, None, TMO_URGENT, [ |
|
214 |
("instance_list", MULTI, None, constants.RPC_TMO_URGENT, [
|
|
218 | 215 |
("hypervisor_list", None, "Hypervisors to query for instances"), |
219 | 216 |
], None, None, "Returns the list of running instances on the given nodes"), |
220 |
("instance_reboot", SINGLE, None, TMO_NORMAL, [ |
|
217 |
("instance_reboot", SINGLE, None, constants.RPC_TMO_NORMAL, [
|
|
221 | 218 |
("inst", ED_INST_DICT, "Instance object"), |
222 | 219 |
("reboot_type", None, None), |
223 | 220 |
("shutdown_timeout", None, None), |
224 | 221 |
], None, None, "Returns the list of running instances on the given nodes"), |
225 |
("instance_shutdown", SINGLE, None, TMO_NORMAL, [ |
|
222 |
("instance_shutdown", SINGLE, None, constants.RPC_TMO_NORMAL, [
|
|
226 | 223 |
("instance", ED_INST_DICT, "Instance object"), |
227 | 224 |
("timeout", None, None), |
228 | 225 |
], None, None, "Stops an instance"), |
229 |
("instance_balloon_memory", SINGLE, None, TMO_NORMAL, [ |
|
226 |
("instance_balloon_memory", SINGLE, None, constants.RPC_TMO_NORMAL, [
|
|
230 | 227 |
("instance", ED_INST_DICT, "Instance object"), |
231 | 228 |
("memory", None, None), |
232 | 229 |
], None, None, "Modify the amount of an instance's runtime memory"), |
233 |
("instance_run_rename", SINGLE, None, TMO_SLOW, [ |
|
230 |
("instance_run_rename", SINGLE, None, constants.RPC_TMO_SLOW, [
|
|
234 | 231 |
("instance", ED_INST_DICT, "Instance object"), |
235 | 232 |
("old_name", None, None), |
236 | 233 |
("debug", None, None), |
237 | 234 |
], None, None, "Run the OS rename script for an instance"), |
238 |
("instance_migratable", SINGLE, None, TMO_NORMAL, [ |
|
235 |
("instance_migratable", SINGLE, None, constants.RPC_TMO_NORMAL, [
|
|
239 | 236 |
("instance", ED_INST_DICT, "Instance object"), |
240 | 237 |
], None, None, "Checks whether the given instance can be migrated"), |
241 |
("migration_info", SINGLE, None, TMO_NORMAL, [ |
|
238 |
("migration_info", SINGLE, None, constants.RPC_TMO_NORMAL, [
|
|
242 | 239 |
("instance", ED_INST_DICT, "Instance object"), |
243 | 240 |
], None, None, |
244 | 241 |
"Gather the information necessary to prepare an instance migration"), |
245 |
("accept_instance", SINGLE, None, TMO_NORMAL, [ |
|
242 |
("accept_instance", SINGLE, None, constants.RPC_TMO_NORMAL, [
|
|
246 | 243 |
("instance", ED_INST_DICT, "Instance object"), |
247 | 244 |
("info", None, "Result for the call_migration_info call"), |
248 | 245 |
("target", None, "Target hostname (usually an IP address)"), |
249 | 246 |
], None, None, "Prepare a node to accept an instance"), |
250 |
("instance_finalize_migration_dst", SINGLE, None, TMO_NORMAL, [ |
|
247 |
("instance_finalize_migration_dst", SINGLE, None, constants.RPC_TMO_NORMAL, [
|
|
251 | 248 |
("instance", ED_INST_DICT, "Instance object"), |
252 | 249 |
("info", None, "Result for the call_migration_info call"), |
253 | 250 |
("success", None, "Whether the migration was a success or failure"), |
254 | 251 |
], None, None, "Finalize any target-node migration specific operation"), |
255 |
("instance_migrate", SINGLE, None, TMO_SLOW, [ |
|
252 |
("instance_migrate", SINGLE, None, constants.RPC_TMO_SLOW, [
|
|
256 | 253 |
("instance", ED_INST_DICT, "Instance object"), |
257 | 254 |
("target", None, "Target node name"), |
258 | 255 |
("live", None, "Whether the migration should be done live or not"), |
259 | 256 |
], None, None, "Migrate an instance"), |
260 |
("instance_finalize_migration_src", SINGLE, None, TMO_SLOW, [ |
|
257 |
("instance_finalize_migration_src", SINGLE, None, constants.RPC_TMO_SLOW, [
|
|
261 | 258 |
("instance", ED_INST_DICT, "Instance object"), |
262 | 259 |
("success", None, "Whether the migration succeeded or not"), |
263 | 260 |
("live", None, "Whether the user requested a live migration or not"), |
264 | 261 |
], None, None, "Finalize the instance migration on the source node"), |
265 |
("instance_get_migration_status", SINGLE, None, TMO_SLOW, [ |
|
262 |
("instance_get_migration_status", SINGLE, None, constants.RPC_TMO_SLOW, [
|
|
266 | 263 |
("instance", ED_INST_DICT, "Instance object"), |
267 | 264 |
], None, _MigrationStatusPostProc, "Report migration status"), |
268 |
("instance_start", SINGLE, None, TMO_NORMAL, [ |
|
265 |
("instance_start", SINGLE, None, constants.RPC_TMO_NORMAL, [
|
|
269 | 266 |
("instance_hvp_bep", ED_INST_DICT_HVP_BEP, None), |
270 | 267 |
("startup_paused", None, None), |
271 | 268 |
], None, None, "Starts an instance"), |
272 |
("instance_os_add", SINGLE, None, TMO_1DAY, [ |
|
269 |
("instance_os_add", SINGLE, None, constants.RPC_TMO_1DAY, [
|
|
273 | 270 |
("instance_osp", ED_INST_DICT_OSP_DP, None), |
274 | 271 |
("reinstall", None, None), |
275 | 272 |
("debug", None, None), |
... | ... | |
277 | 274 |
] |
278 | 275 |
|
279 | 276 |
_IMPEXP_CALLS = [ |
280 |
("import_start", SINGLE, None, TMO_NORMAL, [ |
|
277 |
("import_start", SINGLE, None, constants.RPC_TMO_NORMAL, [
|
|
281 | 278 |
("opts", ED_OBJECT_DICT, None), |
282 | 279 |
("instance", ED_INST_DICT, None), |
283 | 280 |
("component", None, None), |
284 | 281 |
("dest", ED_IMPEXP_IO, "Import destination"), |
285 | 282 |
], None, None, "Starts an import daemon"), |
286 |
("export_start", SINGLE, None, TMO_NORMAL, [ |
|
283 |
("export_start", SINGLE, None, constants.RPC_TMO_NORMAL, [
|
|
287 | 284 |
("opts", ED_OBJECT_DICT, None), |
288 | 285 |
("host", None, None), |
289 | 286 |
("port", None, None), |
... | ... | |
291 | 288 |
("component", None, None), |
292 | 289 |
("source", ED_IMPEXP_IO, "Export source"), |
293 | 290 |
], None, None, "Starts an export daemon"), |
294 |
("impexp_status", SINGLE, None, TMO_FAST, [ |
|
291 |
("impexp_status", SINGLE, None, constants.RPC_TMO_FAST, [
|
|
295 | 292 |
("names", None, "Import/export names"), |
296 | 293 |
], None, _ImpExpStatusPostProc, "Gets the status of an import or export"), |
297 |
("impexp_abort", SINGLE, None, TMO_NORMAL, [ |
|
294 |
("impexp_abort", SINGLE, None, constants.RPC_TMO_NORMAL, [
|
|
298 | 295 |
("name", None, "Import/export name"), |
299 | 296 |
], None, None, "Aborts an import or export"), |
300 |
("impexp_cleanup", SINGLE, None, TMO_NORMAL, [ |
|
297 |
("impexp_cleanup", SINGLE, None, constants.RPC_TMO_NORMAL, [
|
|
301 | 298 |
("name", None, "Import/export name"), |
302 | 299 |
], None, None, "Cleans up after an import or export"), |
303 |
("export_info", SINGLE, None, TMO_FAST, [ |
|
300 |
("export_info", SINGLE, None, constants.RPC_TMO_FAST, [
|
|
304 | 301 |
("path", None, None), |
305 | 302 |
], None, None, "Queries the export information in a given path"), |
306 |
("finalize_export", SINGLE, None, TMO_NORMAL, [ |
|
303 |
("finalize_export", SINGLE, None, constants.RPC_TMO_NORMAL, [
|
|
307 | 304 |
("instance", ED_INST_DICT, None), |
308 | 305 |
("snap_disks", ED_FINALIZE_EXPORT_DISKS, None), |
309 | 306 |
], None, None, "Request the completion of an export operation"), |
310 |
("export_list", MULTI, None, TMO_FAST, [], None, None, |
|
307 |
("export_list", MULTI, None, constants.RPC_TMO_FAST, [], None, None,
|
|
311 | 308 |
"Gets the stored exports list"), |
312 |
("export_remove", SINGLE, None, TMO_FAST, [ |
|
309 |
("export_remove", SINGLE, None, constants.RPC_TMO_FAST, [
|
|
313 | 310 |
("export", None, None), |
314 | 311 |
], None, None, "Requests removal of a given export"), |
315 | 312 |
] |
316 | 313 |
|
317 | 314 |
_X509_CALLS = [ |
318 |
("x509_cert_create", SINGLE, None, TMO_NORMAL, [ |
|
315 |
("x509_cert_create", SINGLE, None, constants.RPC_TMO_NORMAL, [
|
|
319 | 316 |
("validity", None, "Validity in seconds"), |
320 | 317 |
], None, None, "Creates a new X509 certificate for SSL/TLS"), |
321 |
("x509_cert_remove", SINGLE, None, TMO_NORMAL, [ |
|
318 |
("x509_cert_remove", SINGLE, None, constants.RPC_TMO_NORMAL, [
|
|
322 | 319 |
("name", None, "Certificate name"), |
323 | 320 |
], None, None, "Removes a X509 certificate"), |
324 | 321 |
] |
325 | 322 |
|
326 | 323 |
_BLOCKDEV_CALLS = [ |
327 |
("bdev_sizes", MULTI, None, TMO_URGENT, [ |
|
324 |
("bdev_sizes", MULTI, None, constants.RPC_TMO_URGENT, [
|
|
328 | 325 |
("devices", None, None), |
329 | 326 |
], None, None, |
330 | 327 |
"Gets the sizes of requested block devices present on a node"), |
331 |
("blockdev_create", SINGLE, None, TMO_NORMAL, [ |
|
328 |
("blockdev_create", SINGLE, None, constants.RPC_TMO_NORMAL, [
|
|
332 | 329 |
("bdev", ED_OBJECT_DICT, None), |
333 | 330 |
("size", None, None), |
334 | 331 |
("owner", None, None), |
335 | 332 |
("on_primary", None, None), |
336 | 333 |
("info", None, None), |
337 | 334 |
], None, None, "Request creation of a given block device"), |
338 |
("blockdev_wipe", SINGLE, None, TMO_SLOW, [ |
|
335 |
("blockdev_wipe", SINGLE, None, constants.RPC_TMO_SLOW, [
|
|
339 | 336 |
("bdev", ED_SINGLE_DISK_DICT_DP, None), |
340 | 337 |
("offset", None, None), |
341 | 338 |
("size", None, None), |
342 | 339 |
], None, None, |
343 | 340 |
"Request wipe at given offset with given size of a block device"), |
344 |
("blockdev_remove", SINGLE, None, TMO_NORMAL, [ |
|
341 |
("blockdev_remove", SINGLE, None, constants.RPC_TMO_NORMAL, [
|
|
345 | 342 |
("bdev", ED_OBJECT_DICT, None), |
346 | 343 |
], None, None, "Request removal of a given block device"), |
347 |
("blockdev_pause_resume_sync", SINGLE, None, TMO_NORMAL, [ |
|
344 |
("blockdev_pause_resume_sync", SINGLE, None, constants.RPC_TMO_NORMAL, [
|
|
348 | 345 |
("disks", ED_DISKS_DICT_DP, None), |
349 | 346 |
("pause", None, None), |
350 | 347 |
], None, None, "Request a pause/resume of given block device"), |
351 |
("blockdev_assemble", SINGLE, None, TMO_NORMAL, [ |
|
348 |
("blockdev_assemble", SINGLE, None, constants.RPC_TMO_NORMAL, [
|
|
352 | 349 |
("disk", ED_SINGLE_DISK_DICT_DP, None), |
353 | 350 |
("owner", None, None), |
354 | 351 |
("on_primary", None, None), |
355 | 352 |
("idx", None, None), |
356 | 353 |
], None, None, "Request assembling of a given block device"), |
357 |
("blockdev_shutdown", SINGLE, None, TMO_NORMAL, [ |
|
354 |
("blockdev_shutdown", SINGLE, None, constants.RPC_TMO_NORMAL, [
|
|
358 | 355 |
("disk", ED_SINGLE_DISK_DICT_DP, None), |
359 | 356 |
], None, None, "Request shutdown of a given block device"), |
360 |
("blockdev_addchildren", SINGLE, None, TMO_NORMAL, [ |
|
357 |
("blockdev_addchildren", SINGLE, None, constants.RPC_TMO_NORMAL, [
|
|
361 | 358 |
("bdev", ED_SINGLE_DISK_DICT_DP, None), |
362 | 359 |
("ndevs", ED_OBJECT_DICT_LIST, None), |
363 | 360 |
], None, None, |
364 | 361 |
"Request adding a list of children to a (mirroring) device"), |
365 |
("blockdev_removechildren", SINGLE, None, TMO_NORMAL, [ |
|
362 |
("blockdev_removechildren", SINGLE, None, constants.RPC_TMO_NORMAL, [
|
|
366 | 363 |
("bdev", ED_OBJECT_DICT, None), |
367 | 364 |
("ndevs", ED_OBJECT_DICT_LIST, None), |
368 | 365 |
], None, None, |
369 | 366 |
"Request removing a list of children from a (mirroring) device"), |
370 |
("blockdev_close", SINGLE, None, TMO_NORMAL, [ |
|
367 |
("blockdev_close", SINGLE, None, constants.RPC_TMO_NORMAL, [
|
|
371 | 368 |
("instance_name", None, None), |
372 | 369 |
("disks", ED_OBJECT_DICT_LIST, None), |
373 | 370 |
], None, None, "Closes the given block devices"), |
374 |
("blockdev_getsize", SINGLE, None, TMO_NORMAL, [ |
|
371 |
("blockdev_getsize", SINGLE, None, constants.RPC_TMO_NORMAL, [
|
|
375 | 372 |
("disks", ED_OBJECT_DICT_LIST, None), |
376 | 373 |
], None, None, "Returns the size of the given disks"), |
377 |
("drbd_disconnect_net", MULTI, None, TMO_NORMAL, [ |
|
374 |
("drbd_disconnect_net", MULTI, None, constants.RPC_TMO_NORMAL, [
|
|
378 | 375 |
("nodes_ip", None, None), |
379 | 376 |
("disks", ED_OBJECT_DICT_LIST, None), |
380 | 377 |
], None, None, "Disconnects the network of the given drbd devices"), |
381 |
("drbd_attach_net", MULTI, None, TMO_NORMAL, [ |
|
378 |
("drbd_attach_net", MULTI, None, constants.RPC_TMO_NORMAL, [
|
|
382 | 379 |
("nodes_ip", None, None), |
383 | 380 |
("disks", ED_DISKS_DICT_DP, None), |
384 | 381 |
("instance_name", None, None), |
385 | 382 |
("multimaster", None, None), |
386 | 383 |
], None, None, "Connects the given DRBD devices"), |
387 |
("drbd_wait_sync", MULTI, None, TMO_SLOW, [ |
|
384 |
("drbd_wait_sync", MULTI, None, constants.RPC_TMO_SLOW, [
|
|
388 | 385 |
("nodes_ip", None, None), |
389 | 386 |
("disks", ED_DISKS_DICT_DP, None), |
390 | 387 |
], None, None, |
391 | 388 |
"Waits for the synchronization of drbd devices is complete"), |
392 |
("blockdev_grow", SINGLE, None, TMO_NORMAL, [ |
|
389 |
("blockdev_grow", SINGLE, None, constants.RPC_TMO_NORMAL, [
|
|
393 | 390 |
("cf_bdev", ED_SINGLE_DISK_DICT_DP, None), |
394 | 391 |
("amount", None, None), |
395 | 392 |
("dryrun", None, None), |
396 | 393 |
("backingstore", None, None), |
397 | 394 |
], None, None, "Request growing of the given block device by a" |
398 | 395 |
" given amount"), |
399 |
("blockdev_export", SINGLE, None, TMO_1DAY, [ |
|
396 |
("blockdev_export", SINGLE, None, constants.RPC_TMO_1DAY, [
|
|
400 | 397 |
("cf_bdev", ED_SINGLE_DISK_DICT_DP, None), |
401 | 398 |
("dest_node", None, None), |
402 | 399 |
("dest_path", None, None), |
403 | 400 |
("cluster_name", None, None), |
404 | 401 |
], None, None, "Export a given disk to another node"), |
405 |
("blockdev_snapshot", SINGLE, None, TMO_NORMAL, [ |
|
402 |
("blockdev_snapshot", SINGLE, None, constants.RPC_TMO_NORMAL, [
|
|
406 | 403 |
("cf_bdev", ED_SINGLE_DISK_DICT_DP, None), |
407 | 404 |
], None, None, "Export a given disk to another node"), |
408 |
("blockdev_rename", SINGLE, None, TMO_NORMAL, [ |
|
405 |
("blockdev_rename", SINGLE, None, constants.RPC_TMO_NORMAL, [
|
|
409 | 406 |
("devlist", ED_BLOCKDEV_RENAME, None), |
410 | 407 |
], None, None, "Request rename of the given block devices"), |
411 |
("blockdev_find", SINGLE, None, TMO_NORMAL, [ |
|
408 |
("blockdev_find", SINGLE, None, constants.RPC_TMO_NORMAL, [
|
|
412 | 409 |
("disk", ED_OBJECT_DICT, None), |
413 | 410 |
], None, _BlockdevFindPostProc, |
414 | 411 |
"Request identification of a given block device"), |
415 |
("blockdev_getmirrorstatus", SINGLE, None, TMO_NORMAL, [ |
|
412 |
("blockdev_getmirrorstatus", SINGLE, None, constants.RPC_TMO_NORMAL, [
|
|
416 | 413 |
("disks", ED_DISKS_DICT_DP, None), |
417 | 414 |
], None, _BlockdevGetMirrorStatusPostProc, |
418 | 415 |
"Request status of a (mirroring) device"), |
419 |
("blockdev_getmirrorstatus_multi", MULTI, None, TMO_NORMAL, [ |
|
416 |
("blockdev_getmirrorstatus_multi", MULTI, None, constants.RPC_TMO_NORMAL, [
|
|
420 | 417 |
("node_disks", ED_NODE_TO_DISK_DICT, None), |
421 | 418 |
], _BlockdevGetMirrorStatusMultiPreProc, |
422 | 419 |
_BlockdevGetMirrorStatusMultiPostProc, |
... | ... | |
424 | 421 |
] |
425 | 422 |
|
426 | 423 |
_OS_CALLS = [ |
427 |
("os_diagnose", MULTI, None, TMO_FAST, [], None, None, |
|
424 |
("os_diagnose", MULTI, None, constants.RPC_TMO_FAST, [], None, None,
|
|
428 | 425 |
"Request a diagnose of OS definitions"), |
429 |
("os_validate", MULTI, None, TMO_FAST, [ |
|
426 |
("os_validate", MULTI, None, constants.RPC_TMO_FAST, [
|
|
430 | 427 |
("required", None, None), |
431 | 428 |
("name", None, None), |
432 | 429 |
("checks", None, None), |
433 | 430 |
("params", None, None), |
434 | 431 |
], None, None, "Run a validation routine for a given OS"), |
435 |
("os_get", SINGLE, None, TMO_FAST, [ |
|
432 |
("os_get", SINGLE, None, constants.RPC_TMO_FAST, [
|
|
436 | 433 |
("name", None, None), |
437 | 434 |
], None, _OsGetPostProc, "Returns an OS definition"), |
438 | 435 |
] |
439 | 436 |
|
440 | 437 |
_NODE_CALLS = [ |
441 |
("node_has_ip_address", SINGLE, None, TMO_FAST, [ |
|
438 |
("node_has_ip_address", SINGLE, None, constants.RPC_TMO_FAST, [
|
|
442 | 439 |
("address", None, "IP address"), |
443 | 440 |
], None, None, "Checks if a node has the given IP address"), |
444 |
("node_info", MULTI, None, TMO_URGENT, [ |
|
441 |
("node_info", MULTI, None, constants.RPC_TMO_URGENT, [
|
|
445 | 442 |
("vg_names", None, |
446 | 443 |
"Names of the volume groups to ask for disk space information"), |
447 | 444 |
("hv_names", None, |
448 | 445 |
"Names of the hypervisors to ask for node information"), |
449 | 446 |
], None, None, "Return node information"), |
450 |
("node_verify", MULTI, None, TMO_NORMAL, [ |
|
447 |
("node_verify", MULTI, None, constants.RPC_TMO_NORMAL, [
|
|
451 | 448 |
("checkdict", None, None), |
452 | 449 |
("cluster_name", None, None), |
453 | 450 |
], None, None, "Request verification of given parameters"), |
454 |
("node_volumes", MULTI, None, TMO_FAST, [], None, None, |
|
451 |
("node_volumes", MULTI, None, constants.RPC_TMO_FAST, [], None, None,
|
|
455 | 452 |
"Gets all volumes on node(s)"), |
456 |
("node_demote_from_mc", SINGLE, None, TMO_FAST, [], None, None, |
|
453 |
("node_demote_from_mc", SINGLE, None, constants.RPC_TMO_FAST, [], None, None,
|
|
457 | 454 |
"Demote a node from the master candidate role"), |
458 |
("node_powercycle", SINGLE, ACCEPT_OFFLINE_NODE, TMO_NORMAL, [ |
|
455 |
("node_powercycle", SINGLE, ACCEPT_OFFLINE_NODE, constants.RPC_TMO_NORMAL, [
|
|
459 | 456 |
("hypervisor", None, "Hypervisor type"), |
460 | 457 |
], None, None, "Tries to powercycle a node"), |
461 | 458 |
] |
462 | 459 |
|
463 | 460 |
_MISC_CALLS = [ |
464 |
("lv_list", MULTI, None, TMO_URGENT, [ |
|
461 |
("lv_list", MULTI, None, constants.RPC_TMO_URGENT, [
|
|
465 | 462 |
("vg_name", None, None), |
466 | 463 |
], None, None, "Gets the logical volumes present in a given volume group"), |
467 |
("vg_list", MULTI, None, TMO_URGENT, [], None, None, |
|
464 |
("vg_list", MULTI, None, constants.RPC_TMO_URGENT, [], None, None,
|
|
468 | 465 |
"Gets the volume group list"), |
469 |
("bridges_exist", SINGLE, None, TMO_URGENT, [ |
|
466 |
("bridges_exist", SINGLE, None, constants.RPC_TMO_URGENT, [
|
|
470 | 467 |
("bridges_list", None, "Bridges which must be present on remote node"), |
471 | 468 |
], None, None, "Checks if a node has all the bridges given"), |
472 |
("etc_hosts_modify", SINGLE, None, TMO_NORMAL, [ |
|
469 |
("etc_hosts_modify", SINGLE, None, constants.RPC_TMO_NORMAL, [
|
|
473 | 470 |
("mode", None, |
474 | 471 |
"Mode to operate; currently L{constants.ETC_HOSTS_ADD} or" |
475 | 472 |
" L{constants.ETC_HOSTS_REMOVE}"), |
476 | 473 |
("name", None, "Hostname to be modified"), |
477 | 474 |
("ip", None, "IP address (L{constants.ETC_HOSTS_ADD} only)"), |
478 | 475 |
], None, None, "Modify hosts file with name"), |
479 |
("drbd_helper", MULTI, None, TMO_URGENT, [], None, None, "Gets DRBD helper"), |
|
480 |
("run_oob", SINGLE, None, TMO_NORMAL, [ |
|
476 |
("drbd_helper", MULTI, None, constants.RPC_TMO_URGENT, [], |
|
477 |
None, None, "Gets DRBD helper"), |
|
478 |
("run_oob", SINGLE, None, constants.RPC_TMO_NORMAL, [ |
|
481 | 479 |
("oob_program", None, None), |
482 | 480 |
("command", None, None), |
483 | 481 |
("remote_node", None, None), |
484 | 482 |
("timeout", None, None), |
485 | 483 |
], None, None, "Runs out-of-band command"), |
486 |
("hooks_runner", MULTI, None, TMO_NORMAL, [ |
|
484 |
("hooks_runner", MULTI, None, constants.RPC_TMO_NORMAL, [
|
|
487 | 485 |
("hpath", None, None), |
488 | 486 |
("phase", None, None), |
489 | 487 |
("env", None, None), |
490 | 488 |
], None, None, "Call the hooks runner"), |
491 |
("iallocator_runner", SINGLE, None, TMO_NORMAL, [ |
|
489 |
("iallocator_runner", SINGLE, None, constants.RPC_TMO_NORMAL, [
|
|
492 | 490 |
("name", None, "Iallocator name"), |
493 | 491 |
("idata", None, "JSON-encoded input string"), |
494 | 492 |
], None, None, "Call an iallocator on a remote node"), |
495 | 493 |
("test_delay", MULTI, None, _TestDelayTimeout, [ |
496 | 494 |
("duration", None, None), |
497 | 495 |
], None, None, "Sleep for a fixed time on given node(s)"), |
498 |
("hypervisor_validate_params", MULTI, None, TMO_NORMAL, [ |
|
496 |
("hypervisor_validate_params", MULTI, None, constants.RPC_TMO_NORMAL, [
|
|
499 | 497 |
("hvname", None, "Hypervisor name"), |
500 | 498 |
("hvfull", None, "Parameters to be validated"), |
501 | 499 |
], None, None, "Validate hypervisor params"), |
... | ... | |
507 | 505 |
_FILE_STORAGE_CALLS + _MISC_CALLS + _INSTANCE_CALLS + |
508 | 506 |
_BLOCKDEV_CALLS + _STORAGE_CALLS), |
509 | 507 |
"RpcClientJobQueue": _Prepare([ |
510 |
("jobqueue_update", MULTI, None, TMO_URGENT, [ |
|
508 |
("jobqueue_update", MULTI, None, constants.RPC_TMO_URGENT, [
|
|
511 | 509 |
("file_name", None, None), |
512 | 510 |
("content", ED_COMPRESS, None), |
513 | 511 |
], None, None, "Update job queue file"), |
514 |
("jobqueue_purge", SINGLE, None, TMO_NORMAL, [], None, None, |
|
512 |
("jobqueue_purge", SINGLE, None, constants.RPC_TMO_NORMAL, [], None, None,
|
|
515 | 513 |
"Purge job queue"), |
516 |
("jobqueue_rename", MULTI, None, TMO_URGENT, [ |
|
514 |
("jobqueue_rename", MULTI, None, constants.RPC_TMO_URGENT, [
|
|
517 | 515 |
("rename", None, None), |
518 | 516 |
], None, None, "Rename job queue file"), |
519 | 517 |
]), |
520 | 518 |
"RpcClientBootstrap": _Prepare([ |
521 |
("node_start_master_daemons", SINGLE, None, TMO_FAST, [ |
|
519 |
("node_start_master_daemons", SINGLE, None, constants.RPC_TMO_FAST, [
|
|
522 | 520 |
("no_voting", None, None), |
523 | 521 |
], None, None, "Starts master daemons on a node"), |
524 |
("node_activate_master_ip", SINGLE, None, TMO_FAST, [ |
|
522 |
("node_activate_master_ip", SINGLE, None, constants.RPC_TMO_FAST, [
|
|
525 | 523 |
("master_params", ED_OBJECT_DICT, "Network parameters of the master"), |
526 | 524 |
("use_external_mip_script", None, |
527 | 525 |
"Whether to use the user-provided master IP address setup script"), |
528 | 526 |
], None, None, |
529 | 527 |
"Activates master IP on a node"), |
530 |
("node_stop_master", SINGLE, None, TMO_FAST, [], None, None, |
|
528 |
("node_stop_master", SINGLE, None, constants.RPC_TMO_FAST, [], None, None,
|
|
531 | 529 |
"Deactivates master IP and stops master daemons on a node"), |
532 |
("node_deactivate_master_ip", SINGLE, None, TMO_FAST, [ |
|
530 |
("node_deactivate_master_ip", SINGLE, None, constants.RPC_TMO_FAST, [
|
|
533 | 531 |
("master_params", ED_OBJECT_DICT, "Network parameters of the master"), |
534 | 532 |
("use_external_mip_script", None, |
535 | 533 |
"Whether to use the user-provided master IP address setup script"), |
536 | 534 |
], None, None, |
537 | 535 |
"Deactivates master IP on a node"), |
538 |
("node_change_master_netmask", SINGLE, None, TMO_FAST, [ |
|
536 |
("node_change_master_netmask", SINGLE, None, constants.RPC_TMO_FAST, [
|
|
539 | 537 |
("old_netmask", None, "The old value of the netmask"), |
540 | 538 |
("netmask", None, "The new value of the netmask"), |
541 | 539 |
("master_ip", None, "The master IP"), |
542 | 540 |
("master_netdev", None, "The master network device"), |
543 | 541 |
], None, None, "Change master IP netmask"), |
544 |
("node_leave_cluster", SINGLE, None, TMO_NORMAL, [ |
|
542 |
("node_leave_cluster", SINGLE, None, constants.RPC_TMO_NORMAL, [
|
|
545 | 543 |
("modify_ssh_setup", None, None), |
546 | 544 |
], None, None, |
547 | 545 |
"Requests a node to clean the cluster information it has"), |
548 |
("master_info", MULTI, None, TMO_URGENT, [], None, None, |
|
546 |
("master_info", MULTI, None, constants.RPC_TMO_URGENT, [], None, None,
|
|
549 | 547 |
"Query master info"), |
550 | 548 |
]), |
551 | 549 |
"RpcClientDnsOnly": _Prepare([ |
552 |
("version", MULTI, ACCEPT_OFFLINE_NODE, TMO_URGENT, [], None, None,
|
|
553 |
"Query node version"), |
|
550 |
("version", MULTI, ACCEPT_OFFLINE_NODE, constants.RPC_TMO_URGENT, [], None,
|
|
551 |
None, "Query node version"),
|
|
554 | 552 |
]), |
555 | 553 |
"RpcClientConfig": _Prepare([ |
556 |
("upload_file", MULTI, None, TMO_NORMAL, [ |
|
554 |
("upload_file", MULTI, None, constants.RPC_TMO_NORMAL, [
|
|
557 | 555 |
("file_name", ED_FILE_DETAILS, None), |
558 | 556 |
], None, None, "Upload a file"), |
559 |
("write_ssconf_files", MULTI, None, TMO_NORMAL, [ |
|
557 |
("write_ssconf_files", MULTI, None, constants.RPC_TMO_NORMAL, [
|
|
560 | 558 |
("values", None, None), |
561 | 559 |
], None, None, "Write ssconf files"), |
562 | 560 |
]), |
Also available in: Unified diff