From: Eric Blake <eblake@redhat.com>
To: Puneet Bakshi <bakshi.puneet@gmail.com>,
libvir-list@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Regarding guest-file-write
Date: Tue, 24 Jun 2014 09:32:17 -0600 [thread overview]
Message-ID: <53A99A01.2030409@redhat.com> (raw)
In-Reply-To: <CALBPQ30kTRjnHdAJ-i4FqkNfqKRpPdz0rJ7c5KTCC+S+-3kvYg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2457 bytes --]
On 06/24/2014 06:50 AM, 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?
You aren't using the command correctly. The qemu-guest-agent interface
for guest-file-write expects data to be base64-encoded.
>
> 1b. What is the limit of data, I can send in one guest-file-write command?
That's a question for the qemu list, as qemu-guest-agent is maintained
there, not here.
>
> 2. In the guest, file data seems to be different. Am I doing something
> wrong here?
Yes, you aren't encoding your data properly.
>
>
> Host (file write)
>
> [root@sdsr720-14 ~]# virsh qemu-agent-command vm_04 '{"
> execute":"guest-file-open", "arguments":{"path":"/tmp/testqga","mode":"w
> +"}}'
Remember, the use of qemu-agent-command is EXPLICITLY unsupported by
libvirt. It's there as a debugging and development aid, and NOT
something you should be using in your production environment.
I *highly* recommend that you figure out how to set up shared file
systems (NFS, gluster, plan9, MTP, ...) so that you can have the guest
read a file already exported by the host through existing shared
filesystem code, rather than slogging through trying to write the file
through arcane invocations of the qemu-guest-agent.
>
> [root@sdsr720-14 ~]# virsh qemu-agent-command vm_04 '{"
> execute":"guest-file-write",
> "arguments":{"handle":1000,"buf-b64":"abcdefghijklmnopqrstuvwxyz"}}'
>
> {"return":{"count":18,"eof":false}}
That is NOT a valid base64 encoded buffer.
$ printf abcdefghijklmnopqrstuvwxyz | base64 -d | od -tx1z
base64: invalid input
0000000 69 b7 1d 79 f8 21 8a 39 25 9a 7a 29 aa bb 2d ba >i..y.!.9%.z)..-.<
0000020 fc 31 cb >.1.<
0000023
>
> [root@vm04 qga]# cat /tmp/testqga
>
> i�^]y�!�9%�z)��-��1[root@vm04 qga]#
But those contents match the base64 decoding of (the valid portion of)
the buffer that you passed in. So the only bug here is in your usage,
not in qemu-guest-agent or in libvirt.
-
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
prev parent reply other threads:[~2014-06-24 15:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-24 12:50 [Qemu-devel] Regarding guest-file-write Puneet Bakshi
2014-06-24 12:57 ` [Qemu-devel] [libvirt] " Daniel P. Berrange
2014-06-24 13:10 ` Puneet Bakshi
2014-06-24 15:34 ` Eric Blake
2014-06-24 15:32 ` Eric Blake [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53A99A01.2030409@redhat.com \
--to=eblake@redhat.com \
--cc=bakshi.puneet@gmail.com \
--cc=libvir-list@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.