From nobody Thu May 15 00:11:24 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1518620607072431.4255138034048; Wed, 14 Feb 2018 07:03:27 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D0CC87485B; Wed, 14 Feb 2018 15:03:24 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A0D2F60467; Wed, 14 Feb 2018 15:03:24 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 43DCB18033EA; Wed, 14 Feb 2018 15:03:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w1EEw8rn017118 for ; Wed, 14 Feb 2018 09:58:09 -0500 Received: by smtp.corp.redhat.com (Postfix) id D9DF0B3011; Wed, 14 Feb 2018 14:58:08 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 65CB61C707; Wed, 14 Feb 2018 14:58:08 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 14 Feb 2018 15:57:24 +0100 Message-Id: <4fae7d8450ee2d202265751cb8376e467c3bc897.1518618392.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 1/3] virsh: detach-disk: Add --print-xml switch X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 14 Feb 2018 15:03:25 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Similarly to other commands add an argument which allows to check the XML which would be used to execute the operation instead. Signed-off-by: Peter Krempa --- tools/virsh-domain.c | 10 ++++++++++ tools/virsh.pod | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 5a0e0c1b21..c10bf184f9 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -12432,6 +12432,10 @@ static const vshCmdOptDef opts_detach_disk[] =3D { VIRSH_COMMON_OPT_DOMAIN_CONFIG, VIRSH_COMMON_OPT_DOMAIN_LIVE, VIRSH_COMMON_OPT_DOMAIN_CURRENT, + {.name =3D "print-xml", + .type =3D VSH_OT_BOOL, + .help =3D N_("print XML document rather than attach the interface") + }, {.name =3D NULL} }; @@ -12487,6 +12491,12 @@ cmdDetachDisk(vshControl *ctl, const vshCmd *cmd) goto cleanup; } + if (vshCommandOptBool(cmd, "print-xml")) { + vshPrint(ctl, "%s", disk_xml); + functionReturn =3D true; + goto cleanup; + } + if (flags !=3D 0 || current) ret =3D virDomainDetachDeviceFlags(dom, disk_xml, flags); else diff --git a/tools/virsh.pod b/tools/virsh.pod index 69cc42338d..8f0e8d74b0 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -3113,6 +3113,7 @@ I<--persistent>. =3Ditem B I I [[[I<--live>] [I<--config>] | [I<--current>]] | [I<--persistent>]] +[I<--print-xml>] Detach a disk device from a domain. The I is the device as seen from the domain. @@ -3130,6 +3131,9 @@ an offline domain, and like I<--live> I<--config> for= a running domain. Note that older versions of virsh used I<--config> as an alias for I<--persistent>. +If B<--print-xml> is specified, then the XML which would be used to detach= the +disk is printed instead. + =3Ditem B I I [I<--mac mac>] [[[I<--live>] [I<--config>] | [I<--current>]] | [I<--persistent>]] --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list