]> xenbits.xensource.com Git - libvirt.git/commitdiff
Add basic support for VDI images
authorMartin Kletzander <mkletzan@redhat.com>
Mon, 4 Feb 2013 19:18:22 +0000 (20:18 +0100)
committerMartin Kletzander <mkletzan@redhat.com>
Mon, 4 Feb 2013 22:47:42 +0000 (23:47 +0100)
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.

src/util/virstoragefile.c
src/util/virstoragefile.h

index 71b2d8cf30ecfff0429a7b61ab1c4236c87d88df..6e2d61e93007689d77c266f8986f9eda70578c65 100644 (file)
@@ -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 */
@@ -194,6 +194,12 @@ static struct FileTypeInfo const fileTypeInfo[] = {
         LV_BIG_ENDIAN, 12, 0x10000,
         8 + 4 + 4 + 8 + 4 + 4 + 2 + 2 + 4, 8, 1, -1, NULL
     },
+    /* TODO: add getBackingStore function */
+    [VIR_STORAGE_FILE_VDI] = {
+        64, "\x7f\x10\xda\xbe", ".vdi",
+        LV_LITTLE_ENDIAN, 68, 0x00010001,
+        68 + 5 * 4 + 256 + 7 * 4, 8, 1, -1, NULL},
+
     /* Not direct file formats, but used for various drivers */
     [VIR_STORAGE_FILE_FAT] = { 0, NULL, NULL, LV_LITTLE_ENDIAN,
                                -1, 0, 0, 0, 0, 0, NULL },
index 618b028225e4c4801253bdd63bf8da1768949c15..821d07ec7302fbd12f01d0819edee9feecab2366 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * virstoragefile.h: file utility functions for FS storage backend
  *
- * Copyright (C) 2007-2009, 2012 Red Hat, Inc.
+ * Copyright (C) 2007-2009, 2012-2013 Red Hat, Inc.
  * Copyright (C) 2007-2008 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -44,6 +44,7 @@ enum virStorageFileFormat {
     VIR_STORAGE_FILE_VPC,
     VIR_STORAGE_FILE_FAT,
     VIR_STORAGE_FILE_VHD,
+    VIR_STORAGE_FILE_VDI,
 
     VIR_STORAGE_FILE_LAST,
 };