[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC 04/15] qapi: block-job-change: make copy-mode parameter optiona
From: |
Markus Armbruster |
Subject: |
Re: [RFC 04/15] qapi: block-job-change: make copy-mode parameter optional |
Date: |
Thu, 28 Mar 2024 10:24:40 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> writes:
> We are going to add more parameters to change. We want to make possible
> to change only one or any subset of available options. So all the
> options should be optional.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
> ---
> block/mirror.c | 5 +++++
> qapi/block-core.json | 2 +-
> 2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/block/mirror.c b/block/mirror.c
> index a177502e4f..2d0cd22c06 100644
> --- a/block/mirror.c
> +++ b/block/mirror.c
> @@ -1265,6 +1265,11 @@ static void mirror_change(BlockJob *job,
> JobChangeOptions *opts,
>
> GLOBAL_STATE_CODE();
>
> + if (!change_opts->has_copy_mode) {
> + /* Nothing to do */
I doubt the comment is useful.
> + return;
> + }
> +
> if (qatomic_read(&s->copy_mode) == change_opts->copy_mode) {
> return;
> }
if (change_opts->copy_mode != MIRROR_COPY_MODE_WRITE_BLOCKING) {
error_setg(errp, "Change to copy mode '%s' is not implemented",
MirrorCopyMode_str(change_opts->copy_mode));
return;
}
current = qatomic_cmpxchg(&s->copy_mode, MIRROR_COPY_MODE_BACKGROUND,
change_opts->copy_mode);
if (current != MIRROR_COPY_MODE_BACKGROUND) {
error_setg(errp, "Expected current copy mode '%s', got '%s'",
MirrorCopyMode_str(MIRROR_COPY_MODE_BACKGROUND),
MirrorCopyMode_str(current));
}
Now I'm curious: what could be changing @copy_mode behind our backs
here?
> diff --git a/qapi/block-core.json b/qapi/block-core.json
> index 67dd0ef038..6041e7bd8f 100644
> --- a/qapi/block-core.json
> +++ b/qapi/block-core.json
> @@ -3071,7 +3071,7 @@
##
# @BlockJobChangeOptionsMirror:
#
# @copy-mode: Switch to this copy mode. Currently, only the switch
# from 'background' to 'write-blocking' is implemented.
#
> # Since: 8.2
> ##
> { 'struct': 'JobChangeOptionsMirror',
> - 'data': { 'copy-mode' : 'MirrorCopyMode' } }
> + 'data': { '*copy-mode' : 'MirrorCopyMode' } }
>
> ##
> # @JobChangeOptions:
A member becoming optional is backward compatible. Okay.
We may want to document "(optional since 9.1)". We haven't done so in
the past.
The doc comment needs to spell out how absent members are handled.
- [RFC 07/15] qapi: add job-change, (continued)
- [RFC 07/15] qapi: add job-change, Vladimir Sementsov-Ogievskiy, 2024/03/13
- [RFC 12/15] qapi: rename BlockDeviceIoStatus to IoStatus, Vladimir Sementsov-Ogievskiy, 2024/03/13
- [RFC 13/15] qapi: move IoStatus to common.json, Vladimir Sementsov-Ogievskiy, 2024/03/13
- [RFC 08/15] qapi: job-change: support speed parameter, Vladimir Sementsov-Ogievskiy, 2024/03/13
- [RFC 09/15] qapi: job-complete: introduce no-block-replace option for mirror, Vladimir Sementsov-Ogievskiy, 2024/03/13
- [RFC 02/15] qapi: rename BlockJobChangeOptions to JobChangeOptions, Vladimir Sementsov-Ogievskiy, 2024/03/13
- [RFC 06/15] blockjob: move change action implementation to job from block-job, Vladimir Sementsov-Ogievskiy, 2024/03/13
- [RFC 10/15] qapi: query-jobs: add information specific for job type, Vladimir Sementsov-Ogievskiy, 2024/03/13
- [RFC 14/15] qapi: query-job: add block-job specific information, Vladimir Sementsov-Ogievskiy, 2024/03/13
- [RFC 04/15] qapi: block-job-change: make copy-mode parameter optional, Vladimir Sementsov-Ogievskiy, 2024/03/13
- Re: [RFC 04/15] qapi: block-job-change: make copy-mode parameter optional,
Markus Armbruster <=
- [RFC 15/15] qapi/block-core: derpecate block-job- APIs, Vladimir Sementsov-Ogievskiy, 2024/03/13
- [RFC 05/15] qapi: JobChangeOptions: make type member optional and deprecated, Vladimir Sementsov-Ogievskiy, 2024/03/13
- [RFC 11/15] job-qmp: job_query_single_locked: add assertion on job ret, Vladimir Sementsov-Ogievskiy, 2024/03/13