Revision cd40dc53
b/autotools/build-rpc | ||
---|---|---|
96 | 96 |
sw.Write("\"\"\"") |
97 | 97 |
|
98 | 98 |
|
99 |
def _MakeArgument((argname, wrapper, _)): |
|
100 |
"""Format argument for function call. |
|
101 |
|
|
102 |
""" |
|
103 |
if wrapper: |
|
104 |
return wrapper % argname |
|
105 |
else: |
|
106 |
return argname |
|
107 |
|
|
108 |
|
|
109 | 99 |
def _WriteBaseClass(sw, clsname, calls): |
110 | 100 |
"""Write RPC wrapper class. |
111 | 101 |
|
... | ... | |
158 | 148 |
buf.write("[node]") |
159 | 149 |
else: |
160 | 150 |
buf.write("node_list") |
161 |
buf.write(", \"%s\", read_timeout, [%s])" % |
|
162 |
(name, utils.CommaJoin(map(_MakeArgument, args)))) |
|
151 |
|
|
152 |
buf.write(", \"%s\", read_timeout, [%s], [%s])" % |
|
153 |
(name, |
|
154 |
# Argument definitions |
|
155 |
utils.CommaJoin(map(compat.snd, args)), |
|
156 |
# Function arguments |
|
157 |
utils.CommaJoin(map(compat.fst, args)))) |
|
158 |
|
|
163 | 159 |
if kind == _SINGLE: |
164 | 160 |
buf.write("[node]") |
165 | 161 |
if postproc: |
b/lib/rpc.py | ||
---|---|---|
47 | 47 |
from ganeti import ssconf |
48 | 48 |
from ganeti import runtime |
49 | 49 |
from ganeti import compat |
50 |
from ganeti import rpc_defs |
|
50 | 51 |
|
51 | 52 |
# Special module generated at build time |
52 | 53 |
from ganeti import _generated_rpc |
... | ... | |
409 | 410 |
return self._CombineResults(results, requests, procedure) |
410 | 411 |
|
411 | 412 |
|
412 |
class RpcRunner(_generated_rpc.RpcClientDefault, |
|
413 |
class _RpcClientBase: |
|
414 |
def __init__(self, resolver, encoder_fn, lock_monitor_cb=None): |
|
415 |
"""Initializes this class. |
|
416 |
|
|
417 |
""" |
|
418 |
self._proc = _RpcProcessor(resolver, |
|
419 |
netutils.GetDaemonPort(constants.NODED), |
|
420 |
lock_monitor_cb=lock_monitor_cb) |
|
421 |
self._encoder = compat.partial(self._EncodeArg, encoder_fn) |
|
422 |
|
|
423 |
@staticmethod |
|
424 |
def _EncodeArg(encoder_fn, (argkind, value)): |
|
425 |
"""Encode argument. |
|
426 |
|
|
427 |
""" |
|
428 |
if argkind is None: |
|
429 |
return value |
|
430 |
else: |
|
431 |
return encoder_fn(argkind)(value) |
|
432 |
|
|
433 |
def _Call(self, node_list, procedure, timeout, argdefs, args): |
|
434 |
"""Entry point for automatically generated RPC wrappers. |
|
435 |
|
|
436 |
""" |
|
437 |
assert len(args) == len(argdefs), "Wrong number of arguments" |
|
438 |
|
|
439 |
body = serializer.DumpJson(map(self._encoder, zip(argdefs, args)), |
|
440 |
indent=False) |
|
441 |
|
|
442 |
return self._proc(node_list, procedure, body, read_timeout=timeout) |
|
443 |
|
|
444 |
|
|
445 |
def _ObjectToDict(value): |
|
446 |
"""Converts an object to a dictionary. |
|
447 |
|
|
448 |
@note: See L{objects}. |
|
449 |
|
|
450 |
""" |
|
451 |
return value.ToDict() |
|
452 |
|
|
453 |
|
|
454 |
def _ObjectListToDict(value): |
|
455 |
"""Converts a list of L{objects} to dictionaries. |
|
456 |
|
|
457 |
""" |
|
458 |
return map(_ObjectToDict, value) |
|
459 |
|
|
460 |
|
|
461 |
def _EncodeNodeToDiskDict(value): |
|
462 |
"""Encodes a dictionary with node name as key and disk objects as values. |
|
463 |
|
|
464 |
""" |
|
465 |
return dict((name, _ObjectListToDict(disks)) |
|
466 |
for name, disks in value.items()) |
|
467 |
|
|
468 |
|
|
469 |
def _PrepareFileUpload(filename): |
|
470 |
"""Loads a file and prepares it for an upload to nodes. |
|
471 |
|
|
472 |
""" |
|
473 |
data = _Compress(utils.ReadFile(filename)) |
|
474 |
st = os.stat(filename) |
|
475 |
getents = runtime.GetEnts() |
|
476 |
return [filename, data, st.st_mode, getents.LookupUid(st.st_uid), |
|
477 |
getents.LookupGid(st.st_gid), st.st_atime, st.st_mtime] |
|
478 |
|
|
479 |
|
|
480 |
def _PrepareFinalizeExportDisks(snap_disks): |
|
481 |
"""Encodes disks for finalizing export. |
|
482 |
|
|
483 |
""" |
|
484 |
flat_disks = [] |
|
485 |
|
|
486 |
for disk in snap_disks: |
|
487 |
if isinstance(disk, bool): |
|
488 |
flat_disks.append(disk) |
|
489 |
else: |
|
490 |
flat_disks.append(disk.ToDict()) |
|
491 |
|
|
492 |
return flat_disks |
|
493 |
|
|
494 |
|
|
495 |
def _EncodeImportExportIO((ieio, ieioargs)): |
|
496 |
"""Encodes import/export I/O information. |
|
497 |
|
|
498 |
""" |
|
499 |
if ieio == constants.IEIO_RAW_DISK: |
|
500 |
assert len(ieioargs) == 1 |
|
501 |
return (ieio, (ieioargs[0].ToDict(), )) |
|
502 |
|
|
503 |
if ieio == constants.IEIO_SCRIPT: |
|
504 |
assert len(ieioargs) == 2 |
|
505 |
return (ieio, (ieioargs[0].ToDict(), ieioargs[1])) |
|
506 |
|
|
507 |
return (ieio, ieioargs) |
|
508 |
|
|
509 |
|
|
510 |
def _EncodeBlockdevRename(value): |
|
511 |
"""Encodes information for renaming block devices. |
|
512 |
|
|
513 |
""" |
|
514 |
return [(d.ToDict(), uid) for d, uid in value] |
|
515 |
|
|
516 |
|
|
517 |
#: Generic encoders |
|
518 |
_ENCODERS = { |
|
519 |
rpc_defs.ED_OBJECT_DICT: _ObjectToDict, |
|
520 |
rpc_defs.ED_OBJECT_DICT_LIST: _ObjectListToDict, |
|
521 |
rpc_defs.ED_NODE_TO_DISK_DICT: _EncodeNodeToDiskDict, |
|
522 |
rpc_defs.ED_FILE_DETAILS: _PrepareFileUpload, |
|
523 |
rpc_defs.ED_COMPRESS: _Compress, |
|
524 |
rpc_defs.ED_FINALIZE_EXPORT_DISKS: _PrepareFinalizeExportDisks, |
|
525 |
rpc_defs.ED_IMPEXP_IO: _EncodeImportExportIO, |
|
526 |
rpc_defs.ED_BLOCKDEV_RENAME: _EncodeBlockdevRename, |
|
527 |
} |
|
528 |
|
|
529 |
|
|
530 |
class RpcRunner(_RpcClientBase, |
|
531 |
_generated_rpc.RpcClientDefault, |
|
413 | 532 |
_generated_rpc.RpcClientBootstrap, |
414 | 533 |
_generated_rpc.RpcClientConfig): |
415 | 534 |
"""RPC runner class. |
... | ... | |
422 | 541 |
@param context: Ganeti context |
423 | 542 |
|
424 | 543 |
""" |
544 |
self._cfg = context.cfg |
|
545 |
|
|
546 |
encoders = _ENCODERS.copy() |
|
547 |
|
|
548 |
# Add encoders requiring configuration object |
|
549 |
encoders.update({ |
|
550 |
rpc_defs.ED_INST_DICT: self._InstDict, |
|
551 |
rpc_defs.ED_INST_DICT_HVP_BEP: self._InstDictHvpBep, |
|
552 |
rpc_defs.ED_INST_DICT_OSP: self._InstDictOsp, |
|
553 |
}) |
|
554 |
|
|
555 |
# Resolver using configuration |
|
556 |
resolver = compat.partial(_NodeConfigResolver, self._cfg.GetNodeInfo, |
|
557 |
self._cfg.GetAllNodesInfo) |
|
558 |
|
|
425 | 559 |
# Pylint doesn't recognize multiple inheritance properly, see |
426 | 560 |
# <http://www.logilab.org/ticket/36586> and |
427 | 561 |
# <http://www.logilab.org/ticket/35642> |
428 | 562 |
# pylint: disable=W0233 |
563 |
_RpcClientBase.__init__(self, resolver, encoders.get, |
|
564 |
lock_monitor_cb=context.glm.AddToLockMonitor) |
|
429 | 565 |
_generated_rpc.RpcClientConfig.__init__(self) |
430 | 566 |
_generated_rpc.RpcClientBootstrap.__init__(self) |
431 | 567 |
_generated_rpc.RpcClientDefault.__init__(self) |
432 | 568 |
|
433 |
self._cfg = context.cfg |
|
434 |
self._proc = _RpcProcessor(compat.partial(_NodeConfigResolver, |
|
435 |
self._cfg.GetNodeInfo, |
|
436 |
self._cfg.GetAllNodesInfo), |
|
437 |
netutils.GetDaemonPort(constants.NODED), |
|
438 |
lock_monitor_cb=context.glm.AddToLockMonitor) |
|
439 |
|
|
440 | 569 |
def _InstDict(self, instance, hvp=None, bep=None, osp=None): |
441 | 570 |
"""Convert the given instance to a dict. |
442 | 571 |
|
... | ... | |
485 | 614 |
""" |
486 | 615 |
return self._InstDict(instance, osp=osparams) |
487 | 616 |
|
488 |
def _Call(self, node_list, procedure, timeout, args): |
|
489 |
"""Entry point for automatically generated RPC wrappers. |
|
490 |
|
|
491 |
""" |
|
492 |
body = serializer.DumpJson(args, indent=False) |
|
493 |
|
|
494 |
return self._proc(node_list, procedure, body, read_timeout=timeout) |
|
495 |
|
|
496 | 617 |
@staticmethod |
497 | 618 |
def _MigrationStatusPostProc(result): |
498 | 619 |
if not result.fail_msg and result.payload is not None: |
... | ... | |
531 | 652 |
return result |
532 | 653 |
|
533 | 654 |
@staticmethod |
534 |
def _PrepareFinalizeExportDisks(snap_disks): |
|
535 |
flat_disks = [] |
|
536 |
|
|
537 |
for disk in snap_disks: |
|
538 |
if isinstance(disk, bool): |
|
539 |
flat_disks.append(disk) |
|
540 |
else: |
|
541 |
flat_disks.append(disk.ToDict()) |
|
542 |
|
|
543 |
return flat_disks |
|
544 |
|
|
545 |
@staticmethod |
|
546 | 655 |
def _ImpExpStatusPostProc(result): |
547 | 656 |
"""Post-processor for import/export status. |
548 | 657 |
|
... | ... | |
564 | 673 |
|
565 | 674 |
return result |
566 | 675 |
|
567 |
@staticmethod |
|
568 |
def _EncodeImportExportIO((ieio, ieioargs)): |
|
569 |
"""Encodes import/export I/O information. |
|
570 |
|
|
571 |
""" |
|
572 |
if ieio == constants.IEIO_RAW_DISK: |
|
573 |
assert len(ieioargs) == 1 |
|
574 |
return (ieio, (ieioargs[0].ToDict(), )) |
|
575 |
|
|
576 |
if ieio == constants.IEIO_SCRIPT: |
|
577 |
assert len(ieioargs) == 2 |
|
578 |
return (ieio, (ieioargs[0].ToDict(), ieioargs[1])) |
|
579 |
|
|
580 |
return (ieio, ieioargs) |
|
581 |
|
|
582 |
@staticmethod |
|
583 |
def _PrepareFileUpload(filename): |
|
584 |
"""Loads a file and prepares it for an upload to nodes. |
|
585 |
|
|
586 |
""" |
|
587 |
data = _Compress(utils.ReadFile(filename)) |
|
588 |
st = os.stat(filename) |
|
589 |
getents = runtime.GetEnts() |
|
590 |
return [filename, data, st.st_mode, getents.LookupUid(st.st_uid), |
|
591 |
getents.LookupGid(st.st_gid), st.st_atime, st.st_mtime] |
|
592 |
|
|
593 | 676 |
# |
594 | 677 |
# Begin RPC calls |
595 | 678 |
# |
... | ... | |
605 | 688 |
read_timeout=int(duration + 5)) |
606 | 689 |
|
607 | 690 |
|
608 |
class JobQueueRunner(_generated_rpc.RpcClientJobQueue): |
|
691 |
class JobQueueRunner(_RpcClientBase, _generated_rpc.RpcClientJobQueue):
|
|
609 | 692 |
"""RPC wrappers for job queue. |
610 | 693 |
|
611 | 694 |
""" |
612 |
_Compress = staticmethod(_Compress) |
|
613 |
|
|
614 | 695 |
def __init__(self, context, address_list): |
615 | 696 |
"""Initializes this class. |
616 | 697 |
|
617 | 698 |
""" |
618 |
_generated_rpc.RpcClientJobQueue.__init__(self) |
|
619 |
|
|
620 | 699 |
if address_list is None: |
621 | 700 |
resolver = _SsconfResolver |
622 | 701 |
else: |
623 | 702 |
# Caller provided an address list |
624 | 703 |
resolver = _StaticResolver(address_list) |
625 | 704 |
|
626 |
self._proc = _RpcProcessor(resolver, |
|
627 |
netutils.GetDaemonPort(constants.NODED), |
|
628 |
lock_monitor_cb=context.glm.AddToLockMonitor) |
|
629 |
|
|
630 |
def _Call(self, node_list, procedure, timeout, args): |
|
631 |
"""Entry point for automatically generated RPC wrappers. |
|
632 |
|
|
633 |
""" |
|
634 |
body = serializer.DumpJson(args, indent=False) |
|
635 |
|
|
636 |
return self._proc(node_list, procedure, body, read_timeout=timeout) |
|
705 |
_RpcClientBase.__init__(self, resolver, _ENCODERS.get, |
|
706 |
lock_monitor_cb=context.glm.AddToLockMonitor) |
|
707 |
_generated_rpc.RpcClientJobQueue.__init__(self) |
|
637 | 708 |
|
638 | 709 |
|
639 |
class BootstrapRunner(_generated_rpc.RpcClientBootstrap): |
|
710 |
class BootstrapRunner(_RpcClientBase, _generated_rpc.RpcClientBootstrap):
|
|
640 | 711 |
"""RPC wrappers for bootstrapping. |
641 | 712 |
|
642 | 713 |
""" |
... | ... | |
644 | 715 |
"""Initializes this class. |
645 | 716 |
|
646 | 717 |
""" |
718 |
_RpcClientBase.__init__(self, _SsconfResolver, _ENCODERS.get) |
|
647 | 719 |
_generated_rpc.RpcClientBootstrap.__init__(self) |
648 | 720 |
|
649 |
self._proc = _RpcProcessor(_SsconfResolver, |
|
650 |
netutils.GetDaemonPort(constants.NODED)) |
|
651 |
|
|
652 |
def _Call(self, node_list, procedure, timeout, args): |
|
653 |
"""Entry point for automatically generated RPC wrappers. |
|
654 |
|
|
655 |
""" |
|
656 |
body = serializer.DumpJson(args, indent=False) |
|
657 |
|
|
658 |
return self._proc(node_list, procedure, body, read_timeout=timeout) |
|
659 |
|
|
660 | 721 |
|
661 |
class ConfigRunner(_generated_rpc.RpcClientConfig): |
|
722 |
class ConfigRunner(_RpcClientBase, _generated_rpc.RpcClientConfig):
|
|
662 | 723 |
"""RPC wrappers for L{config}. |
663 | 724 |
|
664 | 725 |
""" |
665 |
_PrepareFileUpload = \ |
|
666 |
staticmethod(RpcRunner._PrepareFileUpload) # pylint: disable=W0212 |
|
667 |
|
|
668 | 726 |
def __init__(self, address_list): |
669 | 727 |
"""Initializes this class. |
670 | 728 |
|
671 | 729 |
""" |
672 |
_generated_rpc.RpcClientConfig.__init__(self) |
|
673 |
|
|
674 | 730 |
if address_list is None: |
675 | 731 |
resolver = _SsconfResolver |
676 | 732 |
else: |
677 | 733 |
# Caller provided an address list |
678 | 734 |
resolver = _StaticResolver(address_list) |
679 | 735 |
|
680 |
self._proc = _RpcProcessor(resolver, |
|
681 |
netutils.GetDaemonPort(constants.NODED)) |
|
682 |
|
|
683 |
def _Call(self, node_list, procedure, timeout, args): |
|
684 |
"""Entry point for automatically generated RPC wrappers. |
|
685 |
|
|
686 |
""" |
|
687 |
body = serializer.DumpJson(args, indent=False) |
|
688 |
|
|
689 |
return self._proc(node_list, procedure, body, read_timeout=timeout) |
|
736 |
_RpcClientBase.__init__(self, resolver, _ENCODERS.get) |
|
737 |
_generated_rpc.RpcClientConfig.__init__(self) |
b/lib/rpc_defs.py | ||
---|---|---|
28 | 28 |
- List of arguments as tuples |
29 | 29 |
|
30 | 30 |
- Name as string |
31 |
- Wrapper code ("%s" is replaced with argument name, see L{OBJECT_TO_DICT})
|
|
31 |
- Argument kind used for encoding/decoding
|
|
32 | 32 |
- Description for docstring (can be C{None}) |
33 | 33 |
|
34 | 34 |
- Return value wrapper (e.g. for deserializing into L{objects}-based objects) |
... | ... | |
52 | 52 |
SINGLE = "single-node" |
53 | 53 |
MULTI = "multi-node" |
54 | 54 |
|
55 |
OBJECT_TO_DICT = "%s.ToDict()" |
|
56 |
OBJECT_LIST_TO_DICT = "map(lambda d: d.ToDict(), %s)" |
|
57 |
INST_TO_DICT = "self._InstDict(%s)" |
|
58 |
|
|
59 |
NODE_TO_DISK_DICT = \ |
|
60 |
("dict((name, %s) for name, disks in %%s.items())" % |
|
61 |
(OBJECT_LIST_TO_DICT % "disks")) |
|
55 |
# Constants for encoding/decoding |
|
56 |
(ED_OBJECT_DICT, |
|
57 |
ED_OBJECT_DICT_LIST, |
|
58 |
ED_INST_DICT, |
|
59 |
ED_INST_DICT_HVP_BEP, |
|
60 |
ED_NODE_TO_DISK_DICT, |
|
61 |
ED_INST_DICT_OSP, |
|
62 |
ED_IMPEXP_IO, |
|
63 |
ED_FILE_DETAILS, |
|
64 |
ED_FINALIZE_EXPORT_DISKS, |
|
65 |
ED_COMPRESS, |
|
66 |
ED_BLOCKDEV_RENAME) = range(1, 12) |
|
62 | 67 |
|
63 | 68 |
_FILE_STORAGE_CALLS = [ |
64 | 69 |
("file_storage_dir_create", SINGLE, TMO_FAST, [ |
... | ... | |
106 | 111 |
("hypervisor_list", None, "Hypervisors to query for instances"), |
107 | 112 |
], None, "Returns the list of running instances on the given nodes"), |
108 | 113 |
("instance_reboot", SINGLE, TMO_NORMAL, [ |
109 |
("inst", INST_TO_DICT, "Instance object"),
|
|
114 |
("inst", ED_INST_DICT, "Instance object"),
|
|
110 | 115 |
("reboot_type", None, None), |
111 | 116 |
("shutdown_timeout", None, None), |
112 | 117 |
], None, "Returns the list of running instances on the given nodes"), |
113 | 118 |
("instance_shutdown", SINGLE, TMO_NORMAL, [ |
114 |
("instance", INST_TO_DICT, "Instance object"),
|
|
119 |
("instance", ED_INST_DICT, "Instance object"),
|
|
115 | 120 |
("timeout", None, None), |
116 | 121 |
], None, "Stops an instance"), |
117 | 122 |
("instance_run_rename", SINGLE, TMO_SLOW, [ |
118 |
("instance", INST_TO_DICT, "Instance object"),
|
|
123 |
("instance", ED_INST_DICT, "Instance object"),
|
|
119 | 124 |
("old_name", None, None), |
120 | 125 |
("debug", None, None), |
121 | 126 |
], None, "Run the OS rename script for an instance"), |
122 | 127 |
("instance_migratable", SINGLE, TMO_NORMAL, [ |
123 |
("instance", INST_TO_DICT, "Instance object"),
|
|
128 |
("instance", ED_INST_DICT, "Instance object"),
|
|
124 | 129 |
], None, "Checks whether the given instance can be migrated"), |
125 | 130 |
("migration_info", SINGLE, TMO_NORMAL, [ |
126 |
("instance", INST_TO_DICT, "Instance object"),
|
|
131 |
("instance", ED_INST_DICT, "Instance object"),
|
|
127 | 132 |
], None, |
128 | 133 |
"Gather the information necessary to prepare an instance migration"), |
129 | 134 |
("accept_instance", SINGLE, TMO_NORMAL, [ |
130 |
("instance", INST_TO_DICT, "Instance object"),
|
|
135 |
("instance", ED_INST_DICT, "Instance object"),
|
|
131 | 136 |
("info", None, "Result for the call_migration_info call"), |
132 | 137 |
("target", None, "Target hostname (usually an IP address)"), |
133 | 138 |
], None, "Prepare a node to accept an instance"), |
134 | 139 |
("instance_finalize_migration_dst", SINGLE, TMO_NORMAL, [ |
135 |
("instance", INST_TO_DICT, "Instance object"),
|
|
140 |
("instance", ED_INST_DICT, "Instance object"),
|
|
136 | 141 |
("info", None, "Result for the call_migration_info call"), |
137 | 142 |
("success", None, "Whether the migration was a success or failure"), |
138 | 143 |
], None, "Finalize any target-node migration specific operation"), |
139 | 144 |
("instance_migrate", SINGLE, TMO_SLOW, [ |
140 |
("instance", INST_TO_DICT, "Instance object"),
|
|
145 |
("instance", ED_INST_DICT, "Instance object"),
|
|
141 | 146 |
("target", None, "Target node name"), |
142 | 147 |
("live", None, "Whether the migration should be done live or not"), |
143 | 148 |
], None, "Migrate an instance"), |
144 | 149 |
("instance_finalize_migration_src", SINGLE, TMO_SLOW, [ |
145 |
("instance", INST_TO_DICT, "Instance object"),
|
|
150 |
("instance", ED_INST_DICT, "Instance object"),
|
|
146 | 151 |
("success", None, "Whether the migration succeeded or not"), |
147 | 152 |
("live", None, "Whether the user requested a live migration or not"), |
148 | 153 |
], None, "Finalize the instance migration on the source node"), |
149 | 154 |
("instance_get_migration_status", SINGLE, TMO_SLOW, [ |
150 |
("instance", INST_TO_DICT, "Instance object"),
|
|
155 |
("instance", ED_INST_DICT, "Instance object"),
|
|
151 | 156 |
], "self._MigrationStatusPostProc", "Report migration status"), |
152 | 157 |
("instance_start", SINGLE, TMO_NORMAL, [ |
153 |
("instance_hvp_bep", "self._InstDictHvpBep(%s)", None),
|
|
158 |
("instance_hvp_bep", ED_INST_DICT_HVP_BEP, None),
|
|
154 | 159 |
("startup_paused", None, None), |
155 | 160 |
], None, "Starts an instance"), |
156 | 161 |
("instance_os_add", SINGLE, TMO_1DAY, [ |
157 |
("instance_osp", "self._InstDictOsp(%s)", None),
|
|
162 |
("instance_osp", ED_INST_DICT_OSP, None),
|
|
158 | 163 |
("reinstall", None, None), |
159 | 164 |
("debug", None, None), |
160 | 165 |
], None, "Starts an instance"), |
... | ... | |
162 | 167 |
|
163 | 168 |
_IMPEXP_CALLS = [ |
164 | 169 |
("import_start", SINGLE, TMO_NORMAL, [ |
165 |
("opts", OBJECT_TO_DICT, None),
|
|
166 |
("instance", INST_TO_DICT, None),
|
|
170 |
("opts", ED_OBJECT_DICT, None),
|
|
171 |
("instance", ED_INST_DICT, None),
|
|
167 | 172 |
("component", None, None), |
168 |
("dest", "self._EncodeImportExportIO(%s)", "Import destination"),
|
|
173 |
("dest", ED_IMPEXP_IO, "Import destination"),
|
|
169 | 174 |
], None, "Starts an import daemon"), |
170 | 175 |
("export_start", SINGLE, TMO_NORMAL, [ |
171 |
("opts", OBJECT_TO_DICT, None),
|
|
176 |
("opts", ED_OBJECT_DICT, None),
|
|
172 | 177 |
("host", None, None), |
173 | 178 |
("port", None, None), |
174 |
("instance", INST_TO_DICT, None),
|
|
179 |
("instance", ED_INST_DICT, None),
|
|
175 | 180 |
("component", None, None), |
176 |
("source", "self._EncodeImportExportIO(%s)", "Export source"),
|
|
181 |
("source", ED_IMPEXP_IO, "Export source"),
|
|
177 | 182 |
], None, "Starts an export daemon"), |
178 | 183 |
("impexp_status", SINGLE, TMO_FAST, [ |
179 | 184 |
("names", None, "Import/export names"), |
... | ... | |
188 | 193 |
("path", None, None), |
189 | 194 |
], None, "Queries the export information in a given path"), |
190 | 195 |
("finalize_export", SINGLE, TMO_NORMAL, [ |
191 |
("instance", INST_TO_DICT, None),
|
|
192 |
("snap_disks", "self._PrepareFinalizeExportDisks(%s)", None),
|
|
196 |
("instance", ED_INST_DICT, None),
|
|
197 |
("snap_disks", ED_FINALIZE_EXPORT_DISKS, None),
|
|
193 | 198 |
], None, "Request the completion of an export operation"), |
194 | 199 |
("export_list", MULTI, TMO_FAST, [], None, "Gets the stored exports list"), |
195 | 200 |
("export_remove", SINGLE, TMO_FAST, [ |
... | ... | |
211 | 216 |
("devices", None, None), |
212 | 217 |
], None, "Gets the sizes of requested block devices present on a node"), |
213 | 218 |
("blockdev_create", SINGLE, TMO_NORMAL, [ |
214 |
("bdev", OBJECT_TO_DICT, None),
|
|
219 |
("bdev", ED_OBJECT_DICT, None),
|
|
215 | 220 |
("size", None, None), |
216 | 221 |
("owner", None, None), |
217 | 222 |
("on_primary", None, None), |
218 | 223 |
("info", None, None), |
219 | 224 |
], None, "Request creation of a given block device"), |
220 | 225 |
("blockdev_wipe", SINGLE, TMO_SLOW, [ |
221 |
("bdev", OBJECT_TO_DICT, None),
|
|
226 |
("bdev", ED_OBJECT_DICT, None),
|
|
222 | 227 |
("offset", None, None), |
223 | 228 |
("size", None, None), |
224 | 229 |
], None, |
225 | 230 |
"Request wipe at given offset with given size of a block device"), |
226 | 231 |
("blockdev_remove", SINGLE, TMO_NORMAL, [ |
227 |
("bdev", OBJECT_TO_DICT, None),
|
|
232 |
("bdev", ED_OBJECT_DICT, None),
|
|
228 | 233 |
], None, "Request removal of a given block device"), |
229 | 234 |
("blockdev_pause_resume_sync", SINGLE, TMO_NORMAL, [ |
230 |
("disks", OBJECT_LIST_TO_DICT, None),
|
|
235 |
("disks", ED_OBJECT_DICT_LIST, None),
|
|
231 | 236 |
("pause", None, None), |
232 | 237 |
], None, "Request a pause/resume of given block device"), |
233 | 238 |
("blockdev_assemble", SINGLE, TMO_NORMAL, [ |
234 |
("disk", OBJECT_TO_DICT, None),
|
|
239 |
("disk", ED_OBJECT_DICT, None),
|
|
235 | 240 |
("owner", None, None), |
236 | 241 |
("on_primary", None, None), |
237 | 242 |
("idx", None, None), |
238 | 243 |
], None, "Request assembling of a given block device"), |
239 | 244 |
("blockdev_shutdown", SINGLE, TMO_NORMAL, [ |
240 |
("disk", OBJECT_TO_DICT, None),
|
|
245 |
("disk", ED_OBJECT_DICT, None),
|
|
241 | 246 |
], None, "Request shutdown of a given block device"), |
242 | 247 |
("blockdev_addchildren", SINGLE, TMO_NORMAL, [ |
243 |
("bdev", OBJECT_TO_DICT, None),
|
|
244 |
("ndevs", OBJECT_LIST_TO_DICT, None),
|
|
248 |
("bdev", ED_OBJECT_DICT, None),
|
|
249 |
("ndevs", ED_OBJECT_DICT_LIST, None),
|
|
245 | 250 |
], None, "Request adding a list of children to a (mirroring) device"), |
246 | 251 |
("blockdev_removechildren", SINGLE, TMO_NORMAL, [ |
247 |
("bdev", OBJECT_TO_DICT, None),
|
|
248 |
("ndevs", OBJECT_LIST_TO_DICT, None),
|
|
252 |
("bdev", ED_OBJECT_DICT, None),
|
|
253 |
("ndevs", ED_OBJECT_DICT_LIST, None),
|
|
249 | 254 |
], None, "Request removing a list of children from a (mirroring) device"), |
250 | 255 |
("blockdev_close", SINGLE, TMO_NORMAL, [ |
251 | 256 |
("instance_name", None, None), |
252 |
("disks", OBJECT_LIST_TO_DICT, None),
|
|
257 |
("disks", ED_OBJECT_DICT_LIST, None),
|
|
253 | 258 |
], None, "Closes the given block devices"), |
254 | 259 |
("blockdev_getsize", SINGLE, TMO_NORMAL, [ |
255 |
("disks", OBJECT_LIST_TO_DICT, None),
|
|
260 |
("disks", ED_OBJECT_DICT_LIST, None),
|
|
256 | 261 |
], None, "Returns the size of the given disks"), |
257 | 262 |
("drbd_disconnect_net", MULTI, TMO_NORMAL, [ |
258 | 263 |
("nodes_ip", None, None), |
259 |
("disks", OBJECT_LIST_TO_DICT, None),
|
|
264 |
("disks", ED_OBJECT_DICT_LIST, None),
|
|
260 | 265 |
], None, "Disconnects the network of the given drbd devices"), |
261 | 266 |
("drbd_attach_net", MULTI, TMO_NORMAL, [ |
262 | 267 |
("nodes_ip", None, None), |
263 |
("disks", OBJECT_LIST_TO_DICT, None),
|
|
268 |
("disks", ED_OBJECT_DICT_LIST, None),
|
|
264 | 269 |
("instance_name", None, None), |
265 | 270 |
("multimaster", None, None), |
266 | 271 |
], None, "Connects the given DRBD devices"), |
267 | 272 |
("drbd_wait_sync", MULTI, TMO_SLOW, [ |
268 | 273 |
("nodes_ip", None, None), |
269 |
("disks", OBJECT_LIST_TO_DICT, None),
|
|
274 |
("disks", ED_OBJECT_DICT_LIST, None),
|
|
270 | 275 |
], None, "Waits for the synchronization of drbd devices is complete"), |
271 | 276 |
("blockdev_grow", SINGLE, TMO_NORMAL, [ |
272 |
("cf_bdev", OBJECT_TO_DICT, None),
|
|
277 |
("cf_bdev", ED_OBJECT_DICT, None),
|
|
273 | 278 |
("amount", None, None), |
274 | 279 |
("dryrun", None, None), |
275 | 280 |
], None, "Request a snapshot of the given block device"), |
276 | 281 |
("blockdev_export", SINGLE, TMO_1DAY, [ |
277 |
("cf_bdev", OBJECT_TO_DICT, None),
|
|
282 |
("cf_bdev", ED_OBJECT_DICT, None),
|
|
278 | 283 |
("dest_node", None, None), |
279 | 284 |
("dest_path", None, None), |
280 | 285 |
("cluster_name", None, None), |
281 | 286 |
], None, "Export a given disk to another node"), |
282 | 287 |
("blockdev_snapshot", SINGLE, TMO_NORMAL, [ |
283 |
("cf_bdev", OBJECT_TO_DICT, None),
|
|
288 |
("cf_bdev", ED_OBJECT_DICT, None),
|
|
284 | 289 |
], None, "Export a given disk to another node"), |
285 | 290 |
("blockdev_rename", SINGLE, TMO_NORMAL, [ |
286 |
("devlist", "[(d.ToDict(), uid) for d, uid in %s]", None),
|
|
291 |
("devlist", ED_BLOCKDEV_RENAME, None),
|
|
287 | 292 |
], None, "Request rename of the given block devices"), |
288 | 293 |
("blockdev_find", SINGLE, TMO_NORMAL, [ |
289 |
("disk", OBJECT_TO_DICT, None),
|
|
294 |
("disk", ED_OBJECT_DICT, None),
|
|
290 | 295 |
], "self._BlockdevFindPostProc", |
291 | 296 |
"Request identification of a given block device"), |
292 | 297 |
("blockdev_getmirrorstatus", SINGLE, TMO_NORMAL, [ |
293 |
("disks", OBJECT_LIST_TO_DICT, None),
|
|
298 |
("disks", ED_OBJECT_DICT_LIST, None),
|
|
294 | 299 |
], "self._BlockdevGetMirrorStatusPostProc", |
295 | 300 |
"Request status of a (mirroring) device"), |
296 | 301 |
("blockdev_getmirrorstatus_multi", MULTI, TMO_NORMAL, [ |
297 |
("node_disks", NODE_TO_DISK_DICT, None), |
|
302 |
("node_disks", ED_NODE_TO_DISK_DICT, None),
|
|
298 | 303 |
], "self._BlockdevGetMirrorStatusMultiPostProc", |
299 | 304 |
"Request status of (mirroring) devices from multiple nodes"), |
300 | 305 |
] |
... | ... | |
382 | 387 |
"RpcClientJobQueue": [ |
383 | 388 |
("jobqueue_update", MULTI, TMO_URGENT, [ |
384 | 389 |
("file_name", None, None), |
385 |
("content", "self._Compress(%s)", None),
|
|
390 |
("content", ED_COMPRESS, None),
|
|
386 | 391 |
], None, "Update job queue file"), |
387 | 392 |
("jobqueue_purge", SINGLE, TMO_NORMAL, [], None, "Purge job queue"), |
388 | 393 |
("jobqueue_rename", MULTI, TMO_URGENT, [ |
... | ... | |
410 | 415 |
], |
411 | 416 |
"RpcClientConfig": [ |
412 | 417 |
("upload_file", MULTI, TMO_NORMAL, [ |
413 |
("file_name", "self._PrepareFileUpload(%s)", None),
|
|
418 |
("file_name", ED_FILE_DETAILS, None),
|
|
414 | 419 |
], None, "Upload a file"), |
415 | 420 |
("write_ssconf_files", MULTI, TMO_NORMAL, [ |
416 | 421 |
("values", None, None), |
Also available in: Unified diff