Host (file write)
[root@sdsr720-14 ~]# virsh qemu-agent-command vm_04 '{"execute":"guest-file-open", "arguments":{"path":"/tmp/testqga","mode":"w+"}}'
{"return":1000}
[root@sdsr720-14 ~]# virsh qemu-agent-command vm_04 '{"execute":"guest-file-write", "arguments":{"handle":1000,"buf-b64":"abcdefghijklmnopqrstuvwxyz"}}'
{"return":{"count":18,"eof":false}}
[root@sdsr720-14 ~]# virsh qemu-agent-command vm_04 '{"execute":"guest-file-close", "arguments":{"handle":1000}}'
{"return":{}}
Host (file read)
[root@sdsr720-14 ~]# virsh qemu-agent-command
vm_04 '{"execute":"guest-file-open",
"arguments":{"path":"/tmp/testqga","mode":"r"}}'
{"return":1001}
[root@sdsr720-14 ~]# virsh qemu-agent-command vm_04 '{"execute":"guest-file-read", "arguments":{"handle":1001,"count":18}}'
{"return":{"count":18,"buf-b64":"abcdefghijklmnopqrstuvwx","eof":false}}
[root@sdsr720-14 ~]# virsh qemu-agent-command vm_04 '{"execute":"guest-file-close", "arguments":{"handle":1001}}'
{"return":{}}
Guest
[root@vm04 qga]# ll /tmp/testqga
-rw-rw-rw-. 1 root root 18 Jun 24 15:06 /tmp/testqga
[root@vm04 qga]# cat /tmp/testqga
i�^]y�!�9%�z)��-��1[root@vm04 qga]#
[root@vm04 qga]# od -x /tmp/testqga
0000000 b769 791d 21f8 398a 9a25 297a bbaa ba2d
0000020 31fc
0000022