[libvirt] [RFC] Add a new feild to qemud_save_header to tell if the saved image is corrupt

Eric Blake eblake at redhat.com
Fri Aug 19 13:07:41 UTC 2011


On 08/17/2011 10:01 AM, Daniel P. Berrange wrote:
> The downside to adding a new header field, is that old libvirt
> won't look for it. A slightly more evil approach is to
>
>    1. Write header, but with 'magic' set to all zerso

Or even to a specific value, different from all zeros, which new libvirt 
recognizes as incomplete save file.

>    2. do migration
>    3. Re-write header to set correct 'magic'
>
>
> On the plus side old livirt will refuse to restore from this. On the
> downside new libvirt will give less good errors "not a known save
> file" instad of "save file is corrupt"

Old libvirt won't recognize the file at all (still a good point, since 
it shouldn't be trying to load an incomplete file), but by having two 
different magic numbers, newer libvirt can make more sensible error 
reporting and decisions on how to handle an incomplete file, in contrast 
to a file that is not even a partial save file.

I like the idea of reusing magic rather than burning a new field, since 
that buys us protection to older libvirt.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org




More information about the libvir-list mailing list