From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:36544) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TMgZp-00062X-6i for qemu-devel@nongnu.org; Fri, 12 Oct 2012 10:51:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TMgZh-0002wP-91 for qemu-devel@nongnu.org; Fri, 12 Oct 2012 10:51:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38463) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TMgZh-0002vF-0N for qemu-devel@nongnu.org; Fri, 12 Oct 2012 10:50:53 -0400 Message-ID: <50782E31.3080702@redhat.com> Date: Fri, 12 Oct 2012 08:50:25 -0600 From: Eric Blake MIME-Version: 1.0 References: <1350050969-14034-1-git-send-email-stefanha@redhat.com> <5078281B.3090702@redhat.com> <507828D7.3080306@redhat.com> <50782A1B.2030106@redhat.com> <50782B57.7050208@redhat.com> In-Reply-To: <50782B57.7050208@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigE91EB31A76FC0F207D4BE804" Subject: Re: [Qemu-devel] [PATCH] qemu-img: Add --backing-chain option to info command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: Kashyap Chamarthy , qemu-devel@nongnu.org, Stefan Hajnoczi , =?UTF-8?B?QmVub8OudCBDYW5ldA==?= This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigE91EB31A76FC0F207D4BE804 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 10/12/2012 08:38 AM, Kevin Wolf wrote: >> Hmm. For 'qemu-img info', I can see two behaviors, both useful, when >> presented with a corrupt image. One is to error out right away (becau= se >> qemu would be unable to use the image). But the other is for debuggin= g >> WHY the image is corrupt, at which point I want qemu-img info to displ= ay >> as much information as possible, INCLUDING what backing file is record= ed >> in the header, so that I can follow the loop and decide where to break= >> the loop. Sounds like we might need another flag to bdrv_open() on >> whether to detect cycles; as well as fixing qemu-img info to check for= >> cycles on its own when it bypasses normal cycle-checking in bdrv_open.= >=20 > Makes sense. Though I think BDRV_O_NO_BACKING is enough to implement > this functionality in qemu-img. We'd just have to have an error code > that allows qemu-img to check if we detected a loop so that it can star= t > searching the broken image. Indeed - BDRV_O_NO_BACKING seems to be the flag that prevents bdrv_open from failing on a cycle, so the logic would be something like: Try a normal bdrv_open() if it succeeds image is fine, so recursively print it else if error indicated a loop init hash table while (1) if file in hash table break, since we identified the loop bdrv_open(BDRV_O_NO_BACKING) print this file, then add it to the hash table file =3D backing At any rate, adding this logic should be a separate patch, and not hold up Stefan's current patch. --=20 Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enigE91EB31A76FC0F207D4BE804 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.4.12 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iQEcBAEBCAAGBQJQeC4xAAoJEKeha0olJ0NqFRkIAK2YNx5iOW6BBjCPb0v476HF fpQRWhUu18321tS/ibju18QnepwzARrBVc0761rAxMG77qGtmYwwmFbv4/scuGfT 2x00KE28wrUzaMc0i8j0KKsgQHpU0N45T6Fb1hgedvoimaZ5R01N7pxJGYddv4FJ QsR+vv+b3ynFVRqiOKX6bZtXX0Gk660DmPd9MYO3v0M528JoQARChEj2t6Qgvalh zAoFsPWQwBedb3ZLabnvHVC4NymUajj+qLltQXuJfGsQKbqvwOTjuSLtQ2VEMUHJ 2sjBIhadFZMgvhHihGc4wkZ/Tf+X93eIPqCG9WmZoQXe8tPB27FCvmBs9NH6DsU= =Biuk -----END PGP SIGNATURE----- --------------enigE91EB31A76FC0F207D4BE804--