From 681b86ac506bf994a92f17e5a8dedb278aab6ede Mon Sep 17 00:00:00 2001 From: Max Reitz Date: Mon, 3 Jun 2019 22:22:35 +0200 Subject: qapi/block-core: Overlays are not snapshots A snapshot is something that reflects the state of something at a certain point in time. It does not change. The file our snapshot commands create (or the node they install) is not a snapshot, as it does change over time. It is an overlay. We cannot do anything about the parameter names, but we can at least adjust the descriptions to reflect that fact. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Message-id: 20190603202236.1342-2-mreitz@redhat.com Reviewed-by: John Snow Reviewed-by: Alberto Garcia Signed-off-by: Max Reitz --- qapi/block-core.json | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'qapi') diff --git a/qapi/block-core.json b/qapi/block-core.json index fcd054f..c0ff3a8 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -1279,17 +1279,17 @@ # # Either @device or @node-name must be set but not both. # -# @device: the name of the device to generate the snapshot from. +# @device: the name of the device to take a snapshot of. # # @node-name: graph node name to generate the snapshot from (Since 2.0) # -# @snapshot-file: the target of the new image. If the file exists, or -# if it is a device, the snapshot will be created in the existing -# file/device. Otherwise, a new file will be created. +# @snapshot-file: the target of the new overlay image. If the file +# exists, or if it is a device, the overlay will be created in the +# existing file/device. Otherwise, a new file will be created. # # @snapshot-node-name: the graph node name of the new image (Since 2.0) # -# @format: the format of the snapshot image, default is 'qcow2'. +# @format: the format of the overlay image, default is 'qcow2'. # # @mode: whether and how QEMU should create a new image, default is # 'absolute-paths'. @@ -1302,10 +1302,10 @@ ## # @BlockdevSnapshot: # -# @node: device or node name that will have a snapshot created. +# @node: device or node name that will have a snapshot taken. # # @overlay: reference to the existing block device that will become -# the overlay of @node, as part of creating the snapshot. +# the overlay of @node, as part of taking the snapshot. # It must not have a current backing file (this can be # achieved by passing "backing": null to blockdev-add). # @@ -1443,7 +1443,7 @@ ## # @blockdev-snapshot-sync: # -# Generates a synchronous snapshot of a block device. +# Takes a synchronous snapshot of a block device. # # For the arguments, see the documentation of BlockdevSnapshotSync. # @@ -1469,9 +1469,9 @@ ## # @blockdev-snapshot: # -# Generates a snapshot of a block device. +# Takes a snapshot of a block device. # -# Create a snapshot, by installing 'node' as the backing image of +# Take a snapshot, by installing 'node' as the backing image of # 'overlay'. Additionally, if 'node' is associated with a block # device, the block device changes to using 'overlay' as its new active # image. -- cgit v1.1 From 16789db3de64147c7271d30a9d379b2a8aa2b81e Mon Sep 17 00:00:00 2001 From: Max Reitz Date: Tue, 7 May 2019 22:35:04 +0200 Subject: blkdebug: Add @iotype error option This new error option allows users of blkdebug to inject errors only on certain kinds of I/O operations. Users usually want to make a very specific operation fail, not just any; but right now they simply hope that the event that triggers the error injection is followed up with that very operation. That may not be true, however, because the block layer is changing (including blkdebug, which may increase the number of types of I/O operations on which to inject errors). The new option's default has been chosen to keep backwards compatibility. Note that similar to the internal representation, we could choose to expose this option as a list of I/O types. But there is no practical use for this, because as described above, users usually know exactly which kind of operation they want to make fail, so there is no need to specify multiple I/O types at once. In addition, exposing this option as a list would require non-trivial changes to qemu_opts_absorb_qdict(). Signed-off-by: Max Reitz Reviewed-by: Vladimir Sementsov-Ogievskiy Message-id: 20190507203508.18026-4-mreitz@redhat.com Signed-off-by: Max Reitz --- qapi/block-core.json | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'qapi') diff --git a/qapi/block-core.json b/qapi/block-core.json index c0ff3a8..34617a2 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -3265,6 +3265,26 @@ 'cor_write', 'cluster_alloc_space'] } ## +# @BlkdebugIOType: +# +# Kinds of I/O that blkdebug can inject errors in. +# +# @read: .bdrv_co_preadv() +# +# @write: .bdrv_co_pwritev() +# +# @write-zeroes: .bdrv_co_pwrite_zeroes() +# +# @discard: .bdrv_co_pdiscard() +# +# @flush: .bdrv_co_flush_to_disk() +# +# Since: 4.1 +## +{ 'enum': 'BlkdebugIOType', 'prefix': 'BLKDEBUG_IO_TYPE', + 'data': [ 'read', 'write', 'write-zeroes', 'discard', 'flush' ] } + +## # @BlkdebugInjectErrorOptions: # # Describes a single error injection for blkdebug. @@ -3274,6 +3294,11 @@ # @state: the state identifier blkdebug needs to be in to # actually trigger the event; defaults to "any" # +# @iotype: the type of I/O operations on which this error should +# be injected; defaults to "all read, write, +# write-zeroes, discard, and flush operations" +# (since: 4.1) +# # @errno: error identifier (errno) to be returned; defaults to # EIO # @@ -3291,6 +3316,7 @@ { 'struct': 'BlkdebugInjectErrorOptions', 'data': { 'event': 'BlkdebugEvent', '*state': 'int', + '*iotype': 'BlkdebugIOType', '*errno': 'int', '*sector': 'int', '*once': 'bool', -- cgit v1.1 From f8cec157cb7f04cb247786f8776ebfcebd9b61be Mon Sep 17 00:00:00 2001 From: Max Reitz Date: Tue, 7 May 2019 22:35:05 +0200 Subject: blkdebug: Add "none" event Together with @iotypes and @sector, this can be used to trap e.g. the first read or write access to a certain sector without having to know what happens internally in the block layer, i.e. which "real" events happen right before such an access. Signed-off-by: Max Reitz Reviewed-by: Vladimir Sementsov-Ogievskiy Message-id: 20190507203508.18026-5-mreitz@redhat.com Signed-off-by: Max Reitz --- qapi/block-core.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'qapi') diff --git a/qapi/block-core.json b/qapi/block-core.json index 34617a2..60f903a 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -3244,6 +3244,8 @@ # # @cluster_alloc_space: an allocation of file space for a cluster (since 4.1) # +# @none: triggers once at creation of the blkdebug node (since 4.1) +# # Since: 2.9 ## { 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG', @@ -3262,7 +3264,7 @@ 'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev', 'pwritev_zero', 'pwritev_done', 'empty_image_prepare', 'l1_shrink_write_table', 'l1_shrink_free_l2_clusters', - 'cor_write', 'cluster_alloc_space'] } + 'cor_write', 'cluster_alloc_space', 'none'] } ## # @BlkdebugIOType: -- cgit v1.1 From 1adb0b5e0f7c5c4f707b1ffa98e2b15ef51ebbc5 Mon Sep 17 00:00:00 2001 From: Max Reitz Date: Tue, 7 May 2019 22:35:06 +0200 Subject: blkdebug: Inject errors on .bdrv_co_block_status() Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy Message-id: 20190507203508.18026-6-mreitz@redhat.com Signed-off-by: Max Reitz --- qapi/block-core.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'qapi') diff --git a/qapi/block-core.json b/qapi/block-core.json index 60f903a..6112443 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -3281,10 +3281,13 @@ # # @flush: .bdrv_co_flush_to_disk() # +# @block-status: .bdrv_co_block_status() +# # Since: 4.1 ## { 'enum': 'BlkdebugIOType', 'prefix': 'BLKDEBUG_IO_TYPE', - 'data': [ 'read', 'write', 'write-zeroes', 'discard', 'flush' ] } + 'data': [ 'read', 'write', 'write-zeroes', 'discard', 'flush', + 'block-status' ] } ## # @BlkdebugInjectErrorOptions: -- cgit v1.1