
On Mon, Feb 04, 2013 at 04:46:53PM +0100, Martin Kletzander wrote:
QEMU is fully capable of handling VDI images and we just refuse to work with them. As qemu-img knows and supports this, there should be no problem with this addition.
This is of course, just basic functionality, without searching for any backing files, etc. ---
It's very much possible that I missed something when adding this "functionality", I just tested running a machine and creating a volume using 'virsh vol-create-as'. So feel free to point out mymistakes.
--- src/util/virstoragefile.c | 9 +++++++-- src/util/virstoragefile.h | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index cdac5b1..33e72c9 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -1,7 +1,7 @@ /* * virstoragefile.c: file utility functions for FS storage backend * - * Copyright (C) 2007-2012 Red Hat, Inc. + * Copyright (C) 2007-2013 Red Hat, Inc. * Copyright (C) 2007-2008 Daniel P. Berrange * * This library is free software; you can redistribute it and/or @@ -51,7 +51,7 @@ VIR_ENUM_IMPL(virStorageFileFormat, "raw", "dir", "bochs", "cloop", "cow", "dmg", "iso", "qcow", "qcow2", "qed", "vmdk", "vpc", - "fat", "vhd") + "fat", "vhd", "vdi")
enum lv_endian { LV_LITTLE_ENDIAN = 1, /* 1234 */ @@ -193,6 +193,11 @@ static struct FileTypeInfo const fileTypeInfo[] = { -1, 0, 0, 0, 0, 0, NULL }, [VIR_STORAGE_FILE_VHD] = { NULL, NULL, LV_LITTLE_ENDIAN, -1, 0, 0, 0, 0, 0, NULL }, + + /* 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. Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|