Hi. All.
I rewrote the patched.
But I modified the feature for the situation @result pointer is NULL.
Though before it does not forcely wait, I think it is not meanless because
@result pointer is always NULL.
And @timeout must be following
VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK(-2) : does not block and wait forever.
VIR_DOMAIN_QEMU_AGENT_COMMAND_DEFAULT(-1) : use default time for waiting
VIR_DOMAIN_QEMU_AGENT_COMMAND_NOWIAT(0) : does not wait and out soon
positive value : wait for pointed seconds.
In addition, I added the some options for virsh command qemu-agent-command
--block : it means taht @timeout is VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK.
--async : it means taht @timeout is VIR_DOMAIN_QEMU_AGENT_COMMAND_NOWIAT.
--timeout @seconds : @seconds must be positive value and it means that @timeout
is positive value case.
These upper options are exclusive.
If no options are given, it means taht @timeout is IR_DOMAIN_QEMU_AGENT_COMMAND_DEFAULT.
virsh # help qemu-agent-command
NAME
qemu-agent-command - QEMU Guest Agent Command
SYNOPSIS
qemu-agent-command <domain> [--timeout <number>] [--async] [--block]
{[--cmd] <string>}...
DESCRIPTION
Run an arbitrary qemu guest agent command; use at your own risk
OPTIONS
[--domain] <string> domain name, id or uuid
--timeout <number> timeout seconds. must be positive.
--async execute command without waiting for timeout
--block execute command without timeout
[--cmd] <string> command
virsh # qemu-agent-command RHEL58_64
'{"execute":"guest-info"}'
{"return":{"version":"1.1.50","supported_commands":[{"enabled":true,"name":"guest-network-get-interfaces"},{"enabled":true,"name":"guest-suspend-hybrid"},{"enabled":true,"name":"guest-suspend-ram"},{"enabled":true,"name":"guest-suspend-disk"},{"enabled":true,"name":"guest-fsfreeze-thaw"},{"enabled":true,"name":"guest-fsfreeze-freeze"},{"enabled":true,"name":"guest-fsfreeze-status"},{"enabled":true,"name":"guest-file-flush"},{"enabled":true,"name":"guest-file-seek"},{"enabled":true,"name":"guest-file-write"},{"enabled":true,"name":"guest-file-read"},{"enabled":true,"name":"guest-file-close"},{"enabled":true,"name":"guest-file-open"},{"enabled":true,"name":"guest-shutdown"},{"enabled":true,"name":"guest-info"},{"enabled":true,"name":"guest-ping"},{"enabled":true,"name":"guest-sync"},{"enabled":true,"name":"guest-sync-delimited"}]}}
virsh # qemu-agent-command --block RHEL58_64
'{"execute":"guest-sync","arguments":{"id":123}}'
{"return":123}