From nobody Tue Mar 24 01:18:34 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=1773853786; cv=none; d=zohomail.com; s=zohoarc; b=TflFBJ6zXthOCcHYY8dSESNAtD/z4+s9gsOdCiWO0+2K2zSGjkfE6mXC48Fy+IFZhvne0lbAZ3CSbyFfMjGGVOjnMrKDvYl0h/YFMidm8hSVLTcyJoey5fYr1eAmRUPaiKWe9KyelCQYioCmWJXrCoJf2y4/ReGRhZ3ohetMqdM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773853786; 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=0gR8Da1+7hI7/nBQ5+gnhp3c5a6/kvW4F2WDonMTwcM=; b=jmtRKAtD54ufPf6snbIEhvqZ1gs99dqi2VsvNJrimd0dIUTZWJ4Kdx3Z8YnwJ3DW24uG80Gxv7iwnNs+iC+NH3jS8I/sbAgvzLUOTwtTR2u/EE3HAFNUKB98IbIqe/HZrSeAxlX1vC4G5+GyQnB3T19vns5iQ4vXJz9WGCERPGs= 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 1773853786037935.956868734886; Wed, 18 Mar 2026 10:09:46 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 9266541AAA; Wed, 18 Mar 2026 13:09:45 -0400 (EDT) Received: from [172.19.199.12] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id B2D8C41B4D; Wed, 18 Mar 2026 13:06:42 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id D0FAD41ADD; Wed, 18 Mar 2026 13:06:38 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 C49A841AF9 for ; Wed, 18 Mar 2026 13:05:06 -0400 (EDT) Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-357-Lyv6PLhVPNOXlKbJ2X2VmQ-1; Wed, 18 Mar 2026 13:05:04 -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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DAD1A1955EA1 for ; Wed, 18 Mar 2026 17:05:03 +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 2795B30001A1 for ; Wed, 18 Mar 2026 17:05:02 +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=1773853506; 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=0gR8Da1+7hI7/nBQ5+gnhp3c5a6/kvW4F2WDonMTwcM=; b=a2wFbbTzwd8aTj9ydz0fqCKoLmaRi4kQs7i7oDTdAyDT7w7SUaJ0F0yi0sp8xOLdTs15iH mjadm3GvFcJikrImYih8fhsyXQRDw2LXOTKDqbCdKDlYjL7cU6O/qnqR9yzMLcwCOCf0me yl2wpv5HbJxICOIkqceIzO0BFqby30M= X-MC-Unique: Lyv6PLhVPNOXlKbJ2X2VmQ-1 X-Mimecast-MFC-AGG-ID: Lyv6PLhVPNOXlKbJ2X2VmQ_1773853504 To: devel@lists.libvirt.org Subject: [PATCH 5/7] virsh: Add support for 'VIR_DOMAIN_BLOCK_COPY_TARGET_ZEROED' as '--dest-is-zero' Date: Wed, 18 Mar 2026 18:04:53 +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: 2ppVEC1d_whZWKcITh3rwj9_RzyTOEI0jZX0GUDhnn0_1773853504 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: QWK3HVFUQKCTMOKYGEM2RBAI5LZVOGGP X-Message-ID-Hash: QWK3HVFUQKCTMOKYGEM2RBAI5LZVOGGP 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: 1773853787051154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Add the aforementioned flag for 'virsh blockcopy'. Signed-off-by: Peter Krempa --- docs/manpages/virsh.rst | 6 +++++- tools/virsh-domain.c | 9 ++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index 591c47a7ce..da9e9f8658 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -1472,7 +1472,7 @@ blockcopy [--shallow] [--reuse-external] [bandwidth] [--wait [--async] [--verbose]] [{--pivot | --finish}] [--timeout seconds] [granularity] [buf-size] [--bytes] - [--transient-job] [--synchronous-writes] [--print-xml] + [--transient-job] [--synchronous-writes] [--dest-is-zero] [--print-x= ml] Copy a disk backing image chain to a destination. Either *dest* as the destination file name, or *--xml* with the name of an XML file contain= ing @@ -1537,6 +1537,10 @@ to be propagated both to the original image and to t= he destination of the copy so that it's guaranteed that the job converges if the destination storage = is slower. This may impact performance of writes while the blockjob is runnin= g. +If *--dest-is-zero* is specified the hypervisor may assume that the target +image was already cleared (any offset reads 0x00 bytes) and thus may skip +clearing it. + If *--print-xml* is specified, then the XML used to start the block copy j= ob is printed instead of starting the job. diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 5a2ae75379..1af7f9eb0e 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -2714,6 +2714,10 @@ static const vshCmdOptDef opts_blockcopy[] =3D { .type =3D VSH_OT_BOOL, .help =3D N_("print the XML used to start the copy job instead of sta= rting the job") }, + {.name =3D "dest-is-zero", + .type =3D VSH_OT_BOOL, + .help =3D N_("the destination image is already zeroed; hypervisor may= skip pre-zeroing") + }, {.name =3D NULL} }; @@ -2737,6 +2741,7 @@ cmdBlockcopy(vshControl *ctl, const vshCmd *cmd) bool bytes =3D vshCommandOptBool(cmd, "bytes"); bool transientjob =3D vshCommandOptBool(cmd, "transient-job"); bool syncWrites =3D vshCommandOptBool(cmd, "synchronous-writes"); + bool destIsZero =3D vshCommandOptBool(cmd, "dest-is-zero"); int timeout =3D 0; const char *path =3D NULL; int abort_flags =3D 0; @@ -2773,6 +2778,8 @@ cmdBlockcopy(vshControl *ctl, const vshCmd *cmd) flags |=3D VIR_DOMAIN_BLOCK_COPY_SYNCHRONOUS_WRITES; if (vshCommandOptTimeoutToMs(ctl, cmd, &timeout) < 0) return false; + if (destIsZero) + flags |=3D VIR_DOMAIN_BLOCK_COPY_TARGET_ZEROED; if (timeout) blocking =3D true; @@ -2818,7 +2825,7 @@ cmdBlockcopy(vshControl *ctl, const vshCmd *cmd) } if (granularity || buf_size || (format && STRNEQ(format, "raw")) || xm= l || - transientjob || syncWrites || print_xml) { + transientjob || syncWrites || destIsZero || print_xml) { /* New API */ if (bandwidth || granularity || buf_size) { params =3D g_new0(virTypedParameter, 3); --=20 2.53.0