[PATCH] virsh: Require --xpath for dumpxml

Daniel P. Berrangé berrange at redhat.com
Fri Jul 8 11:23:12 UTC 2022


On Fri, Jul 08, 2022 at 12:49:13PM +0200, Michal Privoznik wrote:
> Historically, the dumpxml command reject any unknown arguments,
> for instance:
> 
>     virsh dumpxml fedora xxx
> 
> However, after v8.5.0-rc1~31 the second argument ('xxx') is
> treated as an XPath, but it's not that clearly visible.
> Therefore, require the --xpath switch, like this:
> 
>     virsh dumpxml fedora --xpath xxx
> 
> Yes, this breaks already released virsh, but I think we can argue
> that the pool of users of this particular function is very small.
> The sooner we do this change, the better.
> 
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2103524
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  tools/virsh-domain.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
> index 43034f2f81..a181ae005f 100644
> --- a/tools/virsh-domain.c
> +++ b/tools/virsh-domain.c
> @@ -10461,6 +10461,7 @@ static const vshCmdOptDef opts_dumpxml[] = {
>      },
>      {.name = "xpath",
>       .type = VSH_OT_STRING,
> +     .flags = VSH_OFLAG_REQ_OPT,
>       .completer = virshCompleteEmpty,
>       .help = N_("xpath expression to filter the XML document")
>      },

Opps, shouldn't we do the same change for all the other 'xpath'
parameters.


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


More information about the libvir-list mailing list