From patchwork Wed Jun 26 11:01:18 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: 1952513 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=FzEMkUcK; 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 4W8JhK5ZwPz20XB for ; Wed, 26 Jun 2024 21:02:57 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMQPo-0007WE-B2; Wed, 26 Jun 2024 07:02:17 -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 1sMQPa-0007NU-7p; Wed, 26 Jun 2024 07:02:02 -0400 Received: from forwardcorp1a.mail.yandex.net ([2a02:6b8:c0e:500: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 1sMQPN-0003S8-AG; Wed, 26 Jun 2024 07:02:01 -0400 Received: from mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:1c20:0:640:f632:0]) by forwardcorp1a.mail.yandex.net (Yandex) with ESMTPS id 4961160F20; Wed, 26 Jun 2024 14:01:42 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6b8:b081:b645::1:29]) by mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id P1OLrj0IhSw0-srdk9Kjn; Wed, 26 Jun 2024 14:01:41 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1719399701; bh=3rl+uciWGIPUd1ERqSb2x50cLBMGT2UEiDsSwV3IKR0=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=FzEMkUcK5CMmEB9DlsV58Zu+13WwgqF9CIQ/G7BEqyiLHrb8EFXhK7+xJ+1d6LBh0 2pRKgmWQP1PiHXe//9W4xhLAclkBWW/2niNLAUn2Bm9rhSGGl854wfO/A+6HAVHUD7 zMvi4j2l5BIjPpt0VDWZAFubDG1oypqfKjVYP9lQ= Authentication-Results: mail-nwsmtp-smtp-corp-main-66.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, f.ebner@proxmox.com Subject: [PATCH v2 1/7] qapi: rename BlockJobChangeOptions to JobChangeOptions Date: Wed, 26 Jun 2024 14:01:18 +0300 Message-Id: <20240626110124.374336-2-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240626110124.374336-1-vsementsov@yandex-team.ru> References: <20240626110124.374336-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Received-SPF: pass client-ip=2a02:6b8:c0e:500:1:45:d181:df01; 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, 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 835064ed03..3f4ed96ecc 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3248,7 +3248,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 df5e07debd..4ec5632596 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -3067,18 +3067,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. # @@ -3088,10 +3088,10 @@ # # Since: 8.2 ## -{ 'union': 'BlockJobChangeOptions', +{ 'union': 'JobChangeOptions', 'base': { 'id': 'str', 'type': 'JobType' }, 'discriminator': 'type', - 'data': { 'mirror': 'BlockJobChangeOptionsMirror' } } + 'data': { 'mirror': 'JobChangeOptionsMirror' } } ## # @block-job-change: @@ -3101,7 +3101,7 @@ # Since: 8.2 ## { 'command': 'block-job-change', - 'data': 'BlockJobChangeOptions', 'boxed': true } + 'data': 'JobChangeOptions', 'boxed': true } ## # @BlockdevDiscardOptions: From patchwork Wed Jun 26 11:01:19 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: 1952517 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=Mo96yZCQ; 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 4W8JhT4t6dz23tx for ; Wed, 26 Jun 2024 21:03:05 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMQPf-0007Nr-5j; Wed, 26 Jun 2024 07:02:07 -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 1sMQPZ-0007Mt-4e; Wed, 26 Jun 2024 07:02:01 -0400 Received: from forwardcorp1a.mail.yandex.net ([2a02:6b8:c0e:500: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 1sMQPN-0003SB-V8; Wed, 26 Jun 2024 07:02:00 -0400 Received: from mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:1c20:0:640:f632:0]) by forwardcorp1a.mail.yandex.net (Yandex) with ESMTPS id 41CE560F26; Wed, 26 Jun 2024 14:01:43 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6b8:b081:b645::1:29]) by mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id P1OLrj0IhSw0-KSAtZ5z3; Wed, 26 Jun 2024 14:01:42 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1719399702; bh=yLJaDyEAelrXRgY1Ri4RSUibfQW2G7z/Oefqj6dQnvE=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=Mo96yZCQ/1SFBUFGK3JAyEq6j0LP4H45Fin122S9d7lLnHuyAYnHIhpB4yul9Pr3u gSTq7yEO3nBgid1rnE0syKgVzzjVJt0lRjErK9Mpii8EKjUusky8QPtB+it1hhHx55 C/Me7UxCHrzcxheYQXanx1YKFROmN6H6Mg3mw27Y= Authentication-Results: mail-nwsmtp-smtp-corp-main-66.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, f.ebner@proxmox.com Subject: [PATCH v2 2/7] blockjob: block_job_change_locked(): check job type Date: Wed, 26 Jun 2024 14:01:19 +0300 Message-Id: <20240626110124.374336-3-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240626110124.374336-1-vsementsov@yandex-team.ru> References: <20240626110124.374336-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Received-SPF: pass client-ip=2a02:6b8:c0e:500:1:45:d181:df01; 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, 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 Jun 26 11:01:20 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: 1952510 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=qMJ57jZk; 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 4W8Jh0097bz23tx for ; Wed, 26 Jun 2024 21:02:40 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMQPW-0007LS-I7; Wed, 26 Jun 2024 07:01:58 -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 1sMQPT-0007JR-6R; Wed, 26 Jun 2024 07:01:56 -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 1sMQPN-0003SE-58; Wed, 26 Jun 2024 07:01:54 -0400 Received: from mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:1c20:0:640:f632:0]) by forwardcorp1a.mail.yandex.net (Yandex) with ESMTPS id 1006760F2C; Wed, 26 Jun 2024 14:01:44 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6b8:b081:b645::1:29]) by mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id P1OLrj0IhSw0-2j1SLQRl; Wed, 26 Jun 2024 14:01:43 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1719399703; bh=IP/7c3urCxtxEZ5EuganaMwu2l+duCJlhM4632kUDA4=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=qMJ57jZkyuPAz6fZAMg5vgIx2jy2PrlxNzjl2oUZODtBKlNMnb07ojKyus47rLIGN uo6M0AXRk49mf8qooFfmN9eCYTiBMlP4hi5rm5YLsnA3Xt4CD3+9fzdBhd8+nvzMin j4oLXzSHinv/c9dFyT4eWM167aBoksUamQMdEmC8= Authentication-Results: mail-nwsmtp-smtp-corp-main-66.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, f.ebner@proxmox.com Subject: [PATCH v2 3/7] qapi: block-job-change: make copy-mode parameter optional Date: Wed, 26 Jun 2024 14:01:20 +0300 Message-Id: <20240626110124.374336-4-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240626110124.374336-1-vsementsov@yandex-team.ru> References: <20240626110124.374336-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 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, 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 4ec5632596..660c7f4a48 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -3071,11 +3071,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.1) # # Since: 8.2 ## { 'struct': 'JobChangeOptionsMirror', - 'data': { 'copy-mode' : 'MirrorCopyMode' } } + 'data': { '*copy-mode' : 'MirrorCopyMode' } } ## # @JobChangeOptions: From patchwork Wed Jun 26 11:01:21 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: 1952511 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=cnBWjYJW; 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 4W8Jgy4z0Sz20Z9 for ; Wed, 26 Jun 2024 21:02:38 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMQPU-0007JV-BO; Wed, 26 Jun 2024 07:01:56 -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 1sMQPQ-0007HV-PL; Wed, 26 Jun 2024 07:01:52 -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 1sMQPN-0003Sw-FW; Wed, 26 Jun 2024 07:01:52 -0400 Received: from mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:1c20:0:640:f632:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTPS id 0E01460E6C; Wed, 26 Jun 2024 14:01:45 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6b8:b081:b645::1:29]) by mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id P1OLrj0IhSw0-x0CiCtM0; Wed, 26 Jun 2024 14:01:44 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1719399704; bh=M9QLlgVl1rEDCvXSutZIhhYEpJ6yfKw6GNi+c5tgUNE=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=cnBWjYJWCBQLi3/cj5cnkF8j2E/yYr+Me7lNQX1ihov+QoJ75ia+72ZaKGOJPz+0L 25SYKk2ns0f23uz7XUovP8EwlGDiLpysBaGbtzY9dszpEbTVqBYlj4NabGt4uPaa2G NOOu83e1liObzdHrkF3hB7z6ovfG+XGZ3a1kja+0= Authentication-Results: mail-nwsmtp-smtp-corp-main-66.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, f.ebner@proxmox.com Subject: [PATCH v2 4/7] blockjob: move change action implementation to job from block-job Date: Wed, 26 Jun 2024 14:01:21 +0300 Message-Id: <20240626110124.374336-5-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240626110124.374336-1-vsementsov@yandex-team.ru> References: <20240626110124.374336-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 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, 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 3f4ed96ecc..70b6aeaef0 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3259,7 +3259,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 Jun 26 11:01:22 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: 1952515 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=umpyJzcb; 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 4W8JhT0qfTz20XB for ; Wed, 26 Jun 2024 21:03:05 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMQPU-0007Jr-ED; Wed, 26 Jun 2024 07:01:56 -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 1sMQPQ-0007HS-KA; Wed, 26 Jun 2024 07:01:52 -0400 Received: from forwardcorp1a.mail.yandex.net ([2a02:6b8:c0e:500: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 1sMQPO-0003T1-2M; Wed, 26 Jun 2024 07:01:52 -0400 Received: from mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:1c20:0:640:f632:0]) by forwardcorp1a.mail.yandex.net (Yandex) with ESMTPS id E487360FFA; Wed, 26 Jun 2024 14:01:45 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6b8:b081:b645::1:29]) by mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id P1OLrj0IhSw0-sjZJRBfV; Wed, 26 Jun 2024 14:01:45 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1719399705; bh=RAdGbjw8jWaNGlxum2xCcLhksdDMguJMiaah0374otc=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=umpyJzcbEkPy0k06DfeK3SQ4+aCFlcYJ7zJkKNuyrs1tGnp+HktZVW6sKrs4zVhQp lzWtOICv3PFrsSKcJkhcJDiSWhgCXDPYCvmWYRA+f778wgbeTYjDMy0KUvgz+OHjBb hnazO+WvOdFGTswyGd0m+OQSbtw86mYXp4FDv224= Authentication-Results: mail-nwsmtp-smtp-corp-main-66.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, f.ebner@proxmox.com Subject: [PATCH v2 5/7] qapi: add job-change Date: Wed, 26 Jun 2024 14:01:22 +0300 Message-Id: <20240626110124.374336-6-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240626110124.374336-1-vsementsov@yandex-team.ru> References: <20240626110124.374336-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Received-SPF: pass client-ip=2a02:6b8:c0e:500:1:45:d181:df01; 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, 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. @type argument of the new command immediately becomes deprecated. 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 660c7f4a48..9087ce300c 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -3104,6 +3104,16 @@ { 'command': 'block-job-change', 'data': 'JobChangeOptions', 'boxed': true } +## +# @job-change: +# +# Change the block job's options. +# +# Since: 9.1 +## +{ 'command': 'job-change', + 'data': 'JobChangeOptions', 'boxed': true } + ## # @BlockdevDiscardOptions: # From patchwork Wed Jun 26 11:01:23 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: 1952512 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=pDKhIkhx; 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 4W8Jgy4wM8z20XB for ; Wed, 26 Jun 2024 21:02:38 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMQPV-0007KK-6C; Wed, 26 Jun 2024 07:01:57 -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 1sMQPS-0007IC-3j; Wed, 26 Jun 2024 07:01:54 -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 1sMQPO-0003UL-5y; Wed, 26 Jun 2024 07:01:53 -0400 Received: from mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:1c20:0:640:f632:0]) by forwardcorp1d.mail.yandex.net (Yandex) with ESMTPS id D82FF608F3; Wed, 26 Jun 2024 14:01:46 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6b8:b081:b645::1:29]) by mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id P1OLrj0IhSw0-fGfY6Lgs; Wed, 26 Jun 2024 14:01:46 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1719399706; bh=LcubyWEWFy2+UuOK//gtYKqylWSkxYKpq14G/wxjwKU=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=pDKhIkhxAPwcFDSiJakJmU1TgQLCXK2H4E/S4FLnm5FZPMHlmjw4tZJCos8x+adA9 63wXpwllBKG+14NGW4RFJWiT5e2duQwN/m3EUvC0+RexiYbu4KCsdtIQ1jNT++nS61 2RnO6AjltRzxPjoAm1XchhVNezV2y2BGAdHeSC24= Authentication-Results: mail-nwsmtp-smtp-corp-main-66.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, f.ebner@proxmox.com Subject: [PATCH v2 6/7] qapi/block-core: derpecate block-job-change Date: Wed, 26 Jun 2024 14:01:23 +0300 Message-Id: <20240626110124.374336-7-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240626110124.374336-1-vsementsov@yandex-team.ru> References: <20240626110124.374336-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 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() do check, is found job a block-job. This OK when moving to more generic API, no needs to document this change. 2. find_block_job_locked() reports DeviceNotActive on failure, when find_job_locked() reports GenericError. Still, for block-job-change errors are not documented at all, so be silent in deprecated.txt as well. 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 ff3da68208..0ddced0781 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -134,6 +134,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.1) +'''''''''''''''''''''''''''''''' + +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 9087ce300c..064cad0b64 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -3099,9 +3099,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 Jun 26 11:01:24 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: 1952514 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=WkZtbKRp; 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 4W8JhR629sz20XB for ; Wed, 26 Jun 2024 21:03:03 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMQPW-0007Kz-46; Wed, 26 Jun 2024 07:01:58 -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 1sMQPU-0007Jp-9o; Wed, 26 Jun 2024 07:01:56 -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 1sMQPO-0003UM-G1; Wed, 26 Jun 2024 07:01:55 -0400 Received: from mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:1c20:0:640:f632:0]) by forwardcorp1d.mail.yandex.net (Yandex) with ESMTPS id A9686608F5; Wed, 26 Jun 2024 14:01:47 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6b8:b081:b645::1:29]) by mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id P1OLrj0IhSw0-uxKqHE0u; Wed, 26 Jun 2024 14:01:47 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1719399707; bh=nUfW9+n5gMdvo97scLOTQBwoE09RtGygkqKTIQ3Zdq4=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=WkZtbKRpkbOpTRouRiAdapJSVOLbJ1svJqo2TgARvJR8uuiUiK+e8p+Fae6AJR+P1 O/drhmtVcmtB07NPEJIEBDpBcVPIX9MrKxEVxr6NhFdORltktPoqlM7uiw2v5r3kUj T1/TeGazq+6f3exzIohOxnZ3AAF/rM1WQrw0dlLo= Authentication-Results: mail-nwsmtp-smtp-corp-main-66.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, f.ebner@proxmox.com Subject: [PATCH v2 7/7] iotests/mirror-change-copy-mode: switch to job-change command Date: Wed, 26 Jun 2024 14:01:24 +0300 Message-Id: <20240626110124.374336-8-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240626110124.374336-1-vsementsov@yandex-team.ru> References: <20240626110124.374336-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 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 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')