[libvirt] Regarding guest-file-write

Puneet Bakshi bakshi.puneet at gmail.com
Tue Jun 24 12:50:16 UTC 2014


Hi,

>From host, I wrote 26 alphabets in guest file (/tmp/testqga) using
guest-file-write guest agent command (logs pasted below). I faced 2 issues
when doing that.

1a. It could wrote only 18bytes! Why could it not write all 26 characters?
Are we supposed to track how much data is written and need to resend the
remaining one?

1b. What is the limit of data, I can send in one guest-file-write command?

2. In the guest, file data seems to be different. Am I doing something
wrong here?


Host (file write)

[root at sdsr720-14 ~]# virsh qemu-agent-command vm_04 '{"
execute":"guest-file-open", "arguments":{"path":"/tmp/testqga","mode":"w
+"}}'

{"return":1000}


[root at sdsr720-14 ~]# virsh qemu-agent-command vm_04 '{"
execute":"guest-file-write",
"arguments":{"handle":1000,"buf-b64":"abcdefghijklmnopqrstuvwxyz"}}'

{"return":{"count":18,"eof":false}}


[root at sdsr720-14 ~]# virsh qemu-agent-command vm_04 '{"
execute":"guest-file-close", "arguments":{"handle":1000}}'

{"return":{}}


Host (file read)

[root at sdsr720-14 ~]# virsh qemu-agent-command vm_04 '{"
execute":"guest-file-open", "arguments":{"path":"/tmp/testqga","mode":"r"}}'

{"return":1001}


[root at 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 at sdsr720-14 ~]# virsh qemu-agent-command vm_04 '{"
execute":"guest-file-close", "arguments":{"handle":1001}}'

{"return":{}}

Guest

[root at vm04 qga]# ll /tmp/testqga

-rw-rw-rw-. 1 root root 18 Jun 24 15:06 /tmp/testqga


[root at vm04 qga]# cat /tmp/testqga

i�^]y�!�9%�z)��-��1[root at vm04 qga]#


[root at vm04 qga]# od -x /tmp/testqga

0000000 b769 791d 21f8 398a 9a25 297a bbaa ba2d

0000020 31fc

0000022

     [root at vm04 qga]# strings /tmp/testqga

     [root at vm04 qga]# hexdump /tmp/testqga
     0000000 b769 791d 21f8 398a 9a25 297a bbaa ba2d
     0000010 31fc
     0000012

     [root at vm04 qga]# hexdump -c /tmp/testqga
     0000000   i 267 035   y 370   ! 212   9   % 232   z   ) 252 273   - 272
     0000010 374   1
     0000012
     [root at vm04 qga]#

Regards,
~Puneet
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140624/601701d5/attachment-0001.htm>


More information about the libvir-list mailing list