From nobody Mon Sep 16 19:09:10 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=1719399776; cv=none; d=zohomail.com; s=zohoarc; b=GZBHYVqYWt1o9Jxvk50bIyDiYZojxALAm9DvGbV4FjIubbtihYoyl19gNl13d09aL55mRT0IZJudHme/Xm06Y95BJDgXjVQyypvFfAxXt1uWJCV3QvGLy0w1HiBc70+6XOjAazRtEj+9seWvcidLffr9RqGgpej0x3rEgwNnF8s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719399776; 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=3rl+uciWGIPUd1ERqSb2x50cLBMGT2UEiDsSwV3IKR0=; b=CtYZ4F1jmIqRYH2M0kxO+xxmU53FFBv8fW4jH88nXjHCUeT3OuVaMHeePHL4t97kRHl6n+Jl68crHTt2logTLIRDldTSdfkbwcH0UgngTevZaoXHGoWp3OGoSBxDGkF9jmR5XRojRsEp+vZZM7V0Bu/11Ggl3bAJhM7jgckqA78= 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 171939977687926.20598400145593; Wed, 26 Jun 2024 04:02:56 -0700 (PDT) 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 Content-Transfer-Encoding: quoted-printable 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=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+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: 1719399778136100003 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 835064ed03..3f4ed96ecc 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3248,7 +3248,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 df5e07debd..4ec5632596 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -3067,18 +3067,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. # @@ -3088,10 +3088,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: @@ -3101,7 +3101,7 @@ # Since: 8.2 ## { 'command': 'block-job-change', - 'data': 'BlockJobChangeOptions', 'boxed': true } + 'data': 'JobChangeOptions', 'boxed': true } =20 ## # @BlockdevDiscardOptions: --=20 2.34.1 From nobody Mon Sep 16 19:09:10 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=1719399784; cv=none; d=zohomail.com; s=zohoarc; b=B8hceY0jhQnAx4swRVtbbRBSSqhfD6sYXg4GdL/LCTzM9Sh7VflKxyE9pR8oizrpCssFRDmJQ4z3pNzmPVKF5h1hyv7s06zVIH12Hx2Y9NaVZKZhSfJTnH9K+Z/JDT5VW/ROAVOs1TCBGy6+fCie8C/ANm+Yu2RLxaEYkfs7tWg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719399784; 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=yLJaDyEAelrXRgY1Ri4RSUibfQW2G7z/Oefqj6dQnvE=; b=fXbuz7RhDcHzxViJODppuJnTHf6q+VSLyWmYnqIZ+ewNZ36gU26CvsVlVLBpvQGf+sfdo4pJP/UxWaEXDGUQ3D2twO7GbdBxQB4qtW+DbZZEbm9Xi+IueFr6E3sW+H3apk9w8vORLRME4Fumx5dVymbBXgjSPXS96FzTsOEZdqo= 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 1719399784755961.9579355442213; Wed, 26 Jun 2024 04:03:04 -0700 (PDT) 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 Content-Transfer-Encoding: quoted-printable 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=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+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: 1719399785688100010 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 Mon Sep 16 19:09:10 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=1719399759; cv=none; d=zohomail.com; s=zohoarc; b=C64HUHWVZMPUj3/uIthRmtdNEiIHJsNrfgbwGU6r2BkfvmL+AEY4C80yqSqt+72xhJmPkrlIGkNMtKpN12Ou5Fs435y+1/SFEGjMfnyI/LOldt6AEk0yUvRbydujyqqeIbxO5J+YTIzRStmil4d49xdhkqv2cZfp6e0oDFlmdjg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719399759; 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=IP/7c3urCxtxEZ5EuganaMwu2l+duCJlhM4632kUDA4=; b=P6nsAEz/+K/LVCZpG+EEqUhqqv5mEEk4+ohhErMQ3bMEsrtIG4m3pCeIeumfKVop1pU3qKFSOOX+dR15ws8PnfXIcLsOEeKJLmZoTLUHB8vjnUjhLdJJO6zY3JwD9IyJ4RXi3hcqnGfyPVYKyCrhDEP6vrimTL4mSfsZyCxym2Y= 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 1719399759348692.3096708086168; Wed, 26 Jun 2024 04:02:39 -0700 (PDT) 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 Content-Transfer-Encoding: quoted-printable 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.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+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: 1719399760223100003 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 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' } } =20 ## # @JobChangeOptions: --=20 2.34.1 From nobody Mon Sep 16 19:09:10 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=1719399758; cv=none; d=zohomail.com; s=zohoarc; b=mXvohzVeO6S8LJSkK0TF9nAV6oix1+LdyyhOb4cIstiTXEYD69sVeDs3QYeEpj514vk2NjyzA33IcDEJVnMpHPpSAIaYBx2vVMEMSZGHU6aCfYYfRejO+o/+dNe3nw/W0RPUSIGQKIZWa+pvXdKqUSkHfWOp0Lrn8KYGTvO1UGU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719399758; 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=M9QLlgVl1rEDCvXSutZIhhYEpJ6yfKw6GNi+c5tgUNE=; b=k0LA4WXpDxaifTljzlcXcsUHNx9xdgQB0PvDpzhNmZy7F3gEz57kwfYp/GQ1oZcEnIEatb6lzZFySUhz4EbbK5hZUuGtjRK4D1qJXXNwtsgS8wLOwqatDorprCa81MHUkymZUDm8hIIJoUr4g54PJ3AsBm8eNBB2p3kD2Gwv9r8= 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 1719399757737129.84793216147057; Wed, 26 Jun 2024 04:02:37 -0700 (PDT) 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 Content-Transfer-Encoding: quoted-printable 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, 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: 1719399760273100007 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 3f4ed96ecc..70b6aeaef0 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3259,7 +3259,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 Mon Sep 16 19:09:10 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=1719399784; cv=none; d=zohomail.com; s=zohoarc; b=mpZc/IK4Xdj9HHZMKnZxqJCxg1vdC7XEpPNbwpjoG7HD7WG3Oy3bTKTBqejTRAzoszPLdhhhV4bdxFppU/NtJUI5BbMeuO/h7bFolhPdepqUKpEvjVBqr02HfrPKzBehxBd3NzwJUGi1IgwD/iiILKi8O7gYODMQmifBBPqWG3w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719399784; 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=RAdGbjw8jWaNGlxum2xCcLhksdDMguJMiaah0374otc=; b=R5cx6HC10AD96NcxbVMI9LWyN6435pznH5v3lLSMKatPMCqz/3NEoSOssbDuhBy3BvQWVRgrcQC340tynZ8MRjcBid8bdx4oly+NlMhTOmipdw7PsxxqJx2oJO/uPoH8n6Zwhan1U2jgnI1QLoAu4Tdsj/w/yUTBN2IFEknJU4g= 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 1719399784221147.67476878446166; Wed, 26 Jun 2024 04:03:04 -0700 (PDT) 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 Content-Transfer-Encoding: quoted-printable 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=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+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: 1719399785691100012 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. @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); } =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 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 } =20 +## +# @job-change: +# +# Change the block job's options. +# +# Since: 9.1 +## +{ 'command': 'job-change', + 'data': 'JobChangeOptions', 'boxed': true } + ## # @BlockdevDiscardOptions: # --=20 2.34.1 From nobody Mon Sep 16 19:09:10 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=1719399758; cv=none; d=zohomail.com; s=zohoarc; b=XGGcnimIPLbuaVDEx03wyAZwxp0/YoWSeQsnvUmDfjbTSaac9+uLSOwXVFWLb62g5jzWt1B2bIIcwd9Z2vA7kwx0oShfI05UKqn2H4xppqkIpES6vl94XMsmzGheMzPJLP7JBB7GclIGctFirJBawDGTwQZV0xdKvp1XOI/NONY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719399758; 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=LcubyWEWFy2+UuOK//gtYKqylWSkxYKpq14G/wxjwKU=; b=gIHD52hGujFlLzwRYtw303wfeOy1LVdxMGKhLzkv5vyR1J3Qk1nUWQs9X8091HEXq0kkDayy8wxr6bPQPmrbvQGk+/s+Fj9Snoc8LOaeO6213mutYlL98TkOkz8MuSgfruAg1wrhXo0i0ZW3VcchkTEeHYMdgzuL6uPny0raj2U= 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 1719399757700726.8058966545491; Wed, 26 Jun 2024 04:02:37 -0700 (PDT) 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 Content-Transfer-Encoding: quoted-printable 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=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+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: 1719399760363100009 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() 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 ``block= dev-create`` and ``blockdev-add`` calls. See :doc:`/interop/live-block-operations` for details. =20 +``block-job-change`` (since 9.1) +'''''''''''''''''''''''''''''''' + +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 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 } =20 ## --=20 2.34.1 From nobody Mon Sep 16 19:09:10 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=1719399783; cv=none; d=zohomail.com; s=zohoarc; b=UpTsHDDg0Wm3fMrLpBD6P0Y45DoKg5An6AUCa4AxRKshr+Uk76c+Cpa6rFJ9GKdOHPi02H5ObV8/n2xH7f1nTtuXyJf5dEesEw1MMDL5KOfOFRtGC8bTjeMuKDJoPTb93akrx1quyJ5DjpVjvdhUtB/a7exzX87NLqac/Z5+yGc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719399783; 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=OikWExsu+5CiIge8CTC+v5ibyjzvcA5Zn9pGR8G3Q1zh5hva7K5r6z/tRrBLIL8HsuRNJMk0H0/iClY8Ub9oKAe3XSBTaqJEZ4xKUoxYMNVrIZQogE5ey1a+qpVbdkg2PI3VZXrpHHo3QWcH2WdzL3mOMQ3Coi0M3rFjibZ7mNE= 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 1719399782943629.0770517527287; Wed, 26 Jun 2024 04:03:02 -0700 (PDT) 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 Content-Transfer-Encoding: quoted-printable 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=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+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: 1719399785683100009 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