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

Osier Yang jyang at redhat.com
Thu Aug 18 01:51:39 UTC 2011


于 2011年08月17日 22:59, Daniel P. Berrange 写道:
> On Wed, Aug 17, 2011 at 09:10:41PM +0800, Osier Yang wrote:
>> If one tries to restore a domain from a corrupt save image, we blindly
>> goes forward to restore from it, this can cause many different errors,
>> depending on how much the image is saved. E.g.
>>
>> https://bugzilla.redhat.com/show_bug.cgi?id=730750
>>
>> So I'm thinking if we can introduce a new feild to struct qemud_save_header,
>> such as "bool complete;", and set it true if succeeded to save the image,
>> false if not. So that could do some checking while trying to open the image
>> (qemuDomainSaveImageOpen), and quit early if "complete" is false, with
>> a sensiable error message.
>>
>> Thought?
> I assume you mean that when saving the guest, we'd do the following sequence
>
>    1. Write out basic header with complete=false
>    2. Write out XML doc
>    3. Run 'migrate' in QEMU to write save state
>    4. If success, update header with complete=true
>
> And then on restore we'd do
>
>    1. If complete == false, then quit with error
>    2. Run QEMU with -incoming to restore

Yes, exactly.

> At which point I wonder what's wrong with:
>
>    1. Write out basic header
>    2. Write out XML doc
>    3. Run 'migrate' in QEMU to write save state
>    4. If not success, unlink save fail
>
> The only case where there's any difference, is if libvirtd itself crashes
> between steps 1&  4.
>
> Daniel




More information about the libvir-list mailing list