From nobody Sun Nov 24 01:51:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=yandex-team.ru Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1727878076395804.1373979101147; Wed, 2 Oct 2024 07:07:56 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 5AF6211C9; Wed, 2 Oct 2024 10:07:55 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 65A9615E4; Wed, 2 Oct 2024 10:06:57 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 9ECABA18; Wed, 2 Oct 2024 10:06:52 -0400 (EDT) Received: from forwardcorp1d.mail.yandex.net (forwardcorp1d.mail.yandex.net [178.154.239.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 5DC23B80 for ; Wed, 2 Oct 2024 10:06:50 -0400 (EDT) Received: from mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:2e8b:0:640:9795:0]) by forwardcorp1d.mail.yandex.net (Yandex) with ESMTPS id 0E27360A05; Wed, 2 Oct 2024 17:06:48 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6b8:b081:8026::1:2f]) by mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id S6cR231IXeA0-U58OG1no; Wed, 02 Oct 2024 17:06:47 +0300 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1727878007; bh=NC4l71ZU2QZsFuC9zoxFRkAOwdL2wTKK5ZcxHOVIUVU=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=HHbwSQ0KmyaTgOQPz+mwsBiMTnemoamCOFQzxaLiJr4fRmSgap4Zzp9MS4CTxB8uF 4Hl9GywCkpFWUiVhb+ibQRH8hu5G5rDSmOZ60BK3dzSQc1VxEffs48WteZbuJ0xzSP pjZhrqu1cszP3Pq4OJ2u8GnJIQmwgB9aewp0pfb0= Authentication-Results: mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v3 1/7] qapi: rename BlockJobChangeOptions to JobChangeOptions Date: Wed, 2 Oct 2024 17:06:10 +0300 Message-Id: <20241002140616.561652-2-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241002140616.561652-1-vsementsov@yandex-team.ru> References: <20241002140616.561652-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 X-Yandex-Filter: 1 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: DEQP2IGLTEQQFMJCZ4QBGH7TAWZUEJFO X-Message-ID-Hash: DEQP2IGLTEQQFMJCZ4QBGH7TAWZUEJFO X-MailFrom: vsementsov@yandex-team.ru X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 CC: qemu-devel@nongnu.org, armbru@redhat.com, eblake@redhat.com, devel@lists.libvirt.org, hreitz@redhat.com, kwolf@redhat.com, vsementsov@yandex-team.ru, jsnow@redhat.com, pkrempa@redhat.com X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZM-MESSAGEID: 1727878077224116600 Content-Type: text/plain; charset="utf-8" We are going to move change action from block-job to job implementation, and then move to job-* extenral APIs, deprecating block-job-* APIs. This commit simplifies further transition. The commit is made by command git grep -l BlockJobChangeOptions | \ xargs sed -i 's/BlockJobChangeOptions/JobChangeOptions/g' Signed-off-by: Vladimir Sementsov-Ogievskiy Acked-by: Markus Armbruster --- block/mirror.c | 4 ++-- blockdev.c | 2 +- blockjob.c | 2 +- include/block/blockjob.h | 2 +- include/block/blockjob_int.h | 2 +- qapi/block-core.json | 12 ++++++------ 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/block/mirror.c b/block/mirror.c index 61f0a717b7..2816bb1042 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -1258,11 +1258,11 @@ static bool commit_active_cancel(Job *job, bool for= ce) return force || !job_is_ready(job); } =20 -static void mirror_change(BlockJob *job, BlockJobChangeOptions *opts, +static void mirror_change(BlockJob *job, JobChangeOptions *opts, Error **errp) { MirrorBlockJob *s =3D container_of(job, MirrorBlockJob, common); - BlockJobChangeOptionsMirror *change_opts =3D &opts->u.mirror; + JobChangeOptionsMirror *change_opts =3D &opts->u.mirror; MirrorCopyMode current; =20 /* diff --git a/blockdev.c b/blockdev.c index 6740663fda..626f53102d 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3251,7 +3251,7 @@ void qmp_block_job_dismiss(const char *id, Error **er= rp) job_dismiss_locked(&job, errp); } =20 -void qmp_block_job_change(BlockJobChangeOptions *opts, Error **errp) +void qmp_block_job_change(JobChangeOptions *opts, Error **errp) { BlockJob *job; =20 diff --git a/blockjob.c b/blockjob.c index d5f29e14af..8cfbb15543 100644 --- a/blockjob.c +++ b/blockjob.c @@ -312,7 +312,7 @@ static bool block_job_set_speed(BlockJob *job, int64_t = speed, Error **errp) return block_job_set_speed_locked(job, speed, errp); } =20 -void block_job_change_locked(BlockJob *job, BlockJobChangeOptions *opts, +void block_job_change_locked(BlockJob *job, JobChangeOptions *opts, Error **errp) { const BlockJobDriver *drv =3D block_job_driver(job); diff --git a/include/block/blockjob.h b/include/block/blockjob.h index 7061ab7201..5dd1b08909 100644 --- a/include/block/blockjob.h +++ b/include/block/blockjob.h @@ -181,7 +181,7 @@ bool block_job_set_speed_locked(BlockJob *job, int64_t = speed, Error **errp); * * Change the job according to opts. */ -void block_job_change_locked(BlockJob *job, BlockJobChangeOptions *opts, +void block_job_change_locked(BlockJob *job, JobChangeOptions *opts, Error **errp); =20 /** diff --git a/include/block/blockjob_int.h b/include/block/blockjob_int.h index 4c3d2e25a2..d9c3b911d0 100644 --- a/include/block/blockjob_int.h +++ b/include/block/blockjob_int.h @@ -73,7 +73,7 @@ struct BlockJobDriver { * * Note that this can already be called before the job coroutine is ru= nning. */ - void (*change)(BlockJob *job, BlockJobChangeOptions *opts, Error **err= p); + void (*change)(BlockJob *job, JobChangeOptions *opts, Error **errp); =20 /* * Query information specific to this kind of block job. diff --git a/qapi/block-core.json b/qapi/block-core.json index c3b0a2376b..0156762024 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -3068,18 +3068,18 @@ 'allow-preconfig': true } =20 ## -# @BlockJobChangeOptionsMirror: +# @JobChangeOptionsMirror: # # @copy-mode: Switch to this copy mode. Currently, only the switch # from 'background' to 'write-blocking' is implemented. # # Since: 8.2 ## -{ 'struct': 'BlockJobChangeOptionsMirror', +{ 'struct': 'JobChangeOptionsMirror', 'data': { 'copy-mode' : 'MirrorCopyMode' } } =20 ## -# @BlockJobChangeOptions: +# @JobChangeOptions: # # Block job options that can be changed after job creation. # @@ -3089,10 +3089,10 @@ # # Since: 8.2 ## -{ 'union': 'BlockJobChangeOptions', +{ 'union': 'JobChangeOptions', 'base': { 'id': 'str', 'type': 'JobType' }, 'discriminator': 'type', - 'data': { 'mirror': 'BlockJobChangeOptionsMirror' } } + 'data': { 'mirror': 'JobChangeOptionsMirror' } } =20 ## # @block-job-change: @@ -3102,7 +3102,7 @@ # Since: 8.2 ## { 'command': 'block-job-change', - 'data': 'BlockJobChangeOptions', 'boxed': true } + 'data': 'JobChangeOptions', 'boxed': true } =20 ## # @BlockdevDiscardOptions: --=20 2.34.1 From nobody Sun Nov 24 01:51:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=yandex-team.ru Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1727878034122393.43206522750665; Wed, 2 Oct 2024 07:07:14 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id EA020C67; Wed, 2 Oct 2024 10:07:12 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 10D9CBE0; Wed, 2 Oct 2024 10:06:55 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 1F3F5A09; Wed, 2 Oct 2024 10:06:52 -0400 (EDT) Received: from forwardcorp1d.mail.yandex.net (forwardcorp1d.mail.yandex.net [178.154.239.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 5BE92B44 for ; Wed, 2 Oct 2024 10:06:50 -0400 (EDT) Received: from mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:2e8b:0:640:9795:0]) by forwardcorp1d.mail.yandex.net (Yandex) with ESMTPS id B971F60A08; Wed, 2 Oct 2024 17:06:48 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6b8:b081:8026::1:2f]) by mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id S6cR231IXeA0-Cn6zHsDZ; Wed, 02 Oct 2024 17:06:48 +0300 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1727878008; bh=yLJaDyEAelrXRgY1Ri4RSUibfQW2G7z/Oefqj6dQnvE=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=W+y8xb/7CcVraTiM1V+fhW6+2SRXra+taN7PjOznOOpnbH6K6y8LBuRaOFF3DW8xz 4p/O0PpE1pDamEPbfQmt0DzgUA461zaLcU514SBQldrUskxmtyKiSUCEGYEQ79W22F Y/q53Gwm1vk7kks0j/o6GxjgixnkdEwv+SpJnVpA= Authentication-Results: mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v3 2/7] blockjob: block_job_change_locked(): check job type Date: Wed, 2 Oct 2024 17:06:11 +0300 Message-Id: <20241002140616.561652-3-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241002140616.561652-1-vsementsov@yandex-team.ru> References: <20241002140616.561652-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 X-Yandex-Filter: 1 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: PM3ABDAH24E7INCEE7VIFHVJX6CNZ6NL X-Message-ID-Hash: PM3ABDAH24E7INCEE7VIFHVJX6CNZ6NL X-MailFrom: vsementsov@yandex-team.ru X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 CC: qemu-devel@nongnu.org, armbru@redhat.com, eblake@redhat.com, devel@lists.libvirt.org, hreitz@redhat.com, kwolf@redhat.com, vsementsov@yandex-team.ru, jsnow@redhat.com, pkrempa@redhat.com X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZM-MESSAGEID: 1727878035505116600 Content-Type: text/plain; charset="utf-8" User may specify wrong type for the job id. Let's check it. Signed-off-by: Vladimir Sementsov-Ogievskiy --- blockjob.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/blockjob.c b/blockjob.c index 8cfbb15543..788cb1e07d 100644 --- a/blockjob.c +++ b/blockjob.c @@ -319,6 +319,12 @@ void block_job_change_locked(BlockJob *job, JobChangeO= ptions *opts, =20 GLOBAL_STATE_CODE(); =20 + if (job_type(&job->job) !=3D opts->type) { + error_setg(errp, "Job '%s' is '%s' job, not '%s'", job->job.id, + job_type_str(&job->job), JobType_str(opts->type)); + return; + } + if (job_apply_verb_locked(&job->job, JOB_VERB_CHANGE, errp)) { return; } --=20 2.34.1 From nobody Sun Nov 24 01:51:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=yandex-team.ru Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1727878114398889.4631751855921; Wed, 2 Oct 2024 07:08:34 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 5495316AD; Wed, 2 Oct 2024 10:08:33 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 04B96165D; Wed, 2 Oct 2024 10:07:01 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id C0CE99F2; Wed, 2 Oct 2024 10:06:52 -0400 (EDT) Received: from forwardcorp1a.mail.yandex.net (forwardcorp1a.mail.yandex.net [178.154.239.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id BF8B79E4 for ; Wed, 2 Oct 2024 10:06:51 -0400 (EDT) Received: from mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:2e8b:0:640:9795:0]) by forwardcorp1a.mail.yandex.net (Yandex) with ESMTPS id 6FC7160B9C; Wed, 2 Oct 2024 17:06:49 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6b8:b081:8026::1:2f]) by mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id S6cR231IXeA0-DlNHdJfF; Wed, 02 Oct 2024 17:06:48 +0300 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1727878008; bh=mdEa2j58UIbdesA3CTO4zNSQT7yI9v8F+lGAJ+trbtM=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=RmXZxyEYY3tFDGkpe+nUYAJ/Va2sS8yZizOyFSF7Jk1jiwoYt02swn3LreTpEQAa1 BUfZBhqKcPmD3jeDgSMUmRzyO6rRpQ35MVbNqXB1Sct5MMRjYqqyDWfohO3ECAhbYI AZ7teN6xL6AB0ly6MJmEV86CLaz6XIG/7xxTyRso= Authentication-Results: mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v3 3/7] qapi: block-job-change: make copy-mode parameter optional Date: Wed, 2 Oct 2024 17:06:12 +0300 Message-Id: <20241002140616.561652-4-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241002140616.561652-1-vsementsov@yandex-team.ru> References: <20241002140616.561652-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 X-Yandex-Filter: 1 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: TOKH3AW2FX2Y5J3VUD3ZWSGOIICP2PFW X-Message-ID-Hash: TOKH3AW2FX2Y5J3VUD3ZWSGOIICP2PFW X-MailFrom: vsementsov@yandex-team.ru X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 CC: qemu-devel@nongnu.org, armbru@redhat.com, eblake@redhat.com, devel@lists.libvirt.org, hreitz@redhat.com, kwolf@redhat.com, vsementsov@yandex-team.ru, jsnow@redhat.com, pkrempa@redhat.com X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZM-MESSAGEID: 1727878115702116600 Content-Type: text/plain; charset="utf-8" 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 Acked-by: Markus Armbruster --- block/mirror.c | 4 ++++ qapi/block-core.json | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/block/mirror.c b/block/mirror.c index 2816bb1042..60e8d83e4f 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -1272,6 +1272,10 @@ static void mirror_change(BlockJob *job, JobChangeOp= tions *opts, =20 GLOBAL_STATE_CODE(); =20 + if (!change_opts->has_copy_mode) { + return; + } + if (qatomic_read(&s->copy_mode) =3D=3D change_opts->copy_mode) { return; } diff --git a/qapi/block-core.json b/qapi/block-core.json index 0156762024..f370593037 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -3072,11 +3072,12 @@ # # @copy-mode: Switch to this copy mode. Currently, only the switch # from 'background' to 'write-blocking' is implemented. +# If absent, copy mode remains the same. (optional since 9.2) # # Since: 8.2 ## { 'struct': 'JobChangeOptionsMirror', - 'data': { 'copy-mode' : 'MirrorCopyMode' } } + 'data': { '*copy-mode' : 'MirrorCopyMode' } } =20 ## # @JobChangeOptions: --=20 2.34.1 From nobody Sun Nov 24 01:51:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1727878083; cv=none; d=zohomail.com; s=zohoarc; b=HYm0CnJWnnvS57u6ZFfYazhtlVgLMscCBCr9bo+yrVk3nb2jvXhEanBbV6/zRemHAHmoswkKMDghZxeVs0xfP+AXExwZncBaatFaMEjs2AMRyJkAxR/HDM2n65cT9OJajyequRbYHnx82LOMIELCfx35pjHcXhCIoMA+bnHaRvE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1727878083; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=d47v11Jg0W9cSjUkV9E9vMx2QGo08NG5isJM8YhvfEY=; b=hHwWnvZp9dWvfNk7oHEO+vRpVallGZ61zI1nOgfhJ89GPVrK8b3v8Objf9gUQ3l6PqcNxG8GgQII3SioPkpsGaxGghLdhpeM80EjmAOeN2AfJnD+gykMIB3p5CdvDAGz5hz7LuJsbR19DBDex3EcxsQagOevGwWaE4s808nl5R4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1727878083356426.92679137856146; Wed, 2 Oct 2024 07:08:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sw00k-0003aR-Am; Wed, 02 Oct 2024 10:07:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sw00Q-0003T0-CS; Wed, 02 Oct 2024 10:07:09 -0400 Received: from forwardcorp1b.mail.yandex.net ([178.154.239.136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sw00G-000582-92; Wed, 02 Oct 2024 10:06:58 -0400 Received: from mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:2e8b:0:640:9795:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTPS id 54D5E60D22; Wed, 2 Oct 2024 17:06:50 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6b8:b081:8026::1:2f]) by mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id S6cR231IXeA0-ilRUSWgB; Wed, 02 Oct 2024 17:06:49 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1727878009; bh=d47v11Jg0W9cSjUkV9E9vMx2QGo08NG5isJM8YhvfEY=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=J6xqOmO9JFu2mZx5VMtZLKYAk9KYwPIYO5Oxrv618Ou7ECInsBTiNfc1P+byutbvY mqG6iENYVD4Hj/YLyVajsL1ESGzMoLolkUy5zzsfqAQFkhmjj1ZlFcWlPYxg5Cz5Cm 1EVQzNiPF6Ab8/AkO6n1Dq81COKgelb6BgiGqUR8= Authentication-Results: mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, armbru@redhat.com, eblake@redhat.com, devel@lists.libvirt.org, hreitz@redhat.com, kwolf@redhat.com, vsementsov@yandex-team.ru, jsnow@redhat.com, pkrempa@redhat.com Subject: [PATCH v3 4/7] blockjob: move change action implementation to job from block-job Date: Wed, 2 Oct 2024 17:06:13 +0300 Message-Id: <20241002140616.561652-5-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241002140616.561652-1-vsementsov@yandex-team.ru> References: <20241002140616.561652-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Yandex-Filter: 1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=178.154.239.136; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1b.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1727878091858116600 Content-Type: text/plain; charset="utf-8" Like for other block-job-* APIs we want have the actual functionality in job layer and make block-job-change to be a deprecated duplication of job-change in the following commit. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/mirror.c | 7 +++---- blockdev.c | 2 +- blockjob.c | 26 -------------------------- include/block/blockjob.h | 11 ----------- include/block/blockjob_int.h | 7 ------- include/qemu/job.h | 12 ++++++++++++ job-qmp.c | 1 + job.c | 23 +++++++++++++++++++++++ 8 files changed, 40 insertions(+), 49 deletions(-) diff --git a/block/mirror.c b/block/mirror.c index 60e8d83e4f..63e35114f3 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -1258,10 +1258,9 @@ static bool commit_active_cancel(Job *job, bool forc= e) return force || !job_is_ready(job); } =20 -static void mirror_change(BlockJob *job, JobChangeOptions *opts, - Error **errp) +static void mirror_change(Job *job, JobChangeOptions *opts, Error **errp) { - MirrorBlockJob *s =3D container_of(job, MirrorBlockJob, common); + MirrorBlockJob *s =3D container_of(job, MirrorBlockJob, common.job); JobChangeOptionsMirror *change_opts =3D &opts->u.mirror; MirrorCopyMode current; =20 @@ -1316,9 +1315,9 @@ static const BlockJobDriver mirror_job_driver =3D { .pause =3D mirror_pause, .complete =3D mirror_complete, .cancel =3D mirror_cancel, + .change =3D mirror_change, }, .drained_poll =3D mirror_drained_poll, - .change =3D mirror_change, .query =3D mirror_query, }; =20 diff --git a/blockdev.c b/blockdev.c index 626f53102d..b1c3de3862 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3262,7 +3262,7 @@ void qmp_block_job_change(JobChangeOptions *opts, Err= or **errp) return; } =20 - block_job_change_locked(job, opts, errp); + job_change_locked(&job->job, opts, errp); } =20 void qmp_change_backing_file(const char *device, diff --git a/blockjob.c b/blockjob.c index 788cb1e07d..2769722b37 100644 --- a/blockjob.c +++ b/blockjob.c @@ -312,32 +312,6 @@ static bool block_job_set_speed(BlockJob *job, int64_t= speed, Error **errp) return block_job_set_speed_locked(job, speed, errp); } =20 -void block_job_change_locked(BlockJob *job, JobChangeOptions *opts, - Error **errp) -{ - const BlockJobDriver *drv =3D block_job_driver(job); - - GLOBAL_STATE_CODE(); - - if (job_type(&job->job) !=3D opts->type) { - error_setg(errp, "Job '%s' is '%s' job, not '%s'", job->job.id, - job_type_str(&job->job), JobType_str(opts->type)); - return; - } - - if (job_apply_verb_locked(&job->job, JOB_VERB_CHANGE, errp)) { - return; - } - - if (drv->change) { - job_unlock(); - drv->change(job, opts, errp); - job_lock(); - } else { - error_setg(errp, "Job type does not support change"); - } -} - void block_job_ratelimit_processed_bytes(BlockJob *job, uint64_t n) { IO_CODE(); diff --git a/include/block/blockjob.h b/include/block/blockjob.h index 5dd1b08909..72e849a140 100644 --- a/include/block/blockjob.h +++ b/include/block/blockjob.h @@ -173,17 +173,6 @@ bool block_job_has_bdrv(BlockJob *job, BlockDriverStat= e *bs); */ bool block_job_set_speed_locked(BlockJob *job, int64_t speed, Error **errp= ); =20 -/** - * block_job_change_locked: - * @job: The job to change. - * @opts: The new options. - * @errp: Error object. - * - * Change the job according to opts. - */ -void block_job_change_locked(BlockJob *job, JobChangeOptions *opts, - Error **errp); - /** * block_job_query_locked: * @job: The job to get information about. diff --git a/include/block/blockjob_int.h b/include/block/blockjob_int.h index d9c3b911d0..58bc7a5cea 100644 --- a/include/block/blockjob_int.h +++ b/include/block/blockjob_int.h @@ -68,13 +68,6 @@ struct BlockJobDriver { =20 void (*set_speed)(BlockJob *job, int64_t speed); =20 - /* - * Change the @job's options according to @opts. - * - * Note that this can already be called before the job coroutine is ru= nning. - */ - void (*change)(BlockJob *job, JobChangeOptions *opts, Error **errp); - /* * Query information specific to this kind of block job. */ diff --git a/include/qemu/job.h b/include/qemu/job.h index 2b873f2576..6fa525dac3 100644 --- a/include/qemu/job.h +++ b/include/qemu/job.h @@ -27,6 +27,7 @@ #define JOB_H =20 #include "qapi/qapi-types-job.h" +#include "qapi/qapi-types-block-core.h" #include "qemu/queue.h" #include "qemu/progress_meter.h" #include "qemu/coroutine.h" @@ -307,6 +308,12 @@ struct JobDriver { */ bool (*cancel)(Job *job, bool force); =20 + /** + * Change the @job's options according to @opts. + * + * Note that this can already be called before the job coroutine is ru= nning. + */ + void (*change)(Job *job, JobChangeOptions *opts, Error **errp); =20 /** * Called when the job is freed. @@ -705,6 +712,11 @@ void job_finalize_locked(Job *job, Error **errp); */ void job_dismiss_locked(Job **job, Error **errp); =20 +/** + * Change the job according to opts. + */ +void job_change_locked(Job *job, JobChangeOptions *opts, Error **errp); + /** * Synchronously finishes the given @job. If @finish is given, it is calle= d to * trigger completion or cancellation of the job. diff --git a/job-qmp.c b/job-qmp.c index 9e26fa899f..c764bd3801 100644 --- a/job-qmp.c +++ b/job-qmp.c @@ -26,6 +26,7 @@ #include "qemu/osdep.h" #include "qemu/job.h" #include "qapi/qapi-commands-job.h" +#include "qapi/qapi-commands-block-core.h" #include "qapi/error.h" #include "trace/trace-root.h" =20 diff --git a/job.c b/job.c index 660ce22c56..7b004fe12e 100644 --- a/job.c +++ b/job.c @@ -1262,3 +1262,26 @@ int job_finish_sync_locked(Job *job, job_unref_locked(job); return ret; } + +void job_change_locked(Job *job, JobChangeOptions *opts, Error **errp) +{ + GLOBAL_STATE_CODE(); + + if (job_type(job) !=3D opts->type) { + error_setg(errp, "Job '%s' is '%s' job, not '%s'", job->id, + job_type_str(job), JobType_str(opts->type)); + return; + } + + if (job_apply_verb_locked(job, JOB_VERB_CHANGE, errp)) { + return; + } + + if (job->driver->change) { + job_unlock(); + job->driver->change(job, opts, errp); + job_lock(); + } else { + error_setg(errp, "Job type does not support change"); + } +} --=20 2.34.1 From nobody Sun Nov 24 01:51:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=yandex-team.ru Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 172787809616475.46745264355513; Wed, 2 Oct 2024 07:08:16 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 14D921670; Wed, 2 Oct 2024 10:08:15 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 76FA8C6B; Wed, 2 Oct 2024 10:07:00 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 9FF0A9ED; Wed, 2 Oct 2024 10:06:52 -0400 (EDT) Received: from forwardcorp1d.mail.yandex.net (forwardcorp1d.mail.yandex.net [178.154.239.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 1E13E9ED for ; Wed, 2 Oct 2024 10:06:52 -0400 (EDT) Received: from mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:2e8b:0:640:9795:0]) by forwardcorp1d.mail.yandex.net (Yandex) with ESMTPS id 0BC5560A06; Wed, 2 Oct 2024 17:06:51 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6b8:b081:8026::1:2f]) by mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id S6cR231IXeA0-5zxLI8J4; Wed, 02 Oct 2024 17:06:50 +0300 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1727878010; bh=AEIEJcUayiK4Dtv6JDzHo0D8qPCjlxBTkSwFSQDwgAA=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=y9GWCS3DYInhcxJjxhkP1vrI3dVBdv0ORlVQyFGf41c78sbvYIsGBvnZkWTzx225P sy6sQgIJBRNWp38nprG+r4clRO85sUdxs6Ri0RKbaBCubdNxt7dmaSUJNYngBaQhAC d1fKxxf0Dp7KUFbVcES/e8+7LOff9UXkAONU+hlc= Authentication-Results: mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v3 5/7] qapi: add job-change Date: Wed, 2 Oct 2024 17:06:14 +0300 Message-Id: <20241002140616.561652-6-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241002140616.561652-1-vsementsov@yandex-team.ru> References: <20241002140616.561652-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 X-Yandex-Filter: 1 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: DNXOH26MZ44Y4WCU2ZOUOETEYZPKHFGE X-Message-ID-Hash: DNXOH26MZ44Y4WCU2ZOUOETEYZPKHFGE X-MailFrom: vsementsov@yandex-team.ru X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 CC: qemu-devel@nongnu.org, armbru@redhat.com, eblake@redhat.com, devel@lists.libvirt.org, hreitz@redhat.com, kwolf@redhat.com, vsementsov@yandex-team.ru, jsnow@redhat.com, pkrempa@redhat.com X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZM-MESSAGEID: 1727878099217116600 Content-Type: text/plain; charset="utf-8" Add a new-style command job-change, doing same thing as block-job-change. The aim is finally deprecate block-job-* APIs and move to job-* APIs. We add a new command to qapi/block-core.json, not to qapi/job.json to avoid resolving json file including loops for now. This all would be a lot simple to refactor when we finally drop deprecated block-job-* APIs. Signed-off-by: Vladimir Sementsov-Ogievskiy --- job-qmp.c | 14 ++++++++++++++ qapi/block-core.json | 10 ++++++++++ 2 files changed, 24 insertions(+) diff --git a/job-qmp.c b/job-qmp.c index c764bd3801..248e68f554 100644 --- a/job-qmp.c +++ b/job-qmp.c @@ -139,6 +139,20 @@ void qmp_job_dismiss(const char *id, Error **errp) job_dismiss_locked(&job, errp); } =20 +void qmp_job_change(JobChangeOptions *opts, Error **errp) +{ + Job *job; + + JOB_LOCK_GUARD(); + job =3D find_job_locked(opts->id, errp); + + if (!job) { + return; + } + + job_change_locked(job, opts, errp); +} + /* Called with job_mutex held. */ static JobInfo *job_query_single_locked(Job *job, Error **errp) { diff --git a/qapi/block-core.json b/qapi/block-core.json index f370593037..e314734b53 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -3105,6 +3105,16 @@ { 'command': 'block-job-change', 'data': 'JobChangeOptions', 'boxed': true } =20 +## +# @job-change: +# +# Change the block job's options. +# +# Since: 9.2 +## +{ 'command': 'job-change', + 'data': 'JobChangeOptions', 'boxed': true } + ## # @BlockdevDiscardOptions: # --=20 2.34.1 From nobody Sun Nov 24 01:51:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=yandex-team.ru Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1727878140528792.4725654512034; Wed, 2 Oct 2024 07:09:00 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 7F8A5D0F; Wed, 2 Oct 2024 10:08:59 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 2E0F416EB; Wed, 2 Oct 2024 10:07:04 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 59F85A09; Wed, 2 Oct 2024 10:06:53 -0400 (EDT) Received: from forwardcorp1d.mail.yandex.net (forwardcorp1d.mail.yandex.net [178.154.239.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id CB2D192C for ; Wed, 2 Oct 2024 10:06:52 -0400 (EDT) Received: from mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:2e8b:0:640:9795:0]) by forwardcorp1d.mail.yandex.net (Yandex) with ESMTPS id C261860A0F; Wed, 2 Oct 2024 17:06:51 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6b8:b081:8026::1:2f]) by mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id S6cR231IXeA0-OPlOovpy; Wed, 02 Oct 2024 17:06:51 +0300 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1727878011; bh=kNsGBAuWorp26KUw22nD/PRdPTQO4FpyA8j9wzaB9OU=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=sTRFIPw8V8GCoWL0zvkiXxewLWuFOlRj6FWT45IxOoWGU0ro96uPRS3AmouxkOtRZ FRWJSkjReoTiU6EWNgZFAah17mKTNGpQFllERQuKta+9w5CNHmcmHgKrfU1FBWck+a KW+z4lgI6ZwVnq9k87OrzjmY4aOnjg2ZgAxa6LHI= Authentication-Results: mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v3 6/7] qapi/block-core: deprecate block-job-change Date: Wed, 2 Oct 2024 17:06:15 +0300 Message-Id: <20241002140616.561652-7-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241002140616.561652-1-vsementsov@yandex-team.ru> References: <20241002140616.561652-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 X-Yandex-Filter: 1 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: USCQHSKTY5LANAEYI7QUESMTBIA2EZQK X-Message-ID-Hash: USCQHSKTY5LANAEYI7QUESMTBIA2EZQK X-MailFrom: vsementsov@yandex-team.ru X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 CC: qemu-devel@nongnu.org, armbru@redhat.com, eblake@redhat.com, devel@lists.libvirt.org, hreitz@redhat.com, kwolf@redhat.com, vsementsov@yandex-team.ru, jsnow@redhat.com, pkrempa@redhat.com X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZM-MESSAGEID: 1727878147497116600 Content-Type: text/plain; charset="utf-8" That's a first step to move on newer job-* APIs. The difference between block-job-change and job-change is in find_block_job_locked() vs find_job_locked() functions. What's different? 1. find_block_job_locked() finds only block jobs, whereas find_job_locked() finds any kind of job. job-change is a compatible extension of block-job-change. 2. find_block_job_locked() reports DeviceNotActive on failure, when find_job_locked() reports GenericError. Since the kind of error reported isn't documented for either command, and clients shouldn't rely on undocumented error details, job-change is a compatible replacement for block-job-change. Signed-off-by: Vladimir Sementsov-Ogievskiy Acked-by: Markus Armbruster --- docs/about/deprecated.rst | 5 +++++ qapi/block-core.json | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index 1e21fbbf77..d2461924ff 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -147,6 +147,11 @@ options are removed in favor of using explicit ``block= dev-create`` and ``blockdev-add`` calls. See :doc:`/interop/live-block-operations` for details. =20 +``block-job-change`` (since 9.2) +'''''''''''''''''''''''''''''''' + +Use ``job-change`` instead. + Incorrectly typed ``device_add`` arguments (since 6.2) '''''''''''''''''''''''''''''''''''''''''''''''''''''' =20 diff --git a/qapi/block-core.json b/qapi/block-core.json index e314734b53..ed87a9dc1e 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -3100,9 +3100,15 @@ # # Change the block job's options. # +# Features: +# +# @deprecated: This command is deprecated. Use @job-change +# instead. +# # Since: 8.2 ## { 'command': 'block-job-change', + 'features': ['deprecated'], 'data': 'JobChangeOptions', 'boxed': true } =20 ## --=20 2.34.1 From nobody Sun Nov 24 01:51:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1727878092; cv=none; d=zohomail.com; s=zohoarc; b=Z9hjYOqXSYsHAvUgPz5Ry593VylUudqOTVF2RbLXS2w8DxrSudWyWxKeyHKRVDwfLVGevt8EcApiMcI+WfknPBtNN1VB2XGwIhNa8HV3vDmqIS5pf2lgQCP0Lz/jKklSmp05iJJCNIggU/MhKFW1ycS9lZYS2UzL3xtkD+ETp24= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1727878092; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=nUfW9+n5gMdvo97scLOTQBwoE09RtGygkqKTIQ3Zdq4=; b=KqJKzCQbYwBvW+0Dhv1digj0WOG6/EidCx8qUy5CVhKQYOA7Oa9ymjJHWXcus3DqEmmnMJEXhrrYidzrnjNW8vhupJWXZXUSTaCo2ivMXGu5jMLiNnsLhb2+/1HaQL8HpdtKyCJbuEp7DjXJ0OHQ/3yzZS3cxbudweRLcn/+Myc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1727878092131977.5610480598265; Wed, 2 Oct 2024 07:08:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sw00j-0003Zx-NO; Wed, 02 Oct 2024 10:07:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sw00Q-0003T1-CZ; Wed, 02 Oct 2024 10:07:09 -0400 Received: from forwardcorp1d.mail.yandex.net ([178.154.239.200]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sw00G-000597-KZ; Wed, 02 Oct 2024 10:06:59 -0400 Received: from mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:2e8b:0:640:9795:0]) by forwardcorp1d.mail.yandex.net (Yandex) with ESMTPS id 9B93760A0D; Wed, 2 Oct 2024 17:06:52 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6b8:b081:8026::1:2f]) by mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id S6cR231IXeA0-jQ7dD87J; Wed, 02 Oct 2024 17:06:51 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1727878011; bh=nUfW9+n5gMdvo97scLOTQBwoE09RtGygkqKTIQ3Zdq4=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=I4upPakU3oUodLP+ft7zBx/CK0cayvvP1HWoL90AynntvwTYNuDFheOhwyRs56v8z 0OCp2Ji8VFslHHgAFrVqWJPsJNSpmni4Q9+fda0V1zHABK0Ggz4TpKvh5kn/eg0AM8 MFZmeKfm2qeAOBhLxyo4bt6UbPiG2YhIhNVVhViM= Authentication-Results: mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, armbru@redhat.com, eblake@redhat.com, devel@lists.libvirt.org, hreitz@redhat.com, kwolf@redhat.com, vsementsov@yandex-team.ru, jsnow@redhat.com, pkrempa@redhat.com Subject: [PATCH v3 7/7] iotests/mirror-change-copy-mode: switch to job-change command Date: Wed, 2 Oct 2024 17:06:16 +0300 Message-Id: <20241002140616.561652-8-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241002140616.561652-1-vsementsov@yandex-team.ru> References: <20241002140616.561652-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Yandex-Filter: 1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=178.154.239.200; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1d.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1727878093190116600 Content-Type: text/plain; charset="utf-8" block-job-change is deprecated, let's move test to job-change. Signed-off-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/tests/mirror-change-copy-mode | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qemu-iotests/tests/mirror-change-copy-mode b/tests/qemu-= iotests/tests/mirror-change-copy-mode index 51788b85c7..e972604ebf 100755 --- a/tests/qemu-iotests/tests/mirror-change-copy-mode +++ b/tests/qemu-iotests/tests/mirror-change-copy-mode @@ -150,7 +150,7 @@ class TestMirrorChangeCopyMode(iotests.QMPTestCase): len_before_change =3D result[0]['len'] =20 # Change the copy mode while requests are happening. - self.vm.cmd('block-job-change', + self.vm.cmd('job-change', id=3D'mirror', type=3D'mirror', copy_mode=3D'write-blocking') --=20 2.34.1