[PATCH 1/5] lib: Introduce 'virDomainQemuMonitorCommandWithFiles'

Ján Tomko jtomko at redhat.com
Thu Feb 3 16:53:19 UTC 2022


On a Thursday in 2022, Peter Krempa wrote:
>This API has the same semantics as 'virDomainQemuMonitorCommand' but
>accepts file descriptors which are then forwarded to qemu.
>
>Signed-off-by: Peter Krempa <pkrempa at redhat.com>
>---
> include/libvirt/libvirt-qemu.h      |  6 +++
> src/driver-hypervisor.h             |  8 ++++
> src/libvirt-qemu.c                  | 71 +++++++++++++++++++++++++++++
> src/libvirt_qemu.syms               |  5 ++
> src/qemu_protocol-structs           |  9 ++++
> src/remote/qemu_protocol.x          | 20 +++++++-
> src/remote/remote_daemon_dispatch.c | 42 +++++++++++++++++
> src/remote/remote_driver.c          | 40 ++++++++++++++++
> 8 files changed, 200 insertions(+), 1 deletion(-)
>
>diff --git a/src/libvirt-qemu.c b/src/libvirt-qemu.c
>index 1afb5fe529..1dbe0cba54 100644
>--- a/src/libvirt-qemu.c
>+++ b/src/libvirt-qemu.c
>@@ -96,6 +96,77 @@ virDomainQemuMonitorCommand(virDomainPtr domain, const char *cmd,
> }
>
>
>+/**
>+ * virDomainQemuMonitorCommandWithFiles:
>+ * @domain: a domain object
>+ * @cmd: the qemu monitor command string
>+ * @nfiles: number of filedescriptors passed in @files
>+ * @files: filedescriptors to be passed to qemu with the command
>+ * @result: a string returned by @cmd
>+ * @flags: bitwise-or of supported virDomainQemuMonitorCommandFlags
>+ *
>+ * This API is QEMU specific, so it will only work with hypervisor
>+ * connections to the QEMU driver with local connections using the unix socket.
>+ *
>+ * Send an arbitrary monitor command @cmd with file descriptors @files to
>+ * @domain through the qemu monitor. There are several requirements to safely
>+ * and successfully use this API:
>+ *
>+ *   - A @cmd that queries state without making any modifications is safe
>+ *   - A @cmd that alters state that is also tracked by libvirt is unsafe,
>+ *     and may cause libvirtd to crash
>+ *   - A @cmd that alters state not tracked by the current version of
>+ *     libvirt is possible as a means to test new qemu features before
>+ *     they have support in libvirt, but no guarantees are made to safety
>+ *
>+ * If VIR_DOMAIN_QEMU_MONITOR_COMMAND_HMP is set, the command is
>+ * considered to be a human monitor command and libvirt will automatically
>+ * convert it into QMP if needed.  In that case the @result will also

'if needed' is not really needed.

Jano

>+ * be converted back from QMP.
>+ *
>+ * If successful, @result will be filled with the string output of the
>+ * @cmd, and the caller must free this string.
>+ *
>+ * Returns 0 in case of success, -1 in case of failure
>+ */
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20220203/373f8410/attachment-0001.sig>


More information about the libvir-list mailing list