[libvirt] [PATCH] migrate VMs between different-endian hosts

Eric Blake eblake at redhat.com
Mon Apr 11 17:46:55 UTC 2011


On 04/11/2011 07:36 AM, Daniel Veillard wrote:
>>>> @@ -3097,6 +3107,11 @@ qemuDomainSaveImageOpen(struct qemud_dri
>>>>      }
>>>>
>>>>      if (header.version>  QEMUD_SAVE_VERSION) {
>>>> +        /* convert endianess and try again */
>>>> +        bswap_header(&header);
>>>> +    }
>>>   Hum, isn't there a more reliable way to detect the change of
>>> endianness ? That's a bit fishy IMHO :-)
>> The problem is that the header should not have been written in a
>> hosts' native format. So what can go wrong? QEMUD_SAVE_VERSION is
>> '2'. Either we find 1 or 2 here and go ahead and accept it 'as-is'.
>> Otherwise anything bigger than 3 is not accepted and swapped. 3 then
>> becomes 0x03 00 00 00 and is discarded. 0x 02 00 00 00 would be
>> swapped to '2' and accepted.
> 
>   yeah, I understand, okay,

Should we be writing the header in a particular byte order, regardless
of host endianness?  Or does that require bumping the header version to
3 anyways?

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110411/5e7a7622/attachment-0001.sig>


More information about the libvir-list mailing list