From: Markus Armbruster <armbru@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org, jsnow@redhat.com,
kwolf@redhat.com, hreitz@redhat.com, devel@lists.libvirt.org,
eblake@redhat.com, michael.roth@amd.com, pbonzini@redhat.com,
pkrempa@redhat.com, f.ebner@proxmox.com
Subject: Re: [RFC 04/15] qapi: block-job-change: make copy-mode parameter optional
Date: Thu, 28 Mar 2024 10:24:40 +0100 [thread overview]
Message-ID: <878r22emjr.fsf@pond.sub.org> (raw)
In-Reply-To: <20240313150907.623462-5-vsementsov@yandex-team.ru> (Vladimir Sementsov-Ogievskiy's message of "Wed, 13 Mar 2024 18:08:56 +0300")
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.
next prev parent reply other threads:[~2024-03-28 9:25 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-13 15:08 [RFC 00/15] block job API Vladimir Sementsov-Ogievskiy
2024-03-13 15:08 ` [RFC 01/15] scripts/qapi: support type-based unions Vladimir Sementsov-Ogievskiy
2024-03-28 9:15 ` Markus Armbruster
2024-03-28 10:44 ` Vladimir Sementsov-Ogievskiy
2024-03-28 9:40 ` Markus Armbruster
2024-03-28 10:18 ` Vladimir Sementsov-Ogievskiy
2024-03-13 15:08 ` [RFC 02/15] qapi: rename BlockJobChangeOptions to JobChangeOptions Vladimir Sementsov-Ogievskiy
2024-03-13 15:08 ` [RFC 03/15] blockjob: block_job_change_locked(): check job type Vladimir Sementsov-Ogievskiy
2024-03-13 15:08 ` [RFC 04/15] qapi: block-job-change: make copy-mode parameter optional Vladimir Sementsov-Ogievskiy
2024-03-28 9:24 ` Markus Armbruster [this message]
2024-03-28 10:56 ` Vladimir Sementsov-Ogievskiy
2024-03-13 15:08 ` [RFC 05/15] qapi: JobChangeOptions: make type member optional and deprecated Vladimir Sementsov-Ogievskiy
2024-03-13 15:08 ` [RFC 06/15] blockjob: move change action implementation to job from block-job Vladimir Sementsov-Ogievskiy
2024-03-13 15:08 ` [RFC 07/15] qapi: add job-change Vladimir Sementsov-Ogievskiy
2024-03-13 15:09 ` [RFC 08/15] qapi: job-change: support speed parameter Vladimir Sementsov-Ogievskiy
2024-03-13 15:09 ` [RFC 09/15] qapi: job-complete: introduce no-block-replace option for mirror Vladimir Sementsov-Ogievskiy
2024-03-13 15:09 ` [RFC 10/15] qapi: query-jobs: add information specific for job type Vladimir Sementsov-Ogievskiy
2024-03-13 15:09 ` [RFC 11/15] job-qmp: job_query_single_locked: add assertion on job ret Vladimir Sementsov-Ogievskiy
2024-03-13 15:09 ` [RFC 12/15] qapi: rename BlockDeviceIoStatus to IoStatus Vladimir Sementsov-Ogievskiy
2024-03-13 15:09 ` [RFC 13/15] qapi: move IoStatus to common.json Vladimir Sementsov-Ogievskiy
2024-03-13 15:09 ` [RFC 14/15] qapi: query-job: add block-job specific information Vladimir Sementsov-Ogievskiy
2024-03-13 15:09 ` [RFC 15/15] qapi/block-core: derpecate block-job- APIs Vladimir Sementsov-Ogievskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878r22emjr.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=devel@lists.libvirt.org \
--cc=eblake@redhat.com \
--cc=f.ebner@proxmox.com \
--cc=hreitz@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=michael.roth@amd.com \
--cc=pbonzini@redhat.com \
--cc=pkrempa@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@yandex-team.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.