Re: [libvirt PATCH 00/12] Add vmx-* features from qemu

2024-03-15 Thread Jiri Denemark
On Thu, Mar 14, 2024 at 16:51:31 -0400, Sergio Durigan Junior wrote: > On Wednesday, March 13 2024, I wrote: > > > On Tuesday, March 12 2024, Jiri Denemark wrote: > > > >> On Wed, Jan 24, 2024 at 22:19:56 -0500, Sergio Durigan Junior wrote: > >>> On Monday, January 22 2024, I wrote: > >>> > >>> >

[PATCH 02/28] virsh: cmdDomdisplayReload: Require option name for --type

2024-03-15 Thread Peter Krempa
As this command was introduced in this release add the flag requiring to pass optionname. This is needed to actually disallow positional parsing of the value despite documenting that the flag name is required. Signed-off-by: Peter Krempa --- tools/virsh-domain.c | 1 + 1 file changed, 1 inserti

[PATCH 00/28] vsh: Fix handling of commands and help - part 2 (unwanted positional parsing of optional arguments)

2024-03-15 Thread Peter Krempa
Part 2 was supposed to be the refactor of the parser, but it turns out that our annotations of arguments and quirks of the parser itself resulted with basically every optional argument with value being also considered for positional parisng. This series explains where this happens and annotates al

[PATCH 04/28] virsh: Inline VIRSH_COMMON_OPT_DOMAIN_OT_STRING macro

2024-03-15 Thread Peter Krempa
Upcoming patches will need to tweak some of the properties of the command. Since the macro is used in just two places expand it inline. Signed-off-by: Peter Krempa --- tools/virsh-domain-event.c | 7 +-- tools/virsh-domain.c | 14 +++--- tools/virsh.h | 13 ---

[PATCH 01/28] vshCmddefHelp: Drop empty line at the end

2024-03-15 Thread Peter Krempa
All virsh commands in non-quiet mode append another separator line thus having two is unnecessary and in quiet mode it still has a trailing blank line. Remove it. Signed-off-by: Peter Krempa --- tools/vsh.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/vsh.c b/tools/vsh.c index f96071

[PATCH 06/28] virsh: Inline VIRSH_COMMON_OPT_NETWORK_OT_STRING macro

2024-03-15 Thread Peter Krempa
The macro is used in just one place and the definition of the option is going to be modified. Inline the macro. Signed-off-by: Peter Krempa --- tools/virsh-network.c | 17 + 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/tools/virsh-network.c b/tools/virsh-network

[PATCH 03/28] vshCmddefCheckInternals: Improve some checks

2024-03-15 Thread Peter Krempa
- move the check that completer_flags are 0 if no completer is set into a common place and remove duplication - add check that _BOOL arguments are not positional - add missing checks to _ALIAS Signed-off-by: Peter Krempa --- tools/vsh.c | 21 +++-- 1 file changed, 19 insert

[PATCH 07/28] vsh: Introduce tool to find unwanted positional arguments to 'self-test'

2024-03-15 Thread Peter Krempa
While the virsh option definitions specify (either explicitly after recent refactors, or implicitly before) whether an argument is positional or not, the actual parser is way more lax and actually and allows also arguments which were considered/documented as non-positional to be filled positionally

[PATCH 08/28] vsh: Introduce annotation for vsh options which are unexpectedly parsed positionally

2024-03-15 Thread Peter Krempa
Based on the rationale in previous commit, all commands which were parsed as positional but not documented as such will be annotated with this flag. Signed-off-by: Peter Krempa --- tools/vsh.c | 12 ++-- tools/vsh.h | 7 +++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --

[PATCH 05/28] virsh: Inline VIRSH_COMMON_OPT_FILE_FULL macro

2024-03-15 Thread Peter Krempa
The macro is used in one place only and the command definition will be altered. Inline it. Signed-off-by: Peter Krempa --- tools/virsh-host.c | 7 +-- tools/virsh.h | 7 ++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/virsh-host.c b/tools/virsh-host.c index

[PATCH 09/28] virsh: Annotate '--diskspec' _ARGV options as unwanted positional

