]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virsh: Annodate 'unwanted_positional' arguments
authorPeter Krempa <pkrempa@redhat.com>
Thu, 14 Mar 2024 16:17:19 +0000 (17:17 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 2 Apr 2024 12:24:30 +0000 (14:24 +0200)
commit100cbccecdcc1a184ee64f2b923db3470f465ea8
tree8a8bff9836fa99b4da004ecd2eab190cbf06c93f
parent32a89fc670751654eb4dd429e327f304b16c47e9
virsh: Annodate 'unwanted_positional' arguments

Historically the command parser in virsh parses/fills even optional
arguments with values as if they were positional unless opted out using
VSH_OFLAG_REQ_OPT. This creates unexpected situations when commands can
break in this unwanted semantics:

 $ virsh snapshot-create-as --print-xml 1 2 3
 <domainsnapshot>
   <name>2</name>
   <description>3</description>
 </domainsnapshot>

To prevent any further addition annotate the rest of the arguments with
the 'unwanted_positional' flag, so that the parser can keep parsing them
as such but any further optional argument will not have this behaviour.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
12 files changed:
tools/virsh-checkpoint.c
tools/virsh-domain-event.c
tools/virsh-domain-monitor.c
tools/virsh-domain.c
tools/virsh-host.c
tools/virsh-interface.c
tools/virsh-network.c
tools/virsh-nodedev.c
tools/virsh-pool.c
tools/virsh-secret.c
tools/virsh-snapshot.c
tools/virsh-volume.c