From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39689) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WzShu-0002uP-2J for qemu-devel@nongnu.org; Tue, 24 Jun 2014 11:32:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WzSho-0006oW-8l for qemu-devel@nongnu.org; Tue, 24 Jun 2014 11:32:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1986) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WzSho-0006oQ-1N for qemu-devel@nongnu.org; Tue, 24 Jun 2014 11:32:20 -0400 Message-ID: <53A99A01.2030409@redhat.com> Date: Tue, 24 Jun 2014 09:32:17 -0600 From: Eric Blake MIME-Version: 1.0 References: In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="hO0xXCfgg494IWspmMWKurbCR6R4kVcSD" Subject: Re: [Qemu-devel] Regarding guest-file-write List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Puneet Bakshi , libvir-list@redhat.com, qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --hO0xXCfgg494IWspmMWKurbCR6R4kVcSD Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 06/24/2014 06:50 AM, Puneet Bakshi wrote: > Hi, >=20 >>>From host, I wrote 26 alphabets in guest file (/tmp/testqga) using > guest-file-write guest agent command (logs pasted below). I faced 2 iss= ues > when doing that. >=20 > 1a. It could wrote only 18bytes! Why could it not write all 26 characte= rs? > Are we supposed to track how much data is written and need to resend th= e > remaining one? You aren't using the command correctly. The qemu-guest-agent interface for guest-file-write expects data to be base64-encoded. >=20 > 1b. What is the limit of data, I can send in one guest-file-write comma= nd? That's a question for the qemu list, as qemu-guest-agent is maintained there, not here. >=20 > 2. In the guest, file data seems to be different. Am I doing something > wrong here? Yes, you aren't encoding your data properly. >=20 >=20 > Host (file write) >=20 > [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. >=20 > [root@sdsr720-14 ~]# virsh qemu-agent-command vm_04 '{" > execute":"guest-file-write", > "arguments":{"handle":1000,"buf-b64":"abcdefghijklmnopqrstuvwxyz"}}' >=20 > {"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)..-= =2E< 0000020 fc 31 cb >.1.< 0000023 >=20 > [root@vm04 qga]# cat /tmp/testqga >=20 > i=EF=BF=BD^]y=EF=BF=BD!=EF=BF=BD9%=EF=BF=BDz)=EF=BF=BD=EF=BF=BD-=EF=BF=BD= =EF=BF=BD1[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 --hO0xXCfgg494IWspmMWKurbCR6R4kVcSD Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTqZoBAAoJEKeha0olJ0NqQdQH/j3cr4nCX5Z1r8+J6V1q0dyM 3ICFRD66sxpffEtkTQTJgIGmZiaI0ere2WW9Hydnx/XVBCxc4qStZrnWN7MegRUX DJbSK7s8bHX7f5ih5FlBXYdBQROKky1ktO9VO4g9J8xKOCuzN7uvA98tGrNez20/ VgdF6K7eZcavIhNJN4lZ30dRn6sbEeWiOcVsB96COkyU/12JZfHEuuEo6FYFMKKn YQLAqFTydZY8M0KrLok511S2FFaBeb3uxNAUlQY+xTv8vIz6nQz7lxqUFXR6d4rV dQ4WNzKMa4IiKsig3xQLP0fWHOhsMb+KtbT0kiiSJLBRae2YxEnsxS7x8TciOTQ= =o5w5 -----END PGP SIGNATURE----- --hO0xXCfgg494IWspmMWKurbCR6R4kVcSD--