mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
virsh: Implement support for virDomainQemuMonitorCommandWithFiles
Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
f87fa77ca9
commit
43edde82af
@ -7897,7 +7897,8 @@ qemu-monitor-command
|
|||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
qemu-monitor-command domain { [--hmp] | [--pretty] [--return-value] } command...
|
qemu-monitor-command domain { [--hmp] | [--pretty] [--return-value] }
|
||||||
|
[--pass-fds N,M,...] command...
|
||||||
|
|
||||||
Send an arbitrary monitor command *command* to domain *domain* through the
|
Send an arbitrary monitor command *command* to domain *domain* through the
|
||||||
QEMU monitor. The results of the command will be printed on stdout.
|
QEMU monitor. The results of the command will be printed on stdout.
|
||||||
@ -7930,6 +7931,9 @@ extracted rather than passing through the full reply from QEMU.
|
|||||||
If *--hmp* is passed, the command is considered to be a human monitor command
|
If *--hmp* is passed, the command is considered to be a human monitor command
|
||||||
and libvirt will automatically convert it into QMP and convert the result back.
|
and libvirt will automatically convert it into QMP and convert the result back.
|
||||||
|
|
||||||
|
If *--pass-fds* is specified, the argument is a comma separated list
|
||||||
|
of open file descriptors which should be passed on to qemu along with the
|
||||||
|
command.
|
||||||
|
|
||||||
qemu-agent-command
|
qemu-agent-command
|
||||||
------------------
|
------------------
|
||||||
|
@ -9721,6 +9721,11 @@ static const vshCmdOptDef opts_qemu_monitor_command[] = {
|
|||||||
.type = VSH_OT_BOOL,
|
.type = VSH_OT_BOOL,
|
||||||
.help = N_("extract the value of the 'return' key from the returned string")
|
.help = N_("extract the value of the 'return' key from the returned string")
|
||||||
},
|
},
|
||||||
|
{.name = "pass-fds",
|
||||||
|
.type = VSH_OT_STRING,
|
||||||
|
.completer = virshCompleteEmpty,
|
||||||
|
.help = N_("pass file descriptors N,M,... along with the command")
|
||||||
|
},
|
||||||
{.name = "cmd",
|
{.name = "cmd",
|
||||||
.type = VSH_OT_ARGV,
|
.type = VSH_OT_ARGV,
|
||||||
.flags = VSH_OFLAG_REQ,
|
.flags = VSH_OFLAG_REQ,
|
||||||
@ -9819,6 +9824,8 @@ cmdQemuMonitorCommand(vshControl *ctl, const vshCmd *cmd)
|
|||||||
bool returnval = vshCommandOptBool(cmd, "return-value");
|
bool returnval = vshCommandOptBool(cmd, "return-value");
|
||||||
virJSONValue *formatjson;
|
virJSONValue *formatjson;
|
||||||
g_autofree char *jsonstr = NULL;
|
g_autofree char *jsonstr = NULL;
|
||||||
|
g_autofree int *fds = NULL;
|
||||||
|
size_t nfds = 0;
|
||||||
|
|
||||||
VSH_EXCLUSIVE_OPTIONS("hmp", "pretty");
|
VSH_EXCLUSIVE_OPTIONS("hmp", "pretty");
|
||||||
VSH_EXCLUSIVE_OPTIONS("hmp", "return-value");
|
VSH_EXCLUSIVE_OPTIONS("hmp", "return-value");
|
||||||
@ -9838,8 +9845,18 @@ cmdQemuMonitorCommand(vshControl *ctl, const vshCmd *cmd)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (virshFetchPassFdsList(ctl, cmd, &nfds, &fds) < 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (fds) {
|
||||||
|
if (virDomainQemuMonitorCommandWithFiles(dom, monitor_cmd, nfds, fds,
|
||||||
|
NULL, NULL,
|
||||||
|
&result, flags) < 0)
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
if (virDomainQemuMonitorCommand(dom, monitor_cmd, &result, flags) < 0)
|
if (virDomainQemuMonitorCommand(dom, monitor_cmd, &result, flags) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (returnval || pretty) {
|
if (returnval || pretty) {
|
||||||
resultjson = virJSONValueFromString(result);
|
resultjson = virJSONValueFromString(result);
|
||||||
|
Loading…
Reference in New Issue
Block a user