qemu-block
[Top][All Lists]
Advanced

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

[Qemu-block] [PATCH v3 2/4] block: Add 'ignore-backing' field to Blockde


From: Alberto Garcia
Subject: [Qemu-block] [PATCH v3 2/4] block: Add 'ignore-backing' field to BlockdevOptionsGenericCOWFormat
Date: Thu, 10 Sep 2015 16:39:10 +0300

If set to true, the image will be opened with the BDRV_O_NO_BACKING
flag. This is useful for creating snapshots using images opened with
blockdev-add, since they are not supposed to have a backing image
before the operation.

Signed-off-by: Alberto Garcia <address@hidden>
---
 block.c              | 5 +++++
 qapi/block-core.json | 6 +++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/block.c b/block.c
index 22d3b0e..4be32fb 100644
--- a/block.c
+++ b/block.c
@@ -1469,6 +1469,11 @@ static int bdrv_open_inherit(BlockDriverState **pbs, 
const char *filename,
 
     assert(drvname || !(flags & BDRV_O_PROTOCOL));
 
+    if (qdict_get_try_bool(options, "ignore-backing", false)) {
+        flags |= BDRV_O_NO_BACKING;
+    }
+    qdict_del(options, "ignore-backing");
+
     bs->open_flags = flags;
     bs->options = options;
     options = qdict_clone_shallow(options);
diff --git a/qapi/block-core.json b/qapi/block-core.json
index ec50f06..0f797d7 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -1498,11 +1498,15 @@
 #               allowed to pass an empty string here in order to disable the
 #               default backing file.
 #
+# @ignore-backing: #optional if true, no backing file will be
+#                  opened. Defaults to false (Since 2.5)
+#
 # Since: 1.7
 ##
 { 'struct': 'BlockdevOptionsGenericCOWFormat',
   'base': 'BlockdevOptionsGenericFormat',
-  'data': { '*backing': 'BlockdevRef' } }
+  'data': { '*backing': 'BlockdevRef',
+            '*ignore-backing': 'bool' } }
 
 ##
 # @Qcow2OverlapCheckMode
-- 
2.5.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]