]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
13 months agotests: Reimplement 'libvirtd-fail' case directly in meson
Peter Krempa [Fri, 22 Mar 2024 09:32:52 +0000 (10:32 +0100)]
tests: Reimplement 'libvirtd-fail' case directly in meson

The test simply invokes libvirtd and expects it to fail. We can do that
directly in meson without the need for a wrapper script.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agotests: Re-implement '(virsh|virt-admin)-self-test' directly in meson
Peter Krempa [Fri, 22 Mar 2024 09:02:02 +0000 (10:02 +0100)]
tests: Re-implement '(virsh|virt-admin)-self-test' directly in meson

The self-test command for both virsh and virt-admin is self contained
and directly reports success, thus we don't actually need to run a shell
wrapper around it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirshtest: Adapt 'libvirtd-pool'
Peter Krempa [Thu, 21 Mar 2024 21:21:34 +0000 (22:21 +0100)]
virshtest: Adapt 'libvirtd-pool'

The test case is a fairly simple invocation of pool-create-as which can
be done easily from 'virshtest'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirshtest: Adapt 'virsh-read-bufsiz' and 'virsh-read-non-seekable'
Peter Krempa [Thu, 21 Mar 2024 16:50:09 +0000 (17:50 +0100)]
virshtest: Adapt 'virsh-read-bufsiz' and 'virsh-read-non-seekable'

Test both situations (reading from non-regular file and reading a file
larger than (arbitrary) buffer size) via 'virshtest'.

To feed the pipe we need to create a thread that does it, but otherwise
it's fairly straightforward.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirshtest: Adapt 'virsh-checkpoint' test
Peter Krempa [Thu, 21 Mar 2024 12:49:07 +0000 (13:49 +0100)]
virshtest: Adapt 'virsh-checkpoint' test

Invoke the majority of the command via DO_TEST_SCRIPT in 'virshtest'.
Some adaptation was needed to avoid printing of tables with volatile
data such as checkpoint creation time, which were converted to list
names-only.

To proprely test redefinition we store XMLs rather than taking them from
the defined checkpoints and use them separately to test redefinition of
checkpoint XMLs. This makes use of the 'cd' command in non-interactive
mode.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirshtest: Adapt 'virsh-snapshot' test
Peter Krempa [Thu, 21 Mar 2024 12:49:07 +0000 (13:49 +0100)]
virshtest: Adapt 'virsh-snapshot' test

Invoke the majority of the command via DO_TEST_SCRIPT in 'virshtest'.
Some adaptation was needed to avoid printing of tables with volatile
data such as snapshot creation time, which were converted to list
names-only.

To proprely test redefinition we store XMLs rather than taking them from
the defined snapshots and use them separately to test redefinition of
snapshot XMLs. This makes use of the 'cd' command in non-interactive
mode.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovsh: Allow non-interactive use of 'cd' command
Peter Krempa [Thu, 21 Mar 2024 13:46:29 +0000 (14:46 +0100)]
vsh: Allow non-interactive use of 'cd' command

For testing purposes it will come handy to change the directory from a
batch-mode script. Remove the check forbidding use of the 'cd' command
in batch mode.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirsh: Fix '--name' and '--parent' used together in '(snapshot|checkpoint)-list'...
Peter Krempa [Thu, 21 Mar 2024 12:15:40 +0000 (13:15 +0100)]
virsh: Fix '--name' and '--parent' used together in '(snapshot|checkpoint)-list' command

Until now when '--name' was used the parent was not printed and the
option was ignored. One option would be to declare the options mutually
exclusive, but for testing it may come handy to print both the snapshot
name and parent. Adjust the code to print them tab-separated and adjust
the docs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirshtest: Adapt 'virsh-start' and 'virsh-undefine' tests as 'lifecycle' case
Peter Krempa [Thu, 21 Mar 2024 11:14:06 +0000 (12:14 +0100)]
virshtest: Adapt 'virsh-start' and 'virsh-undefine' tests as 'lifecycle' case

The 'virsh-start' case simply tried to start an already running VM. This
can be easily tested together with the tests for undefining a VM.

For this test the test driver config with multiple VMs comes handy as we
need to test 3 situations when we undefine and stop the VM.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirshtest: Adapt 'virsh-schedinfo'
Peter Krempa [Thu, 21 Mar 2024 09:51:02 +0000 (10:51 +0100)]
virshtest: Adapt 'virsh-schedinfo'

It's a simple virsh invocation which can be done in 'virshtest'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirshtest: Adapt 'virsh-int-overflow'
Peter Krempa [Thu, 21 Mar 2024 09:42:13 +0000 (10:42 +0100)]
virshtest: Adapt 'virsh-int-overflow'

It's a simple test case invoking one virsh command thus it can be moved
to 'virshtest'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirshtest: Adapt 'virsh-vcpupin' test
Peter Krempa [Thu, 21 Mar 2024 09:20:25 +0000 (10:20 +0100)]
virshtest: Adapt 'virsh-vcpupin' test

