From nobody Mon Feb 9 01:22:34 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1669990646; cv=none; d=zohomail.com; s=zohoarc; b=EBH0b9E1suGBwDnH1DB0YmXZ76djEm0P9iF/2zcz7H1TDQ2M/Zr0FX3zUR2uNhTe+LmNSyF39P0kNfV6t9Hiq9moDBAg7t8mmnbOg8Y8IsJIRqZ6yeoAR/+V2vvD7+mUNVcfiCZS24aN7agyXS3LbrkZjPzl0nmIZ3frN0ZCIO0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669990646; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=F5RntNoV4lWTuP2Hy4R360SG5KoqylP+8Q/+V1F44wk=; b=Kzzs8xqwsLwDqdtv2Ldbt3Miyu9/bMTO4u84DClzphggDGRZkEKpWKT2zlLmEkqnXxBt7fh+vVmCVojyj3f3m0pMB+nurxTs7ZEQsiqSW0y7qFVirOtNKzUBDKKXLDJs1LVnCUfQuBsO+65N2OPx4HctDPEn+xTM5/mdAbBnw6k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1669990646344502.0364830113624; Fri, 2 Dec 2022 06:17:26 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-644-OYHf1hMGMaG3w_VAOrY4wA-1; Fri, 02 Dec 2022 09:17:14 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E858F185A7A3; Fri, 2 Dec 2022 14:17:08 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id D5541111DCE0; Fri, 2 Dec 2022 14:17:08 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id CA68419465A8; Fri, 2 Dec 2022 14:17:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D06951946587 for ; Fri, 2 Dec 2022 14:17:07 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id C726A40E9787; Fri, 2 Dec 2022 14:17:07 +0000 (UTC) Received: from speedmetal.redhat.com (ovpn-208-20.brq.redhat.com [10.40.208.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 276C640E9785 for ; Fri, 2 Dec 2022 14:17:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669990645; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=F5RntNoV4lWTuP2Hy4R360SG5KoqylP+8Q/+V1F44wk=; b=brttaf/lV1MoW4KSFVgGYiy14i3HvvD5KecdQqCAViEnWmcLz/23DXsLE9S2unis2NzN/4 7kAicudYWYQj7WqYIhK0jyOi2c0VuiLtq3o4koXV9b37JLc6cjDqCOTMm68y2xg9m46K8a 0ME/bUJJ8cWpRH9pWKgjyO0Ju0Akors= X-MC-Unique: OYHf1hMGMaG3w_VAOrY4wA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 06/13] virsh: Add --print-xml flag for 'vol-clone' command Date: Fri, 2 Dec 2022 15:16:50 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1669990648556100005 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa --- docs/manpages/virsh.rst | 5 ++++- tools/virsh-volume.c | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index 14ed9cd5a0..c85bc8151d 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -6719,7 +6719,7 @@ vol-clone :: vol-clone vol-name-or-key-or-path name - [--pool pool-or-uuid] [--prealloc-metadata] [--reflink] + [--pool pool-or-uuid] [--prealloc-metadata] [--reflink] [--print-xml] Clone an existing volume within the parent pool. Less powerful, but easier to type, version of ``vol-create-from``. @@ -6743,6 +6743,9 @@ When *--reflink* is specified, perform a COW lightwei= ght copy, where the data blocks are copied only when modified. If this is not possible, the copy fails. +If *--print-xml* is specified, then the XML used to clone the volume is +printed instead. + vol-delete ---------- diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c index b7a1ddb9e5..adfea570be 100644 --- a/tools/virsh-volume.c +++ b/tools/virsh-volume.c @@ -559,6 +559,10 @@ static const vshCmdOptDef opts_vol_clone[] =3D { .type =3D VSH_OT_BOOL, .help =3D N_("use btrfs COW lightweight copy") }, + {.name =3D "print-xml", + .type =3D VSH_OT_BOOL, + .help =3D N_("print XML document rather than clone the volume") + }, {.name =3D NULL} }; @@ -599,6 +603,11 @@ cmdVolClone(vshControl *ctl, const vshCmd *cmd) return false; } + if (vshCommandOptBool(cmd, "print-xml")) { + vshPrint(ctl, "%s", newxml); + return true; + } + if (!(newvol =3D virStorageVolCreateXMLFrom(origpool, (char *) newxml, origvol, flags))) { vshError(ctl, _("Failed to clone vol from %s"), --=20 2.38.1