On Mon, Apr 11, 2011 at 11:46:55AM -0600, Eric Blake wrote: > 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? The thing I'm worried about is that by bumping older versions won't be able to restore the new dumps, and that could be a serious issue on shared storage. We are not introducing a new feature, so I thin we need to preserve forward compatibility. The patch as is is minimal but achieves it. Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@xxxxxxxxxxxx | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list