As all cases are negative we can test them all in one virsh run.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agoqemuxmlconftest: Adapt XMLs from 'virsh-cpuset' and 'virsh-define-dev-segfault' cases
Peter Krempa [Thu, 21 Mar 2024 09:09:33 +0000 (10:09 +0100)]
qemuxmlconftest: Adapt XMLs from 'virsh-cpuset' and 'virsh-define-dev-segfault' cases

Rather than using 'virsh define' for the tests use the XML (or idea what
the XML is testing) and use them as 'qemuxmlconftest' cases.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirshtest: Reimplement 'virsh-output' test
Peter Krempa [Tue, 19 Mar 2024 14:19:26 +0000 (15:19 +0100)]
virshtest: Reimplement 'virsh-output' test

Adapt the 'tests/virsh-output-commands' file from 'virsh-output' test as
a source. Apart from expanding the bash function to each command, I've
also had to drop the negative tests for argument population, as a
command parsing error aborts the execution of the script right away
rather than just reporting the error.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirshtest: Adapt 'event' option arg handling tests from 'virsh-optparse'
Peter Krempa [Mon, 18 Mar 2024 14:38:39 +0000 (15:38 +0100)]
virshtest: Adapt 'event' option arg handling tests from 'virsh-optparse'

Move the argument parsing tests excercising 'virsh event' options
from 'virsh-optparse' to 'virshtest'.

As the test invokes 'virsh event' with a timeout and thus waits for one
second pointlessly the patch also adds infrastructure to mark individual
cases as expensive and is skipped normally.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirshtest: Adapt numeric option arg handling tests from 'virsh-optparse'
Peter Krempa [Mon, 18 Mar 2024 14:38:39 +0000 (15:38 +0100)]
virshtest: Adapt numeric option arg handling tests from 'virsh-optparse'

Move the argument parsing tests excercising various numeric options
(except 'virsh event') from 'virsh-optparse' to 'virshtest'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirshtest: Adapt 'snapshot-create-as' arg handling tests from 'virsh-optparse'
Peter Krempa [Mon, 18 Mar 2024 14:38:39 +0000 (15:38 +0100)]
virshtest: Adapt 'snapshot-create-as' arg handling tests from 'virsh-optparse'

Move the argument parsing tests excercising 'virsh snapshot-create-as'
from 'virsh-optparse' to 'virshtest'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirshtest: Adapt argument parsing tests from 'virsh-optparse'
Peter Krempa [Mon, 18 Mar 2024 14:19:34 +0000 (15:19 +0100)]
virshtest: Adapt argument parsing tests from 'virsh-optparse'

Move the argument parsing tests excercising 'virsh setvcpus' from
'virsh-optparse' to 'virshtest'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirshtest: Drop support for testing against hardcoded strings
Peter Krempa [Fri, 22 Mar 2024 14:10:15 +0000 (15:10 +0100)]
virshtest: Drop support for testing against hardcoded strings

Now that all tests were converted, this is no longer needed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirshtest: Adapt 'iothread' tests to DO_TEST_SCRIPT
Peter Krempa [Wed, 20 Mar 2024 16:58:39 +0000 (17:58 +0100)]
virshtest: Adapt 'iothread' tests to DO_TEST_SCRIPT

Adapt the tests to be invoked in one run. Note that multiple fake VMs
were used for the distinct tests so that they don't influence each
other.

This is the final coversion of tests to run in batch mode which halved
the runtime of 'virshtest' on my machine (1.11s vs 2.33s).

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirshtest: Adapt 'blkiotune' tests to DO_TEST_SCRIPT
Peter Krempa [Wed, 20 Mar 2024 16:52:19 +0000 (17:52 +0100)]
virshtest: Adapt 'blkiotune' tests to DO_TEST_SCRIPT

The query and update can be tested in one run and validated against
files rather than hardcoded strings.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirshtest: Adapt tests for domain id lookup and state query to DO_TEST_SCRIPT
Peter Krempa [Wed, 20 Mar 2024 16:48:12 +0000 (17:48 +0100)]
virshtest: Adapt tests for domain id lookup and state query to DO_TEST_SCRIPT

All of the commands can be tested in one 'virsh' run in batch mode and
tested against a file rather than hardcoded strings.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirshtest: Replace list and nodeinfo tests by equivalent VIR_TEST_SCRIPT variant
Peter Krempa [Wed, 20 Mar 2024 16:34:45 +0000 (17:34 +0100)]
virshtest: Replace list and nodeinfo tests by equivalent VIR_TEST_SCRIPT variant

