1. In that case, I hope it allow sending binary data (non-ASCII) also.

2. If I encode my data in base-64 form, is there a limit on size of the data I can pass (or I can pass arbitrarily large amount of data).

​Regards​,
~Puneet

On Tue, Jun 24, 2014 at 6:27 PM, Daniel P. Berrange <berrange@redhat.com> wrote:
On Tue, Jun 24, 2014 at 06:20:16PM +0530, Puneet Bakshi wrote:
> 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?

Yes, the command does not take raw data, it takes base-64 encoded data.
So those 26 characters you specified were base64 decoded which gives
you 18 bytes of raw data.

The clue is in the variable name 'buf-b64' - a shorthand for base64:

> [root@sdsr720-14 ~]# virsh qemu-agent-command vm_04 '{"
> execute":"guest-file-write",
> "arguments":{"handle":1000,"buf-b64":"abcdefghijklmnopqrstuvwxyz"}}'
>
> {"return":{"count":18,"eof":false}}

Regards,
Daniel
--
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|