From nobody Tue Mar 24 01:20:11 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1773853700; cv=none; d=zohomail.com; s=zohoarc; b=RIk2Oa2+Z0jNGPIJBNHAKalfKj+0uqgLyJU8CWaylOV0LuLlIy7ljdZyOCMJGFCzAQwKhBQDLAO0nb3J15O65xWgcTD3keCf7k0fKi7STtwfPBKaJ4xkkK7kHebsogOoXhZNfUPRdCYWDy6opO4j2uoMuOYXFtIB+fSAhmdEt3E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773853700; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=/QUgbfYzLYn9A3PttJfeJYAFG3FxF++bYV0kfTtZgCg=; b=iwEdZxJbzb9wnCj2Wrcgtj+9JRbRZ8Hc/zZVMtp33PVNKde0GeICbOkm3Nx3d4cpIqfDv7VDSGM9KaLH+QAraIh03BU8fCvtU51JMk9H+KhuQLtVDb7VSJqoX5D1NMDVYIz3n/hTCrv6XugFagi2I3/vDOp9wbXsU7KDMd96ByA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1773853700818100.57777398101632; Wed, 18 Mar 2026 10:08:20 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id E754F3F831; Wed, 18 Mar 2026 13:08:19 -0400 (EDT) Received: from [172.19.199.12] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 28F2641BA9; Wed, 18 Mar 2026 13:05:10 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id CE62F3F31F; Wed, 18 Mar 2026 13:05:03 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 5A79C3F328 for ; Wed, 18 Mar 2026 13:05:03 -0400 (EDT) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-540-_6yo5daPPlavZfzHbNjLDA-1; Wed, 18 Mar 2026 13:05:01 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id ED3811800281 for ; Wed, 18 Mar 2026 17:05:00 +0000 (UTC) Received: from speedmetal.openshiftapps.com (unknown [10.45.242.5]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4858A30001A1 for ; Wed, 18 Mar 2026 17:05:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HELO_MISC_IP,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773853503; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/QUgbfYzLYn9A3PttJfeJYAFG3FxF++bYV0kfTtZgCg=; b=dfiaew0QNFEXfm2F9eiCRcc6kTbUqaTyWbDPaPi7j/C2RqmWVc0sLLkq/qDQf1LZVu1sXG URWKI1NNag2zVZEB5RqRumrNlztyq7GYuV1zOS04Gj9Kvzl/gOvn90788xtFHBl/+HY2Os 60ePzd2OXGLJSI3LhznRfUjGFy4EXeI= X-MC-Unique: _6yo5daPPlavZfzHbNjLDA-1 X-Mimecast-MFC-AGG-ID: _6yo5daPPlavZfzHbNjLDA_1773853501 To: devel@lists.libvirt.org Subject: [PATCH 3/7] qemu: monitor: Add support for 'target-is-zero' option of 'blockdev-mirror' Date: Wed, 18 Mar 2026 18:04:51 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: B-ClZVwp0KiDM9RvMsTYy3-vMlwBrrNG0tAP7rgEsEw_1773853501 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: XU36MGBCENVLZLXH6Q7WGOSZQZQZBACC X-Message-ID-Hash: XU36MGBCENVLZLXH6Q7WGOSZQZQZBACC X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1773853703058158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Signed-off-by: Peter Krempa --- src/qemu/qemu_driver.c | 2 +- src/qemu/qemu_migration.c | 2 +- src/qemu/qemu_monitor.c | 9 +++++---- src/qemu/qemu_monitor.h | 3 ++- src/qemu/qemu_monitor_json.c | 4 +++- src/qemu/qemu_monitor_json.h | 3 ++- tests/qemumonitorjsontest.c | 2 +- 7 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 8b148b33b4..0ba40e0665 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14535,7 +14535,7 @@ qemuDomainBlockCopyCommon(virDomainObj *vm, qemuBlockStorageSourceGetEffectiveNode= name(disk->src), bandwidth, granularity, buf_size, mirror_shallow, - syncWrites); + syncWrites, false); virDomainAuditDisk(vm, NULL, mirror, "mirror", ret >=3D 0); qemuDomainObjExitMonitor(vm); diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 4d136e259b..bb62b1d48c 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1173,7 +1173,7 @@ qemuMigrationSrcNBDStorageCopyBlockdev(virDomainObj *= vm, qemuBlockStorageSourceGetEffec= tiveNodename(copysrc), NULL, mirror_speed, 0, 0, mirror_sha= llow, - syncWrites); + syncWrites, false); if (mon_ret !=3D 0) qemuBlockStorageSourceAttachRollback(qemuDomainGetMonitor(vm), dat= a); diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index b94aaf741b..ef83e7b69a 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2845,18 +2845,19 @@ qemuMonitorBlockdevMirror(qemuMonitor *mon, unsigned int granularity, unsigned long long buf_size, bool shallow, - bool syncWrite) + bool syncWrite, + bool targetIsZero) { VIR_DEBUG("jobname=3D%s, persistjob=3D%d, device=3D%s, target=3D%s, re= places=3D%s, bandwidth=3D%lld, " - "granularity=3D%#x, buf_size=3D%lld, shallow=3D%d syncWrite= =3D%d", + "granularity=3D%#x, buf_size=3D%lld, shallow=3D%d syncWrite= =3D%d targetIsZero=3D%d", NULLSTR(jobname), persistjob, device, target, NULLSTR(replac= es), - bandwidth, granularity, buf_size, shallow, syncWrite); + bandwidth, granularity, buf_size, shallow, syncWrite, target= IsZero); QEMU_CHECK_MONITOR(mon); return qemuMonitorJSONBlockdevMirror(mon, jobname, persistjob, device,= target, replaces, bandwidth, granularity, buf_size,= shallow, - syncWrite); + syncWrite, targetIsZero); } diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index d3611d9713..dfa25fc7ba 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1245,7 +1245,8 @@ qemuMonitorBlockdevMirror(qemuMonitor *mon, unsigned int granularity, unsigned long long buf_size, bool shallow, - bool syncWrite) + bool syncWrite, + bool targetIsZero) ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5); int diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index f9b0470ed4..532bb885a3 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -4301,7 +4301,8 @@ qemuMonitorJSONBlockdevMirror(qemuMonitor *mon, unsigned int granularity, unsigned long long buf_size, bool shallow, - bool syncWrite) + bool syncWrite, + bool targetIsZero) { g_autoptr(virJSONValue) cmd =3D NULL; g_autoptr(virJSONValue) reply =3D NULL; @@ -4333,6 +4334,7 @@ qemuMonitorJSONBlockdevMirror(qemuMonitor *mon, "S:copy-mode", copymode, "T:auto-finalize", autofinalize, "T:auto-dismiss", autodismiss, + "B:target-is-zero", targetIsZero, NULL); if (!cmd) return -1; diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index cf9e341fe3..5034c8d23d 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -273,7 +273,8 @@ qemuMonitorJSONBlockdevMirror(qemuMonitor *mon, unsigned int granularity, unsigned long long buf_size, bool shallow, - bool syncWrite) + bool syncWrite, + bool targetIsZero) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5); int diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 8911895c7e..e34dbad7cd 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1107,7 +1107,7 @@ GEN_TEST_FUNC(qemuMonitorJSONGraphicsRelocate, VIR_DO= MAIN_GRAPHICS_TYPE_SPICE, "localhost", 12345, 12346, "certsubjectval") GEN_TEST_FUNC(qemuMonitorJSONRemoveNetdev, "net0") GEN_TEST_FUNC(qemuMonitorJSONDelDevice, "ide0") -GEN_TEST_FUNC(qemuMonitorJSONBlockdevMirror, "jobname", true, "vdb", "targ= etnode", "replacenode", 1024, 1234, 31234, true, true) +GEN_TEST_FUNC(qemuMonitorJSONBlockdevMirror, "jobname", true, "vdb", "targ= etnode", "replacenode", 1024, 1234, 31234, true, true, true) GEN_TEST_FUNC(qemuMonitorJSONBlockStream, "vdb", "jobname", "backingnode",= "backingfilename", 1024) GEN_TEST_FUNC(qemuMonitorJSONBlockCommit, "vdb", "jobname", "topnode", "ba= senode", "backingfilename", 1024, VIR_TRISTATE_BOOL_YES) GEN_TEST_FUNC(qemuMonitorJSONScreendump, "devicename", 1, NULL, "/foo/bar") --=20 2.53.0