Add the basic list and info commands into a script and run it via
VIR_TEST_RUN_SCRIPT to simplify the code and save up on 'virsh'
instances exec'd for the test.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirshtest: Drop string form of expected output data of "echo" tests
Peter Krempa [Tue, 12 Mar 2024 13:34:03 +0000 (14:34 +0100)]
virshtest: Drop string form of expected output data of "echo" tests

Now that the output is tested against files these are not needed any
more. The brief existence of both proved that the output is identical.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirshtest: Test against output files ("echo" tests)
Peter Krempa [Tue, 12 Mar 2024 13:13:19 +0000 (14:13 +0100)]
virshtest: Test against output files ("echo" tests)

Managing output files is much simpler especially with
VIR_TEST_REGENERATE_OUTPUT compared to putting the expected string blobs
into the C source file.

For now the output is tested both against the hardcoded strings as well
as the output files.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirshtest: Prepare for simpler testing - echo tests
Peter Krempa [Tue, 12 Mar 2024 12:38:24 +0000 (13:38 +0100)]
virshtest: Prepare for simpler testing - echo tests

Embedding the expected output in a C source code makes it very hard to
extend tests. In order to be able to test the outputs against data in
files on disk we need better naming of the tests themselves.

Use virTestCounterNext/Reset with appropriate tags to give reasonable
names to the 'virsh echo' tests' and prepare the 'DO_TEST' macro for
wider use.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirshtest: Adapt some 'escaping' tests via DO_TEST_SCRIPT
Peter Krempa [Wed, 20 Mar 2024 15:27:18 +0000 (16:27 +0100)]
virshtest: Adapt some 'escaping' tests via DO_TEST_SCRIPT

Express what's possible via a "virsh script" rather than invoking
separate virsh for each one.

We need to keep a few for parity as the argument parser behaves
differently when processing argv-like input compared to a string.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirshtest: Drop some redundant 'echo' cases
Peter Krempa [Wed, 20 Mar 2024 14:40:02 +0000 (15:40 +0100)]
virshtest: Drop some redundant 'echo' cases

Both argument passing and multiple command handling is already tested in
the 'multiple commands' cases.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirshtest: Adapt 'echo --split' tests to DO_TEST_SCRIPT
Peter Krempa [Wed, 20 Mar 2024 13:42:46 +0000 (14:42 +0100)]
virshtest: Adapt 'echo --split' tests to DO_TEST_SCRIPT

Optimize invocation of the tests to share one 'virsh' binary as they
don't influence each other.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirshtest: Add support for testing commands read from input file and adapt alias...
Peter Krempa [Wed, 20 Mar 2024 08:48:32 +0000 (09:48 +0100)]
virshtest: Add support for testing commands read from input file and adapt alias tests

Add support for reading a file and passing it to virsh in 'batch' mode
so that multiple commands can be easily tested with one invocation of
virsh.

To show how it's used adapt the alias handling tests to be invoked all
at once.

As in batch mode the arguments are read from a string and separated
inside virsh, one test is kept separate to be parsed in argv mode.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirshtest: Filter multiple occurences of string to drop in testFilterLine
Peter Krempa [Wed, 20 Mar 2024 16:45:56 +0000 (17:45 +0100)]
virshtest: Filter multiple occurences of string to drop in testFilterLine

Upcoming patches will require that possibly multiple occurences of the
string to drop are present in the output string thus we need to adapt
testFilterLine to handle them.

Additionally we drop the unused return value.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirshtest: Allow to test failure of commands
Peter Krempa [Tue, 12 Mar 2024 16:15:39 +0000 (17:15 +0100)]
virshtest: Allow to test failure of commands

Modify the test code so that if virsh fails both 'stdout' and 'stderr'
are captured and compared against the output and also the return value
is checked by appending it to the output.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirshtest: Prepare for testing against output files
Peter Krempa [Tue, 12 Mar 2024 12:52:48 +0000 (13:52 +0100)]
virshtest: Prepare for testing against output files

Modify testCompareOutputLit to take a filename argument and compare it
against and populate the arguments.

For tests which don't use the 'data' from virTestRun, we'll expect to
pass the output filename, thus we also propagate it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovshCmdOptDef: Remove unused 'flags' member
Peter Krempa [Mon, 11 Mar 2024 12:22:23 +0000 (13:22 +0100)]
vshCmdOptDef: Remove unused 'flags' member

Drop the last enum member VSH_OFLAG_NONE and remove the 'flags' variable
from vshCmdOptDef.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovsh: Replace 'VSH_OFLAG_EMPTY_OK' bitwise flag with a separate struct member
Peter Krempa [Mon, 11 Mar 2024 12:17:50 +0000 (13:17 +0100)]
vsh: Replace 'VSH_OFLAG_EMPTY_OK' bitwise flag with a separate struct member

Replace the last bitwise flag with a separate member.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovsh: Make positional parsing of arguments opt-in
Peter Krempa [Tue, 5 Mar 2024 21:37:43 +0000 (22:37 +0100)]
vsh: Make positional parsing of arguments opt-in

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 design.

