Daniel
Thank you for your comment. And I rewrite the patch with
int virDomainQemuAgentCommand(virDomainPtr domain, const char *cmd,
char **result, unsigned int flags);
that you suggested.
The attached patch is against libvirt-0.9.13-rc2
virsh # qemu-agent-command RHEL58_64 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"}]}}
On Tue, Jun 26, 2012 at 12:42:03PM +0900, MATSUDA, Daiki wrote:
> Currently, libvirt qemu agent supports some QEMU Guest Agent's commands
> or use them. But they are not adapted to communication test to the
> Domain OS.
>
> So, QEMU Guest Agent provide 'guest-info' command to display its version
> and their commands. And I wrote the codes for supporting it.
>
> virsh # guest-agent-info RHEL62_32
> Version: 1.1.0
> Commands:
> guest-network-get-interfaces
> guest-suspend-hybrid
> guest-suspend-ram
> guest-suspend-disk
> guest-fsfreeze-thaw
> guest-fsfreeze-freeze
> guest-fsfreeze-status
> guest-file-flush
> guest-file-seek
> guest-file-write
> guest-file-read
> guest-file-close
> guest-file-open
> guest-shutdown
> guest-info
> guest-ping
> guest-sync
> guest-sync-delimited
I don't really think that this kind of API is relevant for the
libvirt public API. Individual agent commands are wired up to
specific libvirt public APIs as required. There is no compelling
reason why an end user needs to know what agent commands are
present.
I would, however, support the introduction of an API
int virDomainQemuAgentCommand(virDomainPtr domain, const char *cmd,
char **result, unsigned int flags);
and virsh command 'qemu-agent-command' as part of libvirt-qemu.h and
libvirt-qemu.so. Basically an equivalent of the existing QEMU specific
API virDomainQemuMonitorCommand(), but talking to the agent instead of
the monitor
Regards,
Daniel