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

[Libguestfs] [PATCH 1/3] lib: guestfs_disk_create: Allow vmdk as a valid backingformat.



Commit 588af1953e5f7ab74009b9175cc5d3efb8bb651a started with a very
conservative list of permitted backing formats (just "raw" or
"qcow2").  We can allow almost any format permitted by qemu, but this
commit just adds "vmdk" to this whitelist.
---
 src/create.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/create.c b/src/create.c
index 621ace5..bfb8b76 100644
--- a/src/create.c
+++ b/src/create.c
@@ -261,7 +261,12 @@ disk_create_qcow2 (guestfs_h *g, const char *orig_filename, int64_t size,
 
   if (optargs->bitmask & GUESTFS_DISK_CREATE_BACKINGFORMAT_BITMASK) {
     backingformat = optargs->backingformat;
-    if (STRNEQ (backingformat, "raw") && STRNEQ (backingformat, "qcow2")) {
+    /* Conservative whitelist.  This can be extended with other
+     * valid formats as required.
+     */
+    if (STRNEQ (backingformat, "raw") &&
+        STRNEQ (backingformat, "qcow2") &&
+        STRNEQ (backingformat, "vmdk")) {
       error (g, _("invalid value for backingformat parameter '%s'"),
              backingformat);
       return -1;
-- 
2.1.0


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