This patch retires VSH_OFLAG_REQ_OPT along with the infrastructure that
was needed to refactor all uses properly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirt-admin: Annodate 'unwanted_positional' arguments
Peter Krempa [Thu, 14 Mar 2024 16:17:19 +0000 (17:17 +0100)]
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>
13 months agovirsh: Annodate 'unwanted_positional' arguments
Peter Krempa [Thu, 14 Mar 2024 16:17:19 +0000 (17:17 +0100)]
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>
13 months agovirsh: Annotate "unwanted_positional" arguments for 'pool-(define|create)-as' commands
Peter Krempa [Wed, 13 Mar 2024 21:54:05 +0000 (22:54 +0100)]
virsh: Annotate "unwanted_positional" arguments for 'pool-(define|create)-as' commands

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 <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirsh: volume: Mark optional 'pool' argument as 'positional'
Peter Krempa [Thu, 14 Mar 2024 14:34:03 +0000 (15:34 +0100)]
virsh: volume: Mark optional 'pool' argument as 'positional'

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: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirsh: Annotate some optional arguments as positional
Peter Krempa [Thu, 14 Mar 2024 16:13:05 +0000 (17:13 +0100)]
virsh: Annotate some optional arguments as positional

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 <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirsh-backup: Fix argument annotations of 'backup-begin' command
Peter Krempa [Thu, 14 Mar 2024 17:05:07 +0000 (18:05 +0100)]
virsh-backup: Fix argument annotations of 'backup-begin' command

Mark the 'backupxml' as positional optional and the 'checkpointxml' as
'unwanted_positional' to preserve the positional parsing quirk.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirsh: Make '(snapshot|checkpoint)-create' 'xmlfile' argument positional
Peter Krempa [Thu, 14 Mar 2024 16:25:02 +0000 (17:25 +0100)]
virsh: Make '(snapshot|checkpoint)-create' 'xmlfile' argument positional

The argument is optional thus couldn't be marked as positional until now,
despite being parsed positionally.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirsh: snapshot: Make 'snapshotname' argument positional
Peter Krempa [Wed, 13 Mar 2024 22:01:18 +0000 (23:01 +0100)]
virsh: snapshot: Make 'snapshotname' argument positional

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 <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovsh: Make the only argument of 'connect', 'cd', and 'help' commands positional
Peter Krempa [Thu, 14 Mar 2024 15:58:40 +0000 (16:58 +0100)]
vsh: Make the only argument of 'connect', 'cd', and 'help' commands positional

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 <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovsh: Allow one optional positional argument
Peter Krempa [Thu, 14 Mar 2024 15:21:58 +0000 (16:21 +0100)]
vsh: Allow one optional positional argument

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 <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirsh-checkpoint: Make 'checkpointname' positional and required
Peter Krempa [Thu, 14 Mar 2024 15:56:16 +0000 (16:56 +0100)]
virsh-checkpoint: Make 'checkpointname' positional and required

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 virshLookupCheckpoint.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirsh: Require option flags for all optional arguments of 'attach-disk'
Peter Krempa [Wed, 13 Mar 2024 21:57:04 +0000 (22:57 +0100)]
virsh: Require option flags for all optional arguments of 'attach-disk'

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
 <disk type='file' device='10'>
   <driver name='5' type='6' iothread='7' cache='8' io='9'/>
   <source file='2'/>
   <target dev='3' bus='4'/>
 </disk>

While making virsh require the flags is technically a breaking change,
there were multiple instances where arguments were added to the argument
list thus changing the order the positional arguments would be
interpreted as. Examples are commits: 7e157858b4bbc5a8090afa,
ca21d75d25. As of such there are multiple breaks of compatibility for
the positional arguments.

As of such, require the option flag for all optional arguments with
value for 'virsh attach-disk'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirsh: Fix "positional" argument annotations for 'migrate' command
Peter Krempa [Wed, 13 Mar 2024 21:52:12 +0000 (22:52 +0100)]
virsh: Fix "positional" argument annotations for 'migrate' command

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 chronological order per
git history.

All others are annotated with VSH_OFLAG_REQ_OPT which makes the parser
require the '--optionname'. This is due to the fact that '--disks-uri'
was introduced later and put in front of others declared earlier
breaking the order they would be accepted, thus changing the behaviour
between versions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirsh: Require option flags for 'blkdeviotune' arguments
Peter Krempa [Wed, 13 Mar 2024 21:50:02 +0000 (22:50 +0100)]
virsh: Require option flags for 'blkdeviotune' arguments

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 blkdeviotune cd vda 4 5
  error: Unable to change block I/O throttle
  error: invalid argument: total and read/write of bytes_sec cannot be set at the same time

