[PATCH] Add basic support for VDI images

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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},
 };
 verify(ARRAY_CARDINALITY(fileTypeInfo) == VIR_STORAGE_FILE_LAST);

diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index 618b028..83dc3f2 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -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,
 };
--
1.8.1.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]