MCPcopy Create free account
hub / github.com/ceph/ceph / send_command

Method send_command

src/pybind/mgr/mgr_module.py:1953–1992  ·  view source on GitHub ↗

Called by the plugin to send a command to the mon cluster. :param CommandResult result: an instance of the ``CommandResult`` class, defined in the same module as MgrModule. This acts as a completion and stores the output of the command. Use

(
            self,
            result: CommandResult,
            svc_type: str,
            svc_id: str,
            command: str,
            tag: str,
            inbuf: Optional[str] = None,
            *,  # kw-only args go below
            one_shot: bool = False)

Source from the content-addressed store, hash-verified

1951 self.module._ceph_notify_all("command", self.tag)
1952
1953 def send_command(
1954 self,
1955 result: CommandResult,
1956 svc_type: str,
1957 svc_id: str,
1958 command: str,
1959 tag: str,
1960 inbuf: Optional[str] = None,
1961 *, # kw-only args go below
1962 one_shot: bool = False) -> None:
1963 """
1964 Called by the plugin to send a command to the mon
1965 cluster.
1966
1967 :param CommandResult result: an instance of the ``CommandResult``
1968 class, defined in the same module as MgrModule. This acts as a
1969 completion and stores the output of the command. Use
1970 ``CommandResult.wait()`` if you want to block on completion.
1971 :param str svc_type:
1972 :param str svc_id:
1973 :param str command: a JSON-serialized command. This uses the same
1974 format as the ceph command line, which is a dictionary of command
1975 arguments, with the extra ``prefix`` key containing the command
1976 name itself. Consult MonCommands.h for available commands and
1977 their expected arguments.
1978 :param str tag: used for nonblocking operation: when a command
1979 completes, the ``notify()`` callback on the MgrModule instance is
1980 triggered, with notify_type set to "command", and notify_id set to
1981 the tag of the command.
1982 :param str inbuf: input buffer for sending additional data.
1983 :param bool one_shot: a keyword-only param to make the command abort
1984 with EPIPE when the target resets or refuses to reconnect
1985 """
1986
1987 if svc_type == "mds":
1988 wrapped_result = self._CommandResultWrapper(self, tag, result)
1989 self.log.info(f"do mds_command: mds.{svc_id} {command}")
1990 self.cephfs.mds_command2(wrapped_result, svc_id, command, inbuf, one_shot=one_shot)
1991 else:
1992 self._ceph_send_command(result, svc_type, svc_id, command, tag, inbuf, one_shot=one_shot)
1993
1994 def tool_exec(
1995 self,

Callers 3

mon_commandMethod · 0.95
osd_commandMethod · 0.95
tell_commandMethod · 0.95

Calls 2

_ceph_send_commandMethod · 0.80
infoMethod · 0.45

Tested by

no test coverage detected