On 02/04/2013 04:53 PM, Daniel P. Berrange wrote: > On Mon, Feb 04, 2013 at 04:46:53PM +0100, Martin Kletzander wrote: [...] >> + >> + /* not fully supported, but qemu knows it, so we should be able to >> + * handle this at least basically */ >> + [VIR_STORAGE_FILE_VDI] = { NULL, ".vdi", LV_LITTLE_ENDIAN, >> + -2, 0, 0, 0, 0, -1, NULL}, > > We can do better than that - look at block/vdi.c in QEMU GIT tree > to find out the offsets / values for version number, magic signature > at least, even if you ignore backing files for now. > Thanks for pointing that out, I've got a v2 and will send it after some testing. However, it looks like VDI doesn't have a magic, because there is a 40 Byte string at the start that cacn contain anything the creating binary puts there. For example qemu-img uses "<<< QEMU VM Virtual Disk Image >>>\n". According to [1], I'm adding "<<<" as the magic, because we don't fail if it doesn't match and we can still match it by the extension then. [1] Cite from block/vdi.c: /* Innotek / SUN images use these strings in header.text: * "<<< innotek VirtualBox Disk Image >>>\n" * "<<< Sun xVM VirtualBox Disk Image >>>\n" * "<<< Sun VirtualBox Disk Image >>>\n" * The value does not matter, so QEMU created images use a different text. */ #define VDI_TEXT "<<< QEMU VM Virtual Disk Image >>>\n" I added all the rest I could, though. Martin -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list