2024-03-15 Thread Peter Krempa
Our documentation in most places explicitly mentions --diskspec and it was never meant to be positional, although we can't change the parser any more. Annotate them as 'unwanted_positional'. Signed-off-by: Peter Krempa --- tools/virsh-checkpoint.c | 1 + tools/virsh-snapshot.c | 1 + 2 files c

[PATCH 10/28] virsh: Annotate rest of _ARGV arguments as positional

2024-03-15 Thread Peter Krempa
In most cases it's the usual/recommended way to use those commands: $ virsh qemu-monitor-command VMNAME cmd args args args Signed-off-by: Peter Krempa --- tools/virsh-domain.c | 8 tools/virsh-network.c | 1 + 2 files changed, 9 insertions(+) diff --git a/tools/virsh-domain.c b/tool

[PATCH 11/28] vsh: Fix option formatting for 'VHS_OT_ARGV' options

2024-03-15 Thread Peter Krempa
While previous fixes kept the help output unchanged as base for the refactors it turns out that the formatting of help for argv options is wrong. Specifically in SYNOPSIS the non-positional _ARGV would have the option name in square brackets (which in other cases means that given thing is optional

[PATCH 13/28] virsh: Fix "positional" argument annotations for 'migrate' command

2024-03-15 Thread Peter Krempa
Annotate arguments which can be unintentionally parsed positionally. (See previous commits for explanation.) Annotate '--migrateuri', '--graphicsuri', '--listen-address', '-dname', '--timeout', '--xml', '--migrate-disks' and '--disks port' as 'unwanted_positional'. These were declared in chronolog

[PATCH 14/28] virsh: Require option flags for all optional arguments of 'attach-disk'

2024-03-15 Thread Peter Krempa
Annotate arguments which can be unintentionally parsed positionally. (See previous commits for explanation.) Currently virsh accepts the arguments such as: $ virsh attach-disk --print-xml 1 2 3 4 5 6 7 8 9 10 While making virsh require the flags is technically a breaking change,

[PATCH 12/28] virsh: Require option flags for 'blkdeviotune' arguments

2024-03-15 Thread Peter Krempa
Make all of the tunable parameter flags require the option name (don't parse them positionally). While techically this would be a breaking change if anyone were to specify the tunable values positionally this is not the case as the first two tunables are not compatible with each other: $ virsh

[PATCH 17/28] vsh: Make the only argument of 'connect', 'cd', and 'help' commands positional

2024-03-15 Thread Peter Krempa
The intended use of those commands is to use the argument directly without the flag. Since the argument is optional in all cases we couldn't declare them as positional until now. Signed-off-by: Peter Krempa --- tools/virsh.c | 1 + tools/virt-admin.c | 1 + tools/vsh.c| 2 ++ 3 file

[PATCH 15/28] virsh-checkpoint: Make 'checkpointname' positional and required

2024-03-15 Thread Peter Krempa
The argument was being parsed positionally due to the command parser quirk as we didn't opt out of it. Since the code in virshLookupCheckpoint requires that the checkpointname is present we can mark all the options as positional and required and remove the redundant check from virshLookupCheckpoin

[PATCH 16/28] vsh: Allow one optional positional argument

2024-03-15 Thread Peter Krempa
We already allow a optional positional _ARGV argument but there's no reason why any other argument type could not be allowed this way. Add checks that there's just one such argument and it's placed after required positional arguments. Signed-off-by: Peter Krempa --- tools/vsh.c | 20 +++

[PATCH 18/28] virsh: snapshot: Make 'snapshotname' argument positional

2024-03-15 Thread Peter Krempa
The 'snapshotname' argument is optional as by default "current" snapshot is considered. Regardless of that we should treat it as positional as it's the common usage. This is now possible as we can have one optional positional argument. Signed-off-by: Peter Krempa --- tools/virsh-snapshot.c | 6 +

[PATCH 19/28] virsh: Make '(snapshot|checkpoint)-create' 'xmlfile' argument positional

2024-03-15 Thread Peter Krempa
The argument is optional thus couldn't be marked as positional until now, despite being parsed positionally. Signed-off-by: Peter Krempa --- tools/virsh-checkpoint.c | 1 + tools/virsh-snapshot.c | 1 + 2 files changed, 2 insertions(+) diff --git a/tools/virsh-checkpoint.c b/tools/virsh-check

[PATCH 20/28] virsh-backup: Fix argument annotations of 'backup-begin' command

2024-03-15 Thread Peter Krempa
Mark the 'backupxml' as positional optional and the 'checkpointxml' as 'unwanted_positional' to preserve the positioanl parsing quirk. Signed-off-by: Peter Krempa --- tools/virsh-backup.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/virsh-backup.c b/tools/virsh-backup.c index 7a78

[PATCH 21/28] virsh: Annotate some optional arguments as positional

2024-03-15 Thread Peter Krempa
Make certain optional arguments truly positional in cases when it makes semantic sense. Previously it wasn't possible to have optional positional arguments, but the parser filled them regardless, thus this preserves functionality. Signed-off-by: Peter Krempa --- tools/virsh-domain-monitor.c | 3

[PATCH 22/28] virsh: volume: Mark optional 'pool' argument as 'positional'

2024-03-15 Thread Peter Krempa
Annotate arguments which can be unintentionally parsed positionally. (See previous commits for explanation.) The pool name is optional but in all cases it can be promoted to an optional positional argument so that it can be properly aligned with the expectations of the parser. Signed-off-by: Pete

[PATCH 25/28] virt-admin: Annodate 'unwanted_positional' arguments

2024-03-15 Thread Peter Krempa
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 2

[PATCH 23/28] virsh: Annotate "unwanted_positional" arguments for 'pool-(define|create)-as' commands

2024-03-15 Thread Peter Krempa
Annotate arguments which can be unintentionally parsed positionally. (See previous commits for explanation.) All of these options were added in order thus we must declare all of them as 'unwanted_positional'. Signed-off-by: Peter Krempa --- tools/virsh-pool.c | 19 +++ 1 file ch

[PATCH 27/28] vsh: Replace 'VSH_OFLAG_EMPTY_OK' bitwise flag with a separate struct member

2024-03-15 Thread Peter Krempa
Replace the last bitwise flag with a separate member. Signed-off-by: Peter Krempa --- tools/virsh-domain-monitor.c | 2 +- tools/virsh-domain.c | 6 +++--- tools/virsh.c| 2 +- tools/virt-admin.c | 6 +++--- tools/vsh.c | 6 +++--- tools/vsh.h

[PATCH 28/28] vshCmdOptDef: Remove unused 'flags' member

2024-03-15 Thread Peter Krempa
Drop the last enum member VSH_OFLAG_NONE and remove the 'flags' variable from vshCmdOptDef. Signed-off-by: Peter Krempa --- tools/virsh-domain-monitor.c | 3 --- tools/virsh-domain.c | 4 tools/virsh-network.c| 1 - tools/virsh-pool.c | 3 --- tools/vsh.c

[PATCH 26/28] vsh: Make positional parsing of arguments opt-in

2024-03-15 Thread Peter Krempa
Switch the command parser from using the VSH_OFLAG_REQ_OPT flag opting out from positional parsing of arguments to a combination of the 'positional' flags for truly positional arguments and 'unwanted_positional' preserving semantics for the existing arguments where the parser did it due to bad desi

[PATCH 24/28] virsh: Annodate 'unwanted_positional' arguments

2024-03-15 Thread Peter Krempa
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 2

[PATCH] virthreadpool: create threads from the newly expanded workers

2024-03-15 Thread Wei Gong
when the thread pool is dynamically expanded, threads should not be created from the existing workers; they should be created from the newly expanded workers Signed-off-by: Wei Gong --- src/util/virthreadpool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virthrea

Re: [PATCH v2] Remove VIR_FREE in favor of g_autofree in some functions in libvrit-domain.c

2024-03-15 Thread m kamal
Please advise on what actions (if any) should be taken so that the changes in the patch is merged into main. Cheers, Mostafa Mahmoud. From: m kamal Sent: Tuesday, March 12, 2024 5:58 PM To: Peter Krempa Cc: devel@lists.libvirt.org Subject: Re: [PATCH v2] Remov