[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 13/15] qapi: add filter-node-name to block-stream
From: |
Andrey Shinkevich |
Subject: |
[PATCH v4 13/15] qapi: add filter-node-name to block-stream |
Date: |
Tue, 12 May 2020 19:50:43 +0300 |
Provide the possibility to pass the 'filter-node-name' parameter to the
block-stream job as it is done for the commit block job. That will be
needed for further iotests implementations.
Signed-off-by: Andrey Shinkevich <address@hidden>
---
block/monitor/block-hmp-cmds.c | 4 ++--
block/stream.c | 4 +++-
blockdev.c | 8 +++++++-
include/block/block_int.h | 7 ++++++-
qapi/block-core.json | 6 ++++++
5 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
index 4c8c375..6f6636b 100644
--- a/block/monitor/block-hmp-cmds.c
+++ b/block/monitor/block-hmp-cmds.c
@@ -507,8 +507,8 @@ void hmp_block_stream(Monitor *mon, const QDict *qdict)
qmp_block_stream(true, device, device, base != NULL, base, false, NULL,
false, NULL, qdict_haskey(qdict, "speed"), speed, true,
- BLOCKDEV_ON_ERROR_REPORT, false, false, false, false,
- &error);
+ BLOCKDEV_ON_ERROR_REPORT, false, NULL, false, false,
false,
+ false, &error);
hmp_handle_error(mon, error);
}
diff --git a/block/stream.c b/block/stream.c
index 3cca1f9..e0b35f8 100644
--- a/block/stream.c
+++ b/block/stream.c
@@ -217,7 +217,9 @@ static const BlockJobDriver stream_job_driver = {
void stream_start(const char *job_id, BlockDriverState *bs,
BlockDriverState *base, const char *backing_file_str,
int creation_flags, int64_t speed,
- BlockdevOnError on_error, Error **errp)
+ BlockdevOnError on_error,
+ const char *filter_node_name,
+ Error **errp)
{
StreamBlockJob *s;
BlockDriverState *iter;
diff --git a/blockdev.c b/blockdev.c
index 97c2ba2..67918fc 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -2753,6 +2753,7 @@ void qmp_block_stream(bool has_job_id, const char
*job_id, const char *device,
bool has_backing_file, const char *backing_file,
bool has_speed, int64_t speed,
bool has_on_error, BlockdevOnError on_error,
+ bool has_filter_node_name, const char *filter_node_name,
bool has_auto_finalize, bool auto_finalize,
bool has_auto_dismiss, bool auto_dismiss,
Error **errp)
@@ -2769,6 +2770,10 @@ void qmp_block_stream(bool has_job_id, const char
*job_id, const char *device,
on_error = BLOCKDEV_ON_ERROR_REPORT;
}
+ if (!has_filter_node_name) {
+ filter_node_name = NULL;
+ }
+
bs = bdrv_lookup_bs(device, device, errp);
if (!bs) {
return;
@@ -2840,7 +2845,8 @@ void qmp_block_stream(bool has_job_id, const char
*job_id, const char *device,
}
stream_start(has_job_id ? job_id : NULL, bs, base_bs, base_name,
- job_flags, has_speed ? speed : 0, on_error, &local_err);
+ job_flags, has_speed ? speed : 0, on_error,
+ filter_node_name, &local_err);
if (local_err) {
error_propagate(errp, local_err);
goto out;
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 86f7666..0fdfa9c 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -1094,6 +1094,9 @@ int is_windows_drive(const char *filename);
* See @BlockJobCreateFlags
* @speed: The maximum speed, in bytes per second, or 0 for unlimited.
* @on_error: The action to take upon error.
+ * @filter_node_name: The node name that should be assigned to the filter
+ * driver that the commit job inserts into the graph above @bs. NULL means
+ * that a node name should be autogenerated.
* @errp: Error object.
*
* Start a streaming operation on @bs. Clusters that are unallocated
@@ -1106,7 +1109,9 @@ int is_windows_drive(const char *filename);
void stream_start(const char *job_id, BlockDriverState *bs,
BlockDriverState *base, const char *backing_file_str,
int creation_flags, int64_t speed,
- BlockdevOnError on_error, Error **errp);
+ BlockdevOnError on_error,
+ const char *filter_node_name,
+ Error **errp);
/**
* commit_start:
diff --git a/qapi/block-core.json b/qapi/block-core.json
index 943df19..df6981e 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -2509,6 +2509,11 @@
# 'stop' and 'enospc' can only be used if the block device
# supports io-status (see BlockInfo). Since 1.3.
#
+# @filter-node-name: the node name that should be assigned to the
+# filter driver that the stream job inserts into the graph
+# above @device. If this option is not given, a node name is
+# autogenerated. (Since: 5.1)
+#
# @auto-finalize: When false, this job will wait in a PENDING state after it
has
# finished its work, waiting for @block-job-finalize before
# making any block graph changes.
@@ -2539,6 +2544,7 @@
'data': { '*job-id': 'str', 'device': 'str', '*base': 'str',
'*base-node': 'str', '*backing-file': 'str', '*speed': 'int',
'*on-error': 'BlockdevOnError',
+ '*filter-node-name': 'str',
'*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
##
--
1.8.3.1
- [PATCH v4 00/15] Apply COR-filter to the block-stream permanently, Andrey Shinkevich, 2020/05/12
- [PATCH v4 12/15] copy-on-read: add filter append/drop functions, Andrey Shinkevich, 2020/05/12
- [PATCH v4 14/15] iotests: prepare 245 for using filter in block-stream, Andrey Shinkevich, 2020/05/12
- [PATCH v4 10/15] copy-on-read: Support change filename functions, Andrey Shinkevich, 2020/05/12
- [PATCH v4 11/15] copy-on-read: Support preadv/pwritev_part functions, Andrey Shinkevich, 2020/05/12
- [PATCH v4 06/15] block: Use CAFs in block status functions, Andrey Shinkevich, 2020/05/12
- [PATCH v4 13/15] qapi: add filter-node-name to block-stream,
Andrey Shinkevich <=
- [PATCH v4 05/15] block: Include filters when freezing backing chain, Andrey Shinkevich, 2020/05/12
- [PATCH v4 07/15] commit: Deal with filters when blocking intermediate nodes, Andrey Shinkevich, 2020/05/12
- [PATCH v4 15/15] block: apply COR-filter to block-stream jobs, Andrey Shinkevich, 2020/05/12
- [PATCH v4 01/15] block: Mark commit and mirror as filter drivers, Andrey Shinkevich, 2020/05/12
- [PATCH v4 02/15] copy-on-read: Support compressed writes, Andrey Shinkevich, 2020/05/12
- [PATCH v4 09/15] block: prepare block-stream for using COR-filter, Andrey Shinkevich, 2020/05/12
- [PATCH v4 08/15] block: Use CAFs when working with backing chains, Andrey Shinkevich, 2020/05/12
- [PATCH v4 04/15] block: Add chain helper functions, Andrey Shinkevich, 2020/05/12
- [PATCH v4 03/15] block: Add child access functions, Andrey Shinkevich, 2020/05/12
- Re: [PATCH v4 00/15] Apply COR-filter to the block-stream permanently, Vladimir Sementsov-Ogievskiy, 2020/05/12