The above is produced by all implementations of the API (qemu and test
drivers). It is true that the first tunable can be specified
positionally (--total-bytes-sec) but it is misleading and shoud not be
allowed either.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovsh: Fix option formatting for 'VHS_OT_ARGV' options
Peter Krempa [Wed, 13 Mar 2024 15:58:52 +0000 (16:58 +0100)]
vsh: Fix option formatting for 'VHS_OT_ARGV' options

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) despite being required.

Similarly in the DESCRIPTION section positional versions would not show
the optional argument name and also didn't use the three dots to signal
that it can be used multiple times.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirsh: Annotate rest of _ARGV arguments as positional
Peter Krempa [Wed, 13 Mar 2024 21:45:04 +0000 (22:45 +0100)]
virsh: Annotate rest of _ARGV arguments as positional

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 <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirsh: Annotate '--diskspec' _ARGV options as unwanted positional
Peter Krempa [Wed, 13 Mar 2024 21:44:44 +0000 (22:44 +0100)]
virsh: Annotate '--diskspec' _ARGV options as unwanted positional

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 <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovsh: Introduce annotation for vsh options which are unexpectedly parsed positionally
Peter Krempa [Wed, 13 Mar 2024 21:31:20 +0000 (22:31 +0100)]
vsh: Introduce annotation for vsh options which are unexpectedly parsed positionally

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 <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovsh: Introduce tool to find unwanted positional arguments to 'self-test'
Peter Krempa [Wed, 13 Mar 2024 20:13:44 +0000 (21:13 +0100)]
vsh: Introduce tool to find unwanted positional arguments to 'self-test'

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 unless VSH_OFLAG_REQ_OPT is used in the flags.

This creates situations such as 'snapshot-create-as' which has the
following docs:

SYNOPSIS
  snapshot-create-as <domain> [--name <string>] [--description <string>]
    [--print-xml] [--no-metadata] [--halt] [--disk-only]
    [--reuse-external] [--quiesce] [--atomic] [--live] [--validate]
    [--memspec <string>] [[--diskspec] <string>]...

Thus showing as if '--name' and '--description' required the option, but
in fact the following happens when only positionals are passed:

  $ virsh snapshot-create-as --print-xml 1 2 3 4 5
  <domainsnapshot>
    <name>2</name>
    <description>3</description>
    <disks>
      <disk name='4'/>
      <disk name='5'/>
    </disks>
  </domainsnapshot>

In the above example e.g. '--memspec' is not populated.

This disconnect makes it impossible to refactor the parser itself and
allows users to write buggy interactions with virsh.

In order to address this we'll be annotating every single of these
unwanted positional options as such so that this doesn't happen in the
future, while still preserving the quirk in the parser.

This patch introduces a tool which outputs list of options which are not
marked as positional but are lacking the VSH_OFLAG_REQ_OPT flag.

This tool will be removed once all the offenders found by it will be
addressed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirsh: Inline VIRSH_COMMON_OPT_NETWORK_OT_STRING macro
Peter Krempa [Thu, 14 Mar 2024 21:22:08 +0000 (22:22 +0100)]
virsh: Inline VIRSH_COMMON_OPT_NETWORK_OT_STRING macro

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 <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirsh: Inline VIRSH_COMMON_OPT_FILE_FULL macro
Peter Krempa [Thu, 14 Mar 2024 21:14:31 +0000 (22:14 +0100)]
virsh: Inline VIRSH_COMMON_OPT_FILE_FULL macro

The macro is used in one place only and the command definition will be
altered. Inline it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirsh: Inline VIRSH_COMMON_OPT_DOMAIN_OT_STRING macro
Peter Krempa [Thu, 14 Mar 2024 21:09:06 +0000 (22:09 +0100)]
virsh: Inline VIRSH_COMMON_OPT_DOMAIN_OT_STRING macro

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 <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovshCmddefCheckInternals: Improve some checks
Peter Krempa [Thu, 14 Mar 2024 09:31:17 +0000 (10:31 +0100)]
vshCmddefCheckInternals: Improve some checks

 - 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 <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovshCmddefHelp: Drop empty line at the end
Peter Krempa [Wed, 13 Mar 2024 14:54:47 +0000 (15:54 +0100)]
vshCmddefHelp: Drop empty line at the end

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 <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agoqemu_snapshot: correctly update metadata when deleting external snapshot with multipl...
Pavel Hrdina [Wed, 21 Feb 2024 16:45:50 +0000 (17:45 +0100)]
qemu_snapshot: correctly update metadata when deleting external snapshot with multiple branches

XML metadata for snapshot contains only single list of disk overlays
from the moment when the snapshot was taken. When user creates multiple
branches of snapshots the parent snapshot will still list only the
original disk overlays. This may cause an issue in a specific scenario:

     s1
      |
      +- s2
      +- s3 (active)

For this snapshot topology when we delete s2 metadata for s1 are not
updated. Now when we delete s1 the code operated with incorrect
overlays from s1 metadata in order to update s3 metadata resulting in no
changes to s3 metadata.

Now when user tries to delete s3 it fails with following error:

    error: Failed to delete snapshot s3
    error: operation failed: snapshot VM disk source and parent disk source are not the same

For the actual deletion there is a code to figure out the correct disk
source but it was not used to update metadata as well. Due to reasons
how block commit in libvirt works we need to create a copy of that disk
source in order to have it available when updating metadata as the
original source will be freed at that point.

Resolves: https://issues.redhat.com/browse/RHEL-26276
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
13 months agoqemu_snapshot: call qemuSnapshotDeleteUpdateDisks only for external snapshots
Pavel Hrdina [Wed, 21 Feb 2024 16:45:08 +0000 (17:45 +0100)]
qemu_snapshot: call qemuSnapshotDeleteUpdateDisks only for external snapshots

Calling this function when deleting internal snapshot isn't required
because with internal snapshots all changes are done within the file
itself so there is no file deletion and no need to update snapshot
metadata.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
13 months agoPost-release version bump to 10.3.0
Jiri Denemark [Tue, 2 Apr 2024 11:43:31 +0000 (13:43 +0200)]
Post-release version bump to 10.3.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
13 months agoRelease of libvirt-10.2.0
Jiri Denemark [Tue, 2 Apr 2024 11:38:48 +0000 (13:38 +0200)]
Release of libvirt-10.2.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
13 months agoTranslated using Weblate (Korean)
김인수 [Fri, 29 Mar 2024 14:36:18 +0000 (15:36 +0100)]
Translated using Weblate (Korean)

Currently translated at 100.0% (10438 of 10438 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/ko/

Co-authored-by: 김인수 <simmon@nplob.com>
Signed-off-by: 김인수 <simmon@nplob.com>
13 months agoNEWS: Update
Ján Tomko [Wed, 27 Mar 2024 15:05:51 +0000 (16:05 +0100)]
NEWS: Update

Update NEWS with new news.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
13 months agoNEWS: Mention fix for PCI VPD error reporting
Peter Krempa [Wed, 27 Mar 2024 15:39:55 +0000 (16:39 +0100)]
NEWS: Mention fix for PCI VPD error reporting

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agopci: Remove error reporting from PCI VPD parsing
Peter Krempa [Tue, 26 Mar 2024 14:06:58 +0000 (15:06 +0100)]
pci: Remove error reporting from PCI VPD parsing

The PCI VPD (Vital Product Data) may be missing or the kernel can report
presence but not actually have the data. Also the data is specified by
the device vendor and thus may be invalid in some cases.

To avoid log spamming, since the only usage in the node device driver is
ignoring errors, remove all error reporting.

Closes: https://gitlab.com/libvirt/libvirt/-/issues/607
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agovirpcivpd: Revert error reporting from PCI VPD parser
Peter Krempa [Wed, 27 Mar 2024 12:52:54 +0000 (13:52 +0100)]
virpcivpd: Revert error reporting from PCI VPD parser

The VPD parsing is fragile and depends on hardware vendor's adherance to
standards. Since libvirt only ever uses this data to report it in the
nodedev XML which ignores any errors there's no much point in having
error reporting which I've added recently.

Turn the errors into VIR_DEBUG statements in preparation for upcoming
patch which completely removes the expectation to report errors.

This effectively reverts commits dfc85658bd0 and f85a382a0e7.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agoTranslated using Weblate (Ukrainian)
Yuri Chornoivan [Wed, 27 Mar 2024 17:36:11 +0000 (18:36 +0100)]
Translated using Weblate (Ukrainian)

Currently translated at 100.0% (10438 of 10438 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/uk/

Co-authored-by: Yuri Chornoivan <yurchor@ukr.net>
Signed-off-by: Yuri Chornoivan <yurchor@ukr.net>
13 months agoTranslated using Weblate (Korean)
김인수 [Wed, 27 Mar 2024 17:36:10 +0000 (18:36 +0100)]
Translated using Weblate (Korean)

Currently translated at 99.5% (10394 of 10438 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/ko/

Co-authored-by: 김인수 <simmon@nplob.com>
Signed-off-by: 김인수 <simmon@nplob.com>
13 months agovirsh: cmdDomdisplayReload: Require option name for --type
Peter Krempa [Wed, 13 Mar 2024 16:55:53 +0000 (17:55 +0100)]
virsh: cmdDomdisplayReload: Require option name for --type

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 <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
13 months agoUpdate translation files
Weblate [Mon, 25 Mar 2024 11:29:40 +0000 (12:29 +0100)]
Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/

Co-authored-by: Weblate <noreply@weblate.org>
Signed-off-by: Fedora Weblate Translation <i18n@lists.fedoraproject.org>
13 months agopo: Refresh potfile for v10.2.0
Jiri Denemark [Mon, 25 Mar 2024 11:33:31 +0000 (12:33 +0100)]
po: Refresh potfile for v10.2.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
13 months agoqemuDomainChangeNet: Error when boot index changes in live XML
Adam Julis [Fri, 22 Mar 2024 08:12:26 +0000 (09:12 +0100)]
qemuDomainChangeNet: Error when boot index changes in live XML

If the original code detected a missing or null boot index in the
new XML, it automatically added the current value. This
autocompletion was incorrect because it was impossible to
distinguish between user intent and user error - changing the
boot order itself is forbidden and should always be an error.

Resolves: https://issues.redhat.com/browse/RHEL-23416
Fixes: aa3e07caec6179dfa6479deab14a21a493637d53
Signed-off-by: Adam Julis <ajulis@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoNEWS: Mention loongarch64 guest support
Andrea Bolognani [Thu, 21 Mar 2024 14:37:50 +0000 (15:37 +0100)]
NEWS: Mention loongarch64 guest support

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoNEWS: Fix spacing
Andrea Bolognani [Thu, 21 Mar 2024 13:47:23 +0000 (14:47 +0100)]
NEWS: Fix spacing

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoqemu: warn on pausing of guest due to watchdog or io error
Lennart Fricke [Thu, 21 Mar 2024 12:46:28 +0000 (13:46 +0100)]
qemu: warn on pausing of guest due to watchdog or io error

Change the log level for pauses of guests due to watchdog timeouts
or io errors from debug to warn to enhance the visibility of such
events.

Signed-off-by: Lennart Fricke <lennart.fricke@drehpunkt.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoAdd test script for loongarch
Xianglai Li [Thu, 21 Mar 2024 03:30:29 +0000 (11:30 +0800)]
Add test script for loongarch

Add domaincapstest qemuxml2argvtest qemuxml2xmltest
related test cases for loongarch.

Signed-off-by: Xianglai Li <lixianglai@loongson.cn>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
13 months agoImplement the method of getting host info for loongarch
Xianglai Li [Thu, 21 Mar 2024 03:30:28 +0000 (11:30 +0800)]
Implement the method of getting host info for loongarch

Implement method for loongarch to get host info, such as
cpu frequency, system info, etc.

Signed-off-by: Xianglai Li <lixianglai@loongson.cn>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
13 months agoSupport for loongarch64 in the QEMU driver
Xianglai Li [Thu, 21 Mar 2024 03:30:27 +0000 (11:30 +0800)]
Support for loongarch64 in the QEMU driver

Implement support for loongarch64 in the QEMU driver.

Signed-off-by: Xianglai Li <lixianglai@loongson.cn>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
13 months agoAdd loongarch cpu support
Xianglai Li [Thu, 21 Mar 2024 03:30:26 +0000 (11:30 +0800)]
Add loongarch cpu support

Add loongarch cpu support, Define new cpu type 'loongarch64'
and implement it's driver functions.

Signed-off-by: Xianglai Li <lixianglai@loongson.cn>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
13 months agoremote: check for negative array lengths before allocation
Daniel P. Berrangé [Fri, 15 Mar 2024 10:47:50 +0000 (10:47 +0000)]
remote: check for negative array lengths before allocation

While the C API entry points will validate non-negative lengths
for various parameters, the RPC server de-serialization code
will need to allocate memory for arrays before entering the C
API. These allocations will thus happen before the non-negative
length check is performed.

Passing a negative length to the g_new0 function will usually
result in a crash due to the negative length being treated as
a huge positive number.

This was found and diagnosed by ALT Linux Team with AFLplusplus.

CVE-2024-2494
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Found-by: Alexandr Shashkin <dutyrok@altlinux.org>
Co-developed-by: Alexander Kuznetsov <kuznetsovam@altlinux.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
13 months agoqemu: Tweak augeas schema
Andrea Bolognani [Tue, 28 Nov 2023 15:09:43 +0000 (16:09 +0100)]
qemu: Tweak augeas schema

Current entries should always be listed before obsolete ones.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
13 months agosecurity: Drop virSecurity(DAC|SELinux)SetImageLabelRelative()
Andrea Bolognani [Tue, 21 Nov 2023 17:20:32 +0000 (18:20 +0100)]
security: Drop virSecurity(DAC|SELinux)SetImageLabelRelative()

The single caller for each function passes the same value
for @src and @parent, which means that we don't really need
the additional API.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
13 months agosecurity: Drop virSecurity(DAC|SELinux)RestoreImageLabelSingle()
Andrea Bolognani [Mon, 20 Nov 2023 18:17:02 +0000 (19:17 +0100)]
security: Drop virSecurity(DAC|SELinux)RestoreImageLabelSingle()

Each one only has a single, trivial caller.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
13 months agosecurity: Fix name for _virSecurityDACChardevCallbackData
Andrea Bolognani [Tue, 21 Nov 2023 16:36:56 +0000 (17:36 +0100)]
security: Fix name for _virSecurityDACChardevCallbackData

It was clearly copied over from the SELinux driver without
updating its name in the process.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
13 months agosecurity: Fix alignment
Andrea Bolognani [Tue, 21 Nov 2023 16:17:10 +0000 (17:17 +0100)]
security: Fix alignment

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
13 months agoNEWS: Mention save & restore support for ch driver
Purna Pavan Chandra Aekkaladevi [Mon, 11 Mar 2024 09:44:07 +0000 (09:44 +0000)]
NEWS: Mention save & restore support for ch driver

Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkaladevi@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agodocs: Update doc for virDomainSave and virDomainRestore
Purna Pavan Chandra Aekkaladevi [Mon, 11 Mar 2024 09:44:06 +0000 (09:44 +0000)]
docs: Update doc for virDomainSave and virDomainRestore

ch_driver expects path to be of a dir for save/restore. So, update
the documentation at global API as well.

Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkaladevi@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoch_driver: Add additional validation for save/restore
Purna Pavan Chandra Aekkaladevi [Mon, 11 Mar 2024 09:44:05 +0000 (09:44 +0000)]
ch_driver: Add additional validation for save/restore

Save & Restore are supported without any network and hostdev config
defined. So, add a validation for it before performing save.

Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkaladevi@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoch_driver: cleanup any stale managed save dir before VM creation
Purna Pavan Chandra Aekkaladevi [Mon, 11 Mar 2024 09:44:04 +0000 (09:44 +0000)]
ch_driver: cleanup any stale managed save dir before VM creation

There are chances that libvirt process is killed and it resulting in
stale managed save dirs. So check for it, and cleanup it there's any.

Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkaladevi@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoch_driver: Implement domain restore callbacks
Purna Pavan Chandra Aekkaladevi [Mon, 11 Mar 2024 09:44:03 +0000 (09:44 +0000)]
ch_driver: Implement domain restore callbacks

Following callbacks have been implemented
* domainRestore
* domainRestoreFlags
The path parameter to these callbacks has to be of the directory where
libvirt has performed save. Additionally, call restore in `domainCreate`
if the domain has managedsave.

Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkaladevi@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoch_driver: Refactor virCHProcessStart
Purna Pavan Chandra Aekkaladevi [Mon, 11 Mar 2024 09:44:02 +0000 (09:44 +0000)]
ch_driver: Refactor virCHProcessStart

Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkaladevi@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoch_driver: Implement more save callbacks
Purna Pavan Chandra Aekkaladevi [Mon, 11 Mar 2024 09:44:01 +0000 (09:44 +0000)]
ch_driver: Implement more save callbacks

Following callbacks have been implemented
* domainSaveImageGetXMLDesc
* domainManagedSaveRemove
* domainManagedSaveGetXMLDesc
* domainHasManagedSaveImage

Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkaladevi@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoch_driver: Add domainManagedSave callback
Purna Pavan Chandra Aekkaladevi [Mon, 11 Mar 2024 09:44:00 +0000 (09:44 +0000)]
ch_driver: Add domainManagedSave callback

Create libvirt managed saveDir and pass it to CH to save the VM

Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkaladevi@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoch_driver: Add domainSave, domainSaveFlags callbacks
Purna Pavan Chandra Aekkaladevi [Mon, 11 Mar 2024 09:43:59 +0000 (09:43 +0000)]
ch_driver: Add domainSave, domainSaveFlags callbacks

Implemented save callbacks. CH's vmm.snapshot API is called to save the
domain state. The path passed to these callbacks has to be of directory
as CH takes dir as input to snapshot and saves multiple files under it.

Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkaladevi@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoch_driver: Pass virCHDriverConfig to virCHMonitorNew
Purna Pavan Chandra Aekkaladevi [Mon, 11 Mar 2024 09:43:58 +0000 (09:43 +0000)]
ch_driver: Pass virCHDriverConfig to virCHMonitorNew

Pass virCHDriverConfig to VirCHMonitorNew instead of just stateDir so
that the cfg can be used for any additional purposes.

Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkaladevi@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoch_driver: Support Save, Restore VM actions from monitor
Purna Pavan Chandra Aekkaladevi [Mon, 11 Mar 2024 09:43:57 +0000 (09:43 +0000)]
ch_driver: Support Save, Restore VM actions from monitor

Implement folowing API calls from CH monitor
* vmm.snapshot -> to save a domain
* vmm.restore -> to restore saved domain

Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkaladevi@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
13 months agoNEWS: Announce support for MTP filesystem driver type
Rayhan Faizel [Tue, 19 Mar 2024 19:43:22 +0000 (01:13 +0530)]
NEWS: Announce support for MTP filesystem driver type

Signed-off-by: Rayhan Faizel <rayhan.faizel@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>