From patchwork Wed Oct 2 14:06:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 1992037 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=yandex-team.ru header.i=@yandex-team.ru header.a=rsa-sha256 header.s=default header.b=HHbwSQ0K; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XJc9j0wfkz1xt1 for ; Thu, 3 Oct 2024 00:08:57 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sw00p-0003m0-DT; Wed, 02 Oct 2024 10:07:31 -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-0003T2-EN; Wed, 02 Oct 2024 10:07:09 -0400 Received: from forwardcorp1d.mail.yandex.net ([2a02:6b8:c41:1300:1:45:d181:df01]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sw00G-00056D-8z; 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 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-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 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 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 Received-SPF: pass client-ip=2a02:6b8:c41:1300:1:45:d181:df01; 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, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 force) return force || !job_is_ready(job); } -static void mirror_change(BlockJob *job, BlockJobChangeOptions *opts, +static void mirror_change(BlockJob *job, JobChangeOptions *opts, Error **errp) { MirrorBlockJob *s = container_of(job, MirrorBlockJob, common); - BlockJobChangeOptionsMirror *change_opts = &opts->u.mirror; + JobChangeOptionsMirror *change_opts = &opts->u.mirror; MirrorCopyMode current; /* 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 **errp) job_dismiss_locked(&job, errp); } -void qmp_block_job_change(BlockJobChangeOptions *opts, Error **errp) +void qmp_block_job_change(JobChangeOptions *opts, Error **errp) { BlockJob *job; 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); } -void block_job_change_locked(BlockJob *job, BlockJobChangeOptions *opts, +void block_job_change_locked(BlockJob *job, JobChangeOptions *opts, Error **errp) { const BlockJobDriver *drv = 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); /** 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 running. */ - void (*change)(BlockJob *job, BlockJobChangeOptions *opts, Error **errp); + void (*change)(BlockJob *job, JobChangeOptions *opts, Error **errp); /* * 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 } ## -# @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' } } ## -# @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' } } ## # @block-job-change: @@ -3102,7 +3102,7 @@ # Since: 8.2 ## { 'command': 'block-job-change', - 'data': 'BlockJobChangeOptions', 'boxed': true } + 'data': 'JobChangeOptions', 'boxed': true } ## # @BlockdevDiscardOptions: From patchwork Wed Oct 2 14:06:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 1992038 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=yandex-team.ru header.i=@yandex-team.ru header.a=rsa-sha256 header.s=default header.b=W+y8xb/7; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XJc9w1kczz1xt1 for ; Thu, 3 Oct 2024 00:09:08 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sw00p-0003ms-Tz; Wed, 02 Oct 2024 10:07:31 -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-0003T6-GH; Wed, 02 Oct 2024 10:07:09 -0400 Received: from forwardcorp1d.mail.yandex.net ([2a02:6b8:c41:1300:1:45:d181:df01]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sw00G-000573-8t; 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 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-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 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 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 Received-SPF: pass client-ip=2a02:6b8:c41:1300:1:45:d181:df01; 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, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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, JobChangeOptions *opts, GLOBAL_STATE_CODE(); + if (job_type(&job->job) != 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; } From patchwork Wed Oct 2 14:06:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 1992039 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=yandex-team.ru header.i=@yandex-team.ru header.a=rsa-sha256 header.s=default header.b=RmXZxyEY; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XJc9w2fHhz1xtn for ; Thu, 3 Oct 2024 00:09:08 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sw00l-0003dK-8o; Wed, 02 Oct 2024 10:07:27 -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-0003Sz-CR; Wed, 02 Oct 2024 10:07:09 -0400 Received: from forwardcorp1a.mail.yandex.net ([178.154.239.72]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sw00G-000574-8q; 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 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-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 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 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 Received-SPF: pass client-ip=178.154.239.72; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1a.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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, JobChangeOptions *opts, GLOBAL_STATE_CODE(); + if (!change_opts->has_copy_mode) { + return; + } + if (qatomic_read(&s->copy_mode) == 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' } } ## # @JobChangeOptions: From patchwork Wed Oct 2 14:06:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 1992033 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=yandex-team.ru header.i=@yandex-team.ru header.a=rsa-sha256 header.s=default header.b=J6xqOmO9; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XJc8h1kkgz1xt1 for ; Thu, 3 Oct 2024 00:08:04 +1000 (AEST) 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 X-Yandex-Filter: 1 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 force) return force || !job_is_ready(job); } -static void mirror_change(BlockJob *job, JobChangeOptions *opts, - Error **errp) +static void mirror_change(Job *job, JobChangeOptions *opts, Error **errp) { - MirrorBlockJob *s = container_of(job, MirrorBlockJob, common); + MirrorBlockJob *s = container_of(job, MirrorBlockJob, common.job); JobChangeOptionsMirror *change_opts = &opts->u.mirror; MirrorCopyMode current; @@ -1316,9 +1315,9 @@ static const BlockJobDriver mirror_job_driver = { .pause = mirror_pause, .complete = mirror_complete, .cancel = mirror_cancel, + .change = mirror_change, }, .drained_poll = mirror_drained_poll, - .change = mirror_change, .query = mirror_query, }; 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, Error **errp) return; } - block_job_change_locked(job, opts, errp); + job_change_locked(&job->job, opts, errp); } 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); } -void block_job_change_locked(BlockJob *job, JobChangeOptions *opts, - Error **errp) -{ - const BlockJobDriver *drv = block_job_driver(job); - - GLOBAL_STATE_CODE(); - - if (job_type(&job->job) != 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, BlockDriverState *bs); */ bool block_job_set_speed_locked(BlockJob *job, int64_t speed, Error **errp); -/** - * 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 { void (*set_speed)(BlockJob *job, int64_t speed); - /* - * Change the @job's options according to @opts. - * - * Note that this can already be called before the job coroutine is running. - */ - 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 #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); + /** + * Change the @job's options according to @opts. + * + * Note that this can already be called before the job coroutine is running. + */ + void (*change)(Job *job, JobChangeOptions *opts, Error **errp); /** * 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); +/** + * 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 called 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" 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) != 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"); + } +} From patchwork Wed Oct 2 14:06:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 1992035 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=yandex-team.ru header.i=@yandex-team.ru header.a=rsa-sha256 header.s=default header.b=y9GWCS3D; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XJc8z5W5Zz1xt1 for ; Thu, 3 Oct 2024 00:08:19 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sw00m-0003hW-G9; Wed, 02 Oct 2024 10:07:28 -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-0003Sy-C5; Wed, 02 Oct 2024 10:07:09 -0400 Received: from forwardcorp1d.mail.yandex.net ([2a02:6b8:c41:1300:1:45:d181:df01]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sw00G-00058H-9M; Wed, 02 Oct 2024 10:07:00 -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 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-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 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 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 Received-SPF: pass client-ip=2a02:6b8:c41:1300:1:45:d181:df01; 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, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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); } +void qmp_job_change(JobChangeOptions *opts, Error **errp) +{ + Job *job; + + JOB_LOCK_GUARD(); + job = 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 } +## +# @job-change: +# +# Change the block job's options. +# +# Since: 9.2 +## +{ 'command': 'job-change', + 'data': 'JobChangeOptions', 'boxed': true } + ## # @BlockdevDiscardOptions: # From patchwork Wed Oct 2 14:06:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 1992036 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=yandex-team.ru header.i=@yandex-team.ru header.a=rsa-sha256 header.s=default header.b=sTRFIPw8; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XJc9N3lckz1xt1 for ; Thu, 3 Oct 2024 00:08:40 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sw00k-0003b1-O0; 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-0003T5-GD; Wed, 02 Oct 2024 10:07:09 -0400 Received: from forwardcorp1d.mail.yandex.net ([2a02:6b8:c41:1300:1:45:d181:df01]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sw00G-00058p-U4; Wed, 02 Oct 2024 10:07:05 -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 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-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 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 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 Received-SPF: pass client-ip=2a02:6b8:c41:1300:1:45:d181:df01; 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, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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 ``blockdev-create`` and ``blockdev-add`` calls. See :doc:`/interop/live-block-operations` for details. +``block-job-change`` (since 9.2) +'''''''''''''''''''''''''''''''' + +Use ``job-change`` instead. + Incorrectly typed ``device_add`` arguments (since 6.2) '''''''''''''''''''''''''''''''''''''''''''''''''''''' 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 } ## From patchwork Wed Oct 2 14:06:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 1992034 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=yandex-team.ru header.i=@yandex-team.ru header.a=rsa-sha256 header.s=default header.b=I4upPakU; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XJc8s09Ctz1xt1 for ; Thu, 3 Oct 2024 00:08:13 +1000 (AEST) 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 X-Yandex-Filter: 1 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 = result[0]['len'] # Change the copy mode while requests are happening. - self.vm.cmd('block-job-change', + self.vm.cmd('job-change', id='mirror', type='mirror', copy_mode='write-blocking')