Hi. All.
I rewrote the patched for git head tree, adding some code.
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.
And I also add VIR_DOMAIN_QEMU_AGENT_COMMAND_MIN for not writing static value.
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}