qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] qemu-img: Add --backing-chain option to info co


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH] qemu-img: Add --backing-chain option to info command
Date: Fri, 12 Oct 2012 08:50:25 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120911 Thunderbird/15.0.1

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 (because
>> qemu would be unable to use the image).  But the other is for debugging
>> WHY the image is corrupt, at which point I want qemu-img info to display
>> as much information as possible, INCLUDING what backing file is recorded
>> 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.
> 
> 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 start
> 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 = backing

At any rate, adding this logic should be a separate patch, and not hold
up Stefan's current patch.

-- 
Eric Blake   address@hidden    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]