mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-11-05 04:41:20 +00:00
agent: add qemuAgentArbitraryCommand() for general qemu agent command
Add a function qemuAgentArbitraryCommand() for general qemu agent command. Signed-off-by: MATSUDA Daiki <matsudadik@intellilink.co.jp>
This commit is contained in:
parent
05447e3af4
commit
ff049d227b
@ -1410,3 +1410,33 @@ qemuAgentSuspend(qemuAgentPtr mon,
|
||||
virJSONValueFree(reply);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
qemuAgentArbitraryCommand(qemuAgentPtr mon,
|
||||
const char *cmd_str,
|
||||
char **result,
|
||||
int timeout)
|
||||
{
|
||||
int ret = -1;
|
||||
virJSONValuePtr cmd;
|
||||
virJSONValuePtr reply = NULL;
|
||||
|
||||
*result = NULL;
|
||||
if (timeout < VIR_DOMAIN_QEMU_AGENT_COMMAND_MIN)
|
||||
return ret;
|
||||
|
||||
cmd = virJSONValueFromString(cmd_str);
|
||||
if (!cmd)
|
||||
return ret;
|
||||
|
||||
ret = qemuAgentCommand(mon, cmd, &reply, timeout);
|
||||
|
||||
if (ret == 0) {
|
||||
ret = qemuAgentCheckError(cmd, reply);
|
||||
*result = virJSONValueToString(reply, false);
|
||||
}
|
||||
|
||||
virJSONValueFree(cmd);
|
||||
virJSONValueFree(reply);
|
||||
return ret;
|
||||
}
|
||||
|
@ -77,4 +77,9 @@ int qemuAgentFSThaw(qemuAgentPtr mon);
|
||||
|
||||
int qemuAgentSuspend(qemuAgentPtr mon,
|
||||
unsigned int target);
|
||||
|
||||
int qemuAgentArbitraryCommand(qemuAgentPtr mon,
|
||||
const char *cmd,
|
||||
char **result,
|
||||
int timeout);
|
||||
#endif /* __QEMU_AGENT_H__ */
|
||||
|
Loading…
Reference in New Issue
Block a user