]> xenbits.xensource.com Git - libvirt.git/commit
virt-admin: 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)
commita67f737ddfc59b0f5b3905bd1c0935ced82de3d0
treecc2c395ac20ad727941753c1bc042389ac0f713e
parent100cbccecdcc1a184ee64f2b923db3470f465ea8
virt-admin: 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.

Certain arguments where it makes sense are annotated as 'positional' too
in this patch.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tools/virt-admin.c