From nobody Tue Mar 24 01:19:20 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=1773853930; cv=none; d=zohomail.com; s=zohoarc; b=jTJO8R4fyf9Hyo9dKferWyJ4zr6y1s6ddu6IHUCCwm0EAjPqzjMiZjKgAIlMlsRCH2TBc0gPylkjc1jGYeH0sxumoAx+sOgBcVNyMUDge++reP1Lejm417NkO3EWMcLDmIAl0JvsE5q9wrBvMkZbVJ+FZqYs2QDi4c5Z4zcS9Ww= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773853930; 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=h8qRjPSb4XePgmeSEWIv07LWqH8SLi5bqVjtDC012AY=; b=XuAnZOq+6AC54MBtEKtwOqBknhP5Sg4YHkM+g8QgF/a83/6qf2SDYI4i8CIkyxM9tOZcohcWa2mAH7XwkO36h2QzsMAROLBiXiqtosplbT+oyYatbeUnPvXV3vBaTJGcxTUeQwU4v5QTWB2djkPI5QU5r5B0G17LjCjGm7NYw6c= 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 1773853930108384.7352634623287; Wed, 18 Mar 2026 10:12:10 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 4677C418BC; Wed, 18 Mar 2026 13:12:09 -0400 (EDT) Received: from [172.19.199.12] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 0BDB64190B; Wed, 18 Mar 2026 13:08:08 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id D85044184B; Wed, 18 Mar 2026 13:08:04 -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 EC40E41BFF for ; Wed, 18 Mar 2026 13:05:09 -0400 (EDT) Received: from mx-prod-mc-08.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-365-5slBxySPN0iE7TV9l618mA-1; Wed, 18 Mar 2026 13:05:08 -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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9134D18002C8 for ; Wed, 18 Mar 2026 17:05:07 +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 CB65130001A1 for ; Wed, 18 Mar 2026 17:05:06 +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=1773853509; 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=h8qRjPSb4XePgmeSEWIv07LWqH8SLi5bqVjtDC012AY=; b=hOiId72s9bmgPa4727kj3QyIyP2m8MpBN7skHyG74GNSypVAEgdVcRqNa8klZZzuL+l75f fZPXkyQJeEAt8zhz3Ttp1Lwlo1kDY/p2EqoTWmpWnwRekJWtmawGhm4vyfiKOLdazE9NBD H9fteItm5g6ri6KkO3Pdb4JugXCOV6I= X-MC-Unique: 5slBxySPN0iE7TV9l618mA-1 X-Mimecast-MFC-AGG-ID: 5slBxySPN0iE7TV9l618mA_1773853507 To: devel@lists.libvirt.org Subject: [PATCH 7/7] virsh: migrate: Add support for VIR_MIGRATE_PARAM_MIGRATE_DISKS_TARGET_ZERO Date: Wed, 18 Mar 2026 18:04:55 +0100 Message-ID: <5743d638da33b24cb1ea6f30b775482d2c4fbe36.1773853407.git.pkrempa@redhat.com> 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: GXkIdhYIZfhZU9A4n2FOEnH3JMy7r_JPLkaMQuSbrzY_1773853507 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: ZNDAYSYLHCSWRSKOV56H2NQQ64VVHAPI X-Message-ID-Hash: ZNDAYSYLHCSWRSKOV56H2NQQ64VVHAPI 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: 1773853930567158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Add '--migrate-disks-target-zero' to pass the list of pre-zeroed disk images. Signed-off-by: Peter Krempa --- docs/manpages/virsh.rst | 4 ++++ tools/virsh-domain.c | 26 ++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index da9e9f8658..4b8bbec7d6 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -3722,6 +3722,7 @@ migrate [--timeout seconds [--timeout-suspend | --timeout-postcopy]] [--xml file] [--migrate-disks disk-list] [--migrate-disks-detect-zeroes disk-list] + [--migrate-disks-target-zero disk-list] [--disks-port port] [--compressed] [--comp-methods method-list] [--comp-mt-level] [--comp-mt-threads] [--comp-mt-dthreads] @@ -3760,6 +3761,9 @@ disk target names enables zeroed block detection for = the listed migrated disks. These blocks are not transferred or allocated (requires that 'discard' opt= ion on given disk is set to 'unmap') on destination, effectively sparsifying t= he disk at the cost of CPU overhead. +The *--migrate-disks-target-zero* option which takes a comma separated lis= t of +disk target names specifies disk images where the target was zeroed out pr= ior +to the migration and thus hypervisor will not attempt to zero them. With *--copy-storage-synchronous-writes* flag used the disk data migration= will synchronously handle guest disk writes to both the original source and the destination to ensure that the disk migration converges at the price of po= ssibly diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 1af7f9eb0e..a17c8b42e2 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -11218,6 +11218,11 @@ static const vshCmdOptDef opts_migrate[] =3D { .completer =3D virshDomainMigrateDisksCompleter, .help =3D N_("comma separated list of disks to be migrated with zero = detection enabled") }, + {.name =3D "migrate-disks-target-zero", + .type =3D VSH_OT_STRING, + .completer =3D virshDomainMigrateDisksCompleter, + .help =3D N_("comma separated list of disks to be migrated with assum= ption that target image is zeroed") + }, {.name =3D "disks-port", .type =3D VSH_OT_INT, .unwanted_positional =3D true, @@ -11461,6 +11466,27 @@ doMigrate(void *opaque) } } + if (vshCommandOptString(ctl, cmd, "migrate-disks-target-zero", &opt) <= 0) + goto out; + if (opt) { + g_autofree char **val =3D NULL; + + if (!(flags & (VIR_MIGRATE_NON_SHARED_DISK | VIR_MIGRATE_NON_SHARE= D_INC))) { + vshError(ctl, "%s", _("'--migrate-disks-target-zero' requires = one of '--copy-storage-all', '--copy-storage-inc'")); + goto out; + } + + val =3D g_strsplit(opt, ",", 0); + + if (virTypedParamsAddStringList(¶ms, + &nparams, + &maxparams, + VIR_MIGRATE_PARAM_MIGRATE_DISKS_TA= RGET_ZERO, + (const char **)val) < 0) { + goto save_error; + } + } + if (vshCommandOptString(ctl, cmd, "comp-methods", &opt) < 0) goto out; if (opt) { --=20 2.53.0