Compare commits

...

67 Commits

Author SHA1 Message Date
Jonathon Jongsma
21af003084 qemu: enable display/ramfb for vfio pci hostdevs
Implement display="on" and ramfb="on" for vfio PCI host devices in qemu.
This enables passthrough PCI devices for display just like we did for
mdevs.

Resolves: https://issues.redhat.com/browse/RHEL-28808

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2024-04-02 11:45:54 -05:00
Jonathon Jongsma
092f933a62 conf: allow display and ramfb for vfio pci hostdevs
We already allow the user to specify display="on" and ramfb="on" for
mdev host devices. But newer GPU models will no longer use the mdev
framework, so we should enable this same functionality for other
non-mdev passthrough PCI devices.

Resolves: https://issues.redhat.com/browse/RHEL-28808

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2024-04-02 11:45:54 -05:00
Andrea Bolognani
16d37076be virsh: Show 'connected to console' message later
Right now, we display the message before actually attempting
to connect to the VM console. That operation, however, can
fail for a number of reasons: for example, is the VM doesn't
have a serial device, the output ends up looking like

  $ virsh console cirros
  Connected to domain 'cirros'
  Escape character is ^] (Ctrl + ])
  error: internal error: cannot find character device <null>

The initial message is misleading. Change things so that it's
only printed if we actually successfully connected to the VM
console.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2024-04-02 18:26:35 +02:00
Peter Krempa
1e853a64dd tests: Drop 'test-lib.sh'
We no longer have any shell-based tests that use it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
1f82833251 virshtest: Adapt virsh-uriprecedence test case
Reimplement the virsh-uriprecedence test case in virshtest. To do this
we need to add infrastructure to pass extra environment variables to the
tested virsh.

The user config files are shipped in repo rather than created in the
script.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-04-02 14:24:30 +02:00
Peter Krempa
e57ce7fb45 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
8f10dd32af 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
c92c63a5a3 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
3ace963662 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
60cc7bd1c0 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
c8d5703150 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
eb82c632e3 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
6193c4656e 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
a068dec641 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
6bc71ed27c 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
090ae2b46c 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
d8e2220c9a 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
630b229bc9 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
c96ac614a8 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
06f816cb7b 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
2aec9b399b 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
6a2712262e 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
1b3f148866 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
52fc03ef21 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
cf0d80344e 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
b65f3a01a8 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
a5e203417a 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
4b8581b8ef 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
e8e79e38e5 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
d15b79a35c 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
c63b5ee98b 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
5fd0653a39 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
f3d205ad44 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
7fca0d4d52 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
fdaf2ffb04 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
f9dbd34c49 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
99392689cb 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
86bf707838 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
de9dfeee9a 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
4b44113d7b 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
8e39542a03 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
a67f737ddf 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
100cbccecd 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
32a89fc670 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>
2024-04-02 14:24:30 +02:00
Peter Krempa
e31cd46364 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>
2024-04-02 14:24:29 +02:00
Peter Krempa
1304ef40a9 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>
2024-04-02 14:24:29 +02:00
Peter Krempa
d19b12a681 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>
2024-04-02 14:24:29 +02:00
Peter Krempa
3bbc97620a 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>
2024-04-02 14:24:29 +02:00
Peter Krempa
29f3ac4223 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>
2024-04-02 14:24:29 +02:00
Peter Krempa
0ce337b20c 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>
2024-04-02 14:24:29 +02:00
Peter Krempa
fc7934695d 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>
2024-04-02 14:24:29 +02:00
Peter Krempa
627cf466f0 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>
2024-04-02 14:24:29 +02:00
Peter Krempa
a7b10919e7 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: 7e157858b4, bc5a8090af,
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>
2024-04-02 14:24:29 +02:00
Peter Krempa
1efb794487 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>
2024-04-02 14:24:29 +02:00
Peter Krempa
39218865f4 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>
2024-04-02 14:24:29 +02:00
Peter Krempa
baa20d6eb8 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>
2024-04-02 14:24:29 +02:00
Peter Krempa
e9e3d6dff4 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>
2024-04-02 14:24:29 +02:00
Peter Krempa
4d4f4fd516 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>
2024-04-02 14:24:29 +02:00
Peter Krempa
d226a2cd70 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>
2024-04-02 14:24:29 +02:00
Peter Krempa
348010ac93 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>
2024-04-02 14:24:29 +02:00
Peter Krempa
1f3f9c81da 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>
2024-04-02 14:24:29 +02:00
Peter Krempa
d2e29eb74c 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>
2024-04-02 14:24:29 +02:00
Peter Krempa
7a696e9c3d 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>
2024-04-02 14:24:29 +02:00
Peter Krempa
25be987715 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>
2024-04-02 14:24:29 +02:00
Peter Krempa
334510a687 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>
2024-04-02 14:24:29 +02:00
Pavel Hrdina
0a164b74eb 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>
2024-04-02 14:14:26 +02:00
Pavel Hrdina
79654f425c 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>
2024-04-02 14:14:26 +02:00
143 changed files with 2970 additions and 3053 deletions

View File

@ -1386,7 +1386,7 @@ exclude_file_name_regexp--sc_prohibit_close = \
(\.p[yl]$$|\.spec\.in$$|^docs/|^(src/util/vir(file|event)\.c|src/libvirt-stream\.c|tests/(vir.+mock\.c|commandhelper\.c|qemusecuritymock\.c)|tools/nss/libvirt_nss_(leases|macs)\.c)|tools/virt-qemu-qmp-proxy$$)
exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = \
((^tests/(nodedevmdevctl|viracpi|virhostcpu|virpcitest|virstoragetest|qemunbdkit)data/|docs/js/.*\.js|docs/fonts/.*\.woff|\.diff|tests/virconfdata/no-newline\.conf$$)|\.bin)
((^tests/(nodedevmdevctl|viracpi|virhostcpu|virpcitest|virstoragetest|qemunbdkit|virshtest)data/|docs/js/.*\.js|docs/fonts/.*\.woff|\.diff|tests/virconfdata/no-newline\.conf$$)|\.bin)
exclude_file_name_regexp--sc_prohibit_fork_wrappers = \
(^(src/(util/(vircommand|virdaemon)|lxc/lxc_controller)|tests/testutils)\.c$$)
@ -1437,7 +1437,7 @@ exclude_file_name_regexp--sc_require_config_h_first = \
^(examples/|tools/virsh-edit\.c$$|tests/virmockstathelpers\.c$$|scripts/rpcgen/tests/test_demo\.c$$)
exclude_file_name_regexp--sc_trailing_blank = \
/sysinfodata/.*\.data|/virhostcpudata/.*\.cpuinfo$$
/sysinfodata/.*\.data|/virhostcpudata/.*\.cpuinfo|tests/virshtestdata/.*$$
exclude_file_name_regexp--sc_unmarked_diagnostics = \
^(scripts/apibuild.py|tests/virt-aa-helper-test|docs/js/.*\.js)$$
@ -1466,7 +1466,7 @@ exclude_file_name_regexp--sc_prohibit_mixed_case_abbreviations = \
^src/(vbox/vbox_CAPI.*.h|esx/esx_vi.(c|h)|esx/esx_storage_backend_iscsi.c)$$
exclude_file_name_regexp--sc_prohibit_empty_first_line = \
^tests/vmwareverdata/fusion-5.0.3.txt|scripts/rpcgen/tests/demo\.c$$
^tests/vmwareverdata/fusion-5.0.3.txt|scripts/rpcgen/tests/demo\.c|^tests/virshtestdata/.*$$
exclude_file_name_regexp--sc_prohibit_useless_translation = \
^tests/virpolkittest.c

View File

@ -4390,6 +4390,14 @@ or:
starting the guest or hot-plugging the device and
``virNodeDeviceReAttach`` (or ``virsh nodedev-reattach``) after hot-unplug
or stopping the guest.
:since:`Since 10.3.0` an optional ``display`` attribute may be used to
enable using a vgpu device as a display device for the guest. Supported
values are either ``on`` or ``off`` (default). There is also an optional
``ramfb`` attribute with values of either ``on`` or ``off`` (default).
When enabled, the ``ramfb`` attribute provides a memory framebuffer device
to the guest. This framebuffer allows the vgpu to be used as a boot display
before the gpu driver is loaded within the guest. ``ramfb`` requires the
``display`` attribute to be set to ``on``.
``scsi``
For SCSI devices, user is responsible to make sure the device is not used
by host. If supported by the hypervisor and OS, the optional ``sgio`` (

View File

@ -326,8 +326,6 @@ Will change current directory to *directory*. The default directory
for the ``cd`` command is the home directory or, if there is no *HOME*
variable in the environment, the root directory.
This command is only available in interactive mode.
pwd
---
@ -7673,9 +7671,11 @@ If *--parent* is specified, add a column to the output table giving
the name of the parent of each snapshot. If *--roots* is specified,
the list will be filtered to just snapshots that have no parents.
If *--tree* is specified, the output will be in a tree format, listing
just snapshot names. These three options are mutually exclusive. If
*--name* is specified only the snapshot name is printed. This option is
mutually exclusive with *--tree*.
just snapshot names. These three options are mutually exclusive.
If *--name* is specified only the snapshot name is printed optionally
followed by a tab-separated name of the parent snapshot if *--parent* is used
as well. This option is mutually exclusive with *--tree*.
If *--from* is provided, filter the list to snapshots which are
children of the given ``snapshot``; or if *--current* is provided,
@ -7989,8 +7989,11 @@ the name of the parent of each checkpoint. If *--roots* is
specified, the list will be filtered to just checkpoints that have no
parents. If *--tree* is specified, the output will be in a tree
format, listing just checkpoint names. These three options are
mutually exclusive. If *--name* is specified only the checkpoint name
is printed. This option is mutually exclusive with *--tree*.
mutually exclusive.
If *--name* is specified only the checkpoint name is printed optionally
followed by a tab-separated name of the parent checkpoint if *--parent* is used
as well. This option is mutually exclusive with *--tree*.
If *--from* is provided, filter the list to checkpoints which are
children of the given ``checkpoint``. When used in isolation or with

View File

@ -6306,6 +6306,16 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
VIR_XML_PROP_NONE,
&mdevsrc->ramfb) < 0)
return -1;
} else if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
if (virXMLPropTristateSwitch(node, "display",
VIR_XML_PROP_NONE,
&pcisrc->display) < 0)
return -1;
if (virXMLPropTristateSwitch(node, "ramfb",
VIR_XML_PROP_NONE,
&pcisrc->ramfb) < 0)
return -1;
}
switch (def->source.subsys.type) {
@ -26251,6 +26261,7 @@ virDomainHostdevDefFormat(virBuffer *buf,
const char *mode = virDomainHostdevModeTypeToString(def->mode);
virDomainHostdevSubsysSCSI *scsisrc = &def->source.subsys.u.scsi;
virDomainHostdevSubsysMediatedDev *mdevsrc = &def->source.subsys.u.mdev;
virDomainHostdevSubsysPCI *pcisrc = &def->source.subsys.u.pci;
virDomainHostdevSubsysSCSIVHost *scsihostsrc = &def->source.subsys.u.scsi_host;
const char *type;
@ -26319,7 +26330,14 @@ virDomainHostdevDefFormat(virBuffer *buf,
virBufferAsprintf(buf, " ramfb='%s'",
virTristateSwitchTypeToString(mdevsrc->ramfb));
}
if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
if (pcisrc->display != VIR_TRISTATE_SWITCH_ABSENT)
virBufferAsprintf(buf, " display='%s'",
virTristateSwitchTypeToString(pcisrc->display));
if (pcisrc->ramfb != VIR_TRISTATE_SWITCH_ABSENT)
virBufferAsprintf(buf, " ramfb='%s'",
virTristateSwitchTypeToString(pcisrc->ramfb));
}
}
virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2);

View File

@ -236,6 +236,8 @@ struct _virDomainHostdevSubsysUSB {
struct _virDomainHostdevSubsysPCI {
virPCIDeviceAddress addr; /* host address */
virDeviceHostdevPCIDriverInfo driver;
virTristateSwitch display;
virTristateSwitch ramfb;
virBitmap *origstates;
};

View File

@ -1291,15 +1291,20 @@ virDomainDefHostdevValidate(const virDomainDef *def)
}
}
if (dev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
dev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV &&
dev->source.subsys.u.mdev.ramfb == VIR_TRISTATE_SWITCH_ON) {
if (ramfbEnabled) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Only one vgpu device can have 'ramfb' enabled"));
return -1;
if (dev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) {
virTristateSwitch *ramfbsetting = NULL;
if (dev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV)
ramfbsetting = &dev->source.subsys.u.mdev.ramfb;
else if (dev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)
ramfbsetting = &dev->source.subsys.u.pci.ramfb;
if (ramfbsetting && *ramfbsetting == VIR_TRISTATE_SWITCH_ON) {
if (ramfbEnabled) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Only one vgpu device can have 'ramfb' enabled"));
return -1;
}
ramfbEnabled = true;
}
ramfbEnabled = true;
}
}

View File

@ -6267,6 +6267,7 @@
<ref name="pciaddress"/>
</element>
</element>
<ref name="hostdevsubsysvfiodisplay"/>
</interleave>
</define>
@ -6386,6 +6387,19 @@
</element>
</define>
<define name="hostdevsubsysvfiodisplay">
<optional>
<attribute name="ramfb">
<ref name="virOnOff"/>
</attribute>
</optional>
<optional>
<attribute name="display">
<ref name="virOnOff"/>
</attribute>
</optional>
</define>
<define name="hostdevsubsysmdev">
<attribute name="type">
<value>mdev</value>
@ -6397,16 +6411,7 @@
<value>vfio-ap</value>
</choice>
</attribute>
<optional>
<attribute name="ramfb">
<ref name="virOnOff"/>
</attribute>
</optional>
<optional>
<attribute name="display">
<ref name="virOnOff"/>
</attribute>
</optional>
<ref name="hostdevsubsysvfiodisplay"/>
<element name="source">
<ref name="mdevaddress"/>
</element>

View File

@ -654,6 +654,11 @@ foreach daemon : virt_daemons
install_dir: sbindir,
install_rpath: libvirt_rpath,
)
# libvirtd_prog is needed by the test suite
if daemon['name'] == 'libvirtd'
libvirtd_prog = bin
endif
endforeach

View File

@ -4735,10 +4735,16 @@ qemuBuildPCIHostdevDevProps(const virDomainDef *def,
virDomainNetTeamingInfo *teaming;
g_autofree char *host = virPCIDeviceAddressAsString(&pcisrc->addr);
const char *failover_pair_id = NULL;
const char *driver = NULL;
/* caller has to assign proper passthrough driver name */
switch (pcisrc->driver.name) {
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO:
/* ramfb support requires the nohotplug variant */
if (pcisrc->ramfb == VIR_TRISTATE_SWITCH_ON)
driver = "vfio-pci-nohotplug";
else
driver = "vfio-pci";
break;
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_KVM:
@ -4762,11 +4768,13 @@ qemuBuildPCIHostdevDevProps(const virDomainDef *def,
failover_pair_id = teaming->persistent;
if (virJSONValueObjectAdd(&props,
"s:driver", "vfio-pci",
"s:driver", driver,
"s:host", host,
"s:id", dev->info->alias,
"p:bootindex", dev->info->effectiveBootIndex,
"S:failover_pair_id", failover_pair_id,
"S:display", qemuOnOffAuto(pcisrc->display),
"B:ramfb", pcisrc->ramfb,
NULL) < 0)
return NULL;

View File

@ -2639,6 +2639,8 @@ typedef struct _qemuSnapshotDeleteExternalData {
virDomainSnapshotDiskDef *snapDisk; /* snapshot disk definition */
virDomainDiskDef *domDisk; /* VM disk definition */
virStorageSource *diskSrc; /* source of disk we are deleting */
virStorageSource *diskSrcMetadata; /* copy of diskSrc to be used when updating
metadata because diskSrc is freed */
virDomainMomentObj *parentSnap;
virDomainDiskDef *parentDomDisk; /* disk definition from snapshot metadata */
virStorageSource *parentDiskSrc; /* backing disk source of the @diskSrc */
@ -2657,6 +2659,7 @@ qemuSnapshotDeleteExternalDataFree(qemuSnapshotDeleteExternalData *data)
if (!data)
return;
virObjectUnref(data->diskSrcMetadata);
virObjectUnref(data->job);
g_slist_free_full(data->disksWithBacking, g_free);
@ -2893,6 +2896,8 @@ qemuSnapshotDeleteExternalPrepareData(virDomainObj *vm,
if (!data->diskSrc)
return -1;
data->diskSrcMetadata = virStorageSourceCopy(data->diskSrc, false);
if (!virStorageSourceIsSameLocation(data->diskSrc, snapDiskSrc)) {
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("VM disk source and snapshot disk source are not the same"));
@ -3049,6 +3054,7 @@ typedef struct _qemuSnapshotUpdateDisksData qemuSnapshotUpdateDisksData;
struct _qemuSnapshotUpdateDisksData {
virDomainMomentObj *snap;
virDomainObj *vm;
GSList *externalData;
int error;
};
@ -3078,7 +3084,8 @@ static int
qemuSnapshotUpdateDisksSingle(virDomainMomentObj *snap,
virDomainDef *def,
virDomainDef *parentDef,
virDomainSnapshotDiskDef *snapDisk)
virDomainSnapshotDiskDef *snapDisk,
virStorageSource *diskSrc)
{
virDomainDiskDef *disk = NULL;
@ -3091,7 +3098,7 @@ qemuSnapshotUpdateDisksSingle(virDomainMomentObj *snap,
if (!(parentDisk = qemuDomainDiskByName(parentDef, snapDisk->name)))
return -1;
if (virStorageSourceIsSameLocation(snapDisk->src, disk->src)) {
if (virStorageSourceIsSameLocation(diskSrc, disk->src)) {
virObjectUnref(disk->src);
disk->src = virStorageSourceCopy(parentDisk->src, false);
}
@ -3102,7 +3109,7 @@ qemuSnapshotUpdateDisksSingle(virDomainMomentObj *snap,
virStorageSource *next = disk->src->backingStore;
while (next) {
if (virStorageSourceIsSameLocation(snapDisk->src, next)) {
if (virStorageSourceIsSameLocation(diskSrc, next)) {
cur->backingStore = next->backingStore;
next->backingStore = NULL;
virObjectUnref(next);
@ -3128,17 +3135,15 @@ qemuSnapshotDeleteUpdateDisks(void *payload,
qemuDomainObjPrivate *priv = data->vm->privateData;
virQEMUDriver *driver = priv->driver;
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
virDomainSnapshotDef *snapdef = virDomainSnapshotObjGetDef(data->snap);
ssize_t i;
GSList *cur = NULL;
for (i = 0; i < snapdef->ndisks; i++) {
virDomainSnapshotDiskDef *snapDisk = &(snapdef->disks[i]);
if (snapDisk->snapshot == VIR_DOMAIN_SNAPSHOT_LOCATION_NO)
continue;
for (cur = data->externalData; cur; cur = g_slist_next(cur)) {
qemuSnapshotDeleteExternalData *curdata = cur->data;
if (qemuSnapshotUpdateDisksSingle(snap, snap->def->dom,
data->snap->def->dom, snapDisk) < 0) {
data->snap->def->dom,
curdata->snapDisk,
curdata->diskSrcMetadata) < 0) {
data->error = -1;
}
@ -3149,7 +3154,8 @@ qemuSnapshotDeleteUpdateDisks(void *payload,
dom = data->snap->def->dom;
if (qemuSnapshotUpdateDisksSingle(snap, snap->def->inactiveDom,
dom, snapDisk) < 0) {
dom, curdata->snapDisk,
curdata->diskSrcMetadata) < 0) {
data->error = -1;
}
}
@ -3513,6 +3519,7 @@ qemuSnapshotDeleteUpdateParent(virDomainObj *vm,
static int
qemuSnapshotDiscardMetadata(virDomainObj *vm,
virDomainMomentObj *snap,
GSList *externalData,
bool update_parent)
{
qemuDomainObjPrivate *priv = vm->privateData;
@ -3537,14 +3544,17 @@ qemuSnapshotDiscardMetadata(virDomainObj *vm,
if (rep.err < 0)
ret = -1;
data.snap = snap;
data.vm = vm;
data.error = 0;
virDomainMomentForEachDescendant(snap,
qemuSnapshotDeleteUpdateDisks,
&data);
if (data.error < 0)
ret = -1;
if (virDomainSnapshotIsExternal(snap)) {
data.snap = snap;
data.vm = vm;
data.externalData = externalData;
data.error = 0;
virDomainMomentForEachDescendant(snap,
qemuSnapshotDeleteUpdateDisks,
&data);
if (data.error < 0)
ret = -1;
}
virDomainMomentMoveChildren(snap, snap->parent);
}
@ -3641,7 +3651,7 @@ qemuSnapshotDiscardImpl(virQEMUDriver *driver,
}
}
if (qemuSnapshotDiscardMetadata(vm, snap, update_parent) < 0)
if (qemuSnapshotDiscardMetadata(vm, snap, externalData, update_parent) < 0)
return -1;
return 0;

View File

@ -2478,6 +2478,14 @@ qemuValidateDomainDeviceDefHostdev(const virDomainHostdevDef *hostdev,
_("Write filtering of PCI device configuration space is not supported by qemu"));
return -1;
}
if (hostdev->source.subsys.u.pci.display == VIR_TRISTATE_SWITCH_ON) {
if (def->ngraphics == 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("graphics device is needed for attribute value 'display=on' in <hostdev>"));
return -1;
}
}
break;
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST:

View File

@ -1,16 +0,0 @@
#!/bin/sh
# Ensure that libvirt fails when given nonexistent --config=FILE
. "$(dirname $0)/test-lib.sh"
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/src/libvirtd --version
fi
fail=0
$abs_top_builddir/src/libvirtd --config=no-such-conf --timeout=5 2> log
RET=$?
test "$RET" != "0" && exit 0 || exit 1

View File

@ -1,38 +0,0 @@
#!/bin/sh
# Get coverage of virsh pool-define-as XML formatting
. "$(dirname $0)/test-lib.sh"
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/tools/virsh --version
fi
fail=0
pwd=$(pwd) || fail=1
$abs_top_builddir/tools/virsh --connect test:///default \
pool-define-as --print-xml \
P dir src-host /src/path /src/dev S /target-path \
1>out 2>&1
cat <<EOF > pool-list-exp
<pool type='dir'>
<name>P</name>
<source>
<host name='src-host'/>
<dir path='/src/path'/>
<device path='/src/dev'/>
<name>S</name>
</source>
<target>
<path>/target-path</path>
</target>
</pool>
EOF
compare pool-list-exp out || fail=1
exit $fail

View File

@ -619,6 +619,20 @@ test(
suite: 'script',
)
# vsh based client self-test, which can be run directly from meson
test('virsh self-test',
virsh_prog,
args: [ '-q', '-c', 'test:///default', 'self-test' ],
suite: 'bin',
)
if conf.has('WITH_REMOTE')
test('virt-admin self-test',
virt_admin_prog,
args: [ '-q', 'self-test' ],
suite: 'bin',
)
endif
# helpers:
# each entry is a dictionary with following items:
@ -687,26 +701,15 @@ endforeach
test_scripts = []
if conf.has('WITH_LIBVIRTD')
test('libvirtd fail with missing config',
libvirtd_prog,
args: [ '--config=no-such-conf', '--timeout=5' ],
should_fail: true,
suite: 'bin',
)
test_scripts += [
'libvirtd-fail',
'libvirtd-pool',
'virsh-auth',
'virsh-checkpoint',
'virsh-cpuset',
'virsh-define-dev-segfault',
'virsh-int-overflow',
'virsh-optparse',
'virsh-output',
'virsh-read-bufsiz',
'virsh-read-non-seekable',
'virsh-schedinfo',
'virsh-self-test',
'virsh-snapshot',
'virsh-start',
'virsh-undefine',
'virsh-uriprecedence',
'virsh-vcpupin',
'virt-admin-self-test',
]
if conf.has('WITH_SECDRIVER_APPARMOR')

View File

@ -0,0 +1,46 @@
LC_ALL=C \
PATH=/bin \
HOME=/var/lib/libvirt/qemu/domain--1-D \
USER=test \
LOGNAME=test \
XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-D/.local/share \
XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-D/.cache \
XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-D/.config \
/usr/bin/qemu-system-x86_64 \
-name guest=D,debug-threads=on \
-S \
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-D/master-key.aes"}' \
-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram,pcspk-audiodev=audio1,acpi=on \
-accel kvm \
-cpu qemu64 \
-m size=262144k \
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":268435456}' \
-overcommit mem-lock=off \
-smp 1,sockets=1,cores=1,threads=1 \
-uuid aaa3ae22-fed2-bfbd-ac02-3bea3bcfad82 \
-display none \
-no-user-config \
-nodefaults \
-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
-mon chardev=charmonitor,id=monitor,mode=control \
-rtc base=utc \
-no-shutdown \
-boot strict=on \
-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
-chardev pty,id=charserial0 \
-device '{"driver":"isa-serial","chardev":"charserial0","id":"serial0","index":0}' \
-chardev pty,id=charserial1 \
-device '{"driver":"isa-serial","chardev":"charserial1","id":"serial1","index":1}' \
-chardev pty,id=charserial2 \
-device '{"driver":"isa-serial","chardev":"charserial2","id":"serial2","index":2}' \
-chardev pty,id=charparallel0 \
-device '{"driver":"isa-parallel","chardev":"charparallel0","id":"parallel0"}' \
-chardev pty,id=charparallel1 \
-device '{"driver":"isa-parallel","chardev":"charparallel1","id":"parallel1"}' \
-chardev pty,id=charparallel2 \
-device '{"driver":"isa-parallel","chardev":"charparallel2","id":"parallel2"}' \
-audiodev '{"id":"audio1","driver":"none"}' \
-device '{"driver":"ES1370","id":"sound1","audiodev":"audio1","bus":"pci.0","addr":"0x2"}' \
-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x3"}' \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
-msg timestamp=on

View File

@ -0,0 +1,65 @@
<domain type='kvm'>
<name>D</name>
<uuid>aaa3ae22-fed2-bfbd-ac02-3bea3bcfad82</uuid>
<memory unit='KiB'>262144</memory>
<currentMemory unit='KiB'>262144</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='x86_64' machine='pc'>hvm</type>
<boot dev='cdrom'/>
</os>
<features>
<acpi/>
</features>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
</cpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<controller type='usb' index='0' model='piix3-uhci'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
<controller type='pci' index='0' model='pci-root'/>
<serial type='pty'>
<target type='isa-serial' port='0'>
<model name='isa-serial'/>
</target>
</serial>
<serial type='pty'>
<target type='isa-serial' port='1'>
<model name='isa-serial'/>
</target>
</serial>
<serial type='pty'>
<target type='isa-serial' port='2'>
<model name='isa-serial'/>
</target>
</serial>
<parallel type='pty'>
<target port='0'/>
</parallel>
<parallel type='pty'>
<target port='1'/>
</parallel>
<parallel type='pty'>
<target port='2'/>
</parallel>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<sound model='pcspk'/>
<sound model='es1370'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</sound>
<audio id='1' type='none'/>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</memballoon>
</devices>
</domain>

View File

@ -1,26 +1,11 @@
#!/bin/sh
# Exercise a bug whereby defining a valid domain could kill libvirtd.
# The bug can also be exercised with a simple define/dumpxml pair to virsh.
. "$(dirname $0)/test-lib.sh"
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/tools/virsh --version
fi
fail=0
# Domain definition from Cole Robinson.
cat <<\EOF > D.xml || fail=1
<domain type='test'>
<domain type='kvm'>
<name>D</name>
<uuid>aaa3ae22-fed2-bfbd-ac02-3bea3bcfad82</uuid>
<memory unit='KiB'>262144</memory>
<currentMemory unit='KiB'>262144</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='i686' machine='pc'>hvm</type>
<type arch='x86_64' machine='pc'>hvm</type>
<boot dev='cdrom'/>
</os>
<features>
@ -31,7 +16,7 @@ cat <<\EOF > D.xml || fail=1
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-i386</emulator>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<controller type='usb' index='0'/>
<serial type='pty'>
<target port='0'/>
@ -59,18 +44,3 @@ cat <<\EOF > D.xml || fail=1
<memballoon model='virtio'/>
</devices>
</domain>
EOF
url=test:///default
$abs_top_builddir/tools/virsh --connect "$url" 'define D.xml; dumpxml D' > out 2>&1 || fail=1
cat > exp <<EOF || fail=1
Domain 'D' defined from D.xml
$(cat D.xml)
EOF
compare exp out || fail=1
exit $fail

View File

@ -0,0 +1 @@
invalid argument: Failed to parse bitmap 'aaa'

View File

@ -0,0 +1,12 @@
<domain type='qemu'>
<name>QEMUGuest1</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219136</memory>
<vcpu cpuset='aaa'>2</vcpu>
<os>
<type arch='x86_64' machine='pc'>hvm</type>
</os>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
</devices>
</domain>

View File

@ -0,0 +1,33 @@
LC_ALL=C \
PATH=/bin \
HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest2 \
USER=test \
LOGNAME=test \
XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest2/.local/share \
XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest2/.cache \
XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest2/.config \
/usr/bin/qemu-system-x86_64 \
-name guest=QEMUGuest2,debug-threads=on \
-S \
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest2/master-key.aes"}' \
-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram,acpi=off \
-accel tcg \
-cpu qemu64 \
-m size=219136k \
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
-overcommit mem-lock=off \
-smp 1,sockets=1,cores=1,threads=1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
-no-user-config \
-nodefaults \
-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
-mon chardev=charmonitor,id=monitor,mode=control \
-rtc base=utc \
-no-shutdown \
-boot strict=on \
-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
-audiodev '{"id":"audio1","driver":"none"}' \
-vnc 127.0.0.1:0,audiodev=audio1 \
-device '{"driver":"vfio-pci-nohotplug","host":"0000:06:12.5","id":"hostdev0","display":"on","ramfb":true,"bus":"pci.0","addr":"0x2"}' \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
-msg timestamp=on

View File

@ -0,0 +1,44 @@
<domain type='qemu'>
<name>QEMUGuest2</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219136</memory>
<currentMemory unit='KiB'>219136</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='x86_64' machine='pc'>hvm</type>
<boot dev='hd'/>
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
</cpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<controller type='usb' index='0' model='piix3-uhci'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
<controller type='pci' index='0' model='pci-root'/>
<controller type='ide' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes'>
<listen type='address'/>
</graphics>
<audio id='1' type='none'/>
<video>
<model type='none'/>
</video>
<hostdev mode='subsystem' type='pci' managed='no' display='on' ramfb='on'>
<source>
<address domain='0x0000' bus='0x06' slot='0x12' function='0x5'/>
</source>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</hostdev>
<memballoon model='none'/>
</devices>
</domain>

View File

@ -0,0 +1,33 @@
<domain type='qemu'>
<name>QEMUGuest2</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219136</memory>
<currentMemory unit='KiB'>219136</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='x86_64' machine='pc'>hvm</type>
<boot dev='hd'/>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<controller type='usb' index='0'>
</controller>
<controller type='pci' index='0' model='pci-root'/>
<controller type='ide' index='0'>
</controller>
<graphics type='vnc'/>
<hostdev mode='subsystem' type='pci' display='on' ramfb='on'>
<source>
<address domain='0x0000' bus='0x06' slot='0x12' function='0x5'/>
</source>
</hostdev>
<video>
<model type='none'/>
</video>
<memballoon model='none'/>
</devices>
</domain>

View File

@ -1799,6 +1799,7 @@ mymain(void)
DO_TEST_CAPS_LATEST("console-compat");
DO_TEST_CAPS_LATEST("console-compat-auto");
DO_TEST_CAPS_LATEST("console-compat-crash");
DO_TEST_CAPS_LATEST("serial-vc-chardev");
DO_TEST_CAPS_LATEST("serial-pty-chardev");
@ -2075,6 +2076,7 @@ mymain(void)
DO_TEST_CAPS_LATEST("hostdev-pci-address");
DO_TEST_CAPS_LATEST("hostdev-pci-address-device");
DO_TEST_CAPS_LATEST_PARSE_ERROR("hostdev-pci-duplicate");
DO_TEST_CAPS_LATEST("hostdev-pci-display-ramfb");
DO_TEST_CAPS_LATEST("hostdev-vfio");
DO_TEST_CAPS_LATEST("hostdev-vfio-multidomain");
DO_TEST_CAPS_LATEST("hostdev-mdev-precreated");
@ -2287,6 +2289,7 @@ mymain(void)
DO_TEST_CAPS_LATEST("cputune-numatune");
DO_TEST_CAPS_LATEST("vcpu-placement-static");
DO_TEST_CAPS_LATEST("cputune-cpuset-big-id");
DO_TEST_CAPS_LATEST_PARSE_ERROR("cpuset-invalid");
DO_TEST_CAPS_LATEST_PARSE_ERROR("numatune-memory-invalid-nodeset");
DO_TEST_CAPS_VER("numatune-memnode", "5.2.0");

View File

@ -1,280 +0,0 @@
# test-lib.sh: source this file; set up for tests
# Copyright (C) 2008-2013, 2016 Red Hat, Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library. If not, see
# <http://www.gnu.org/licenses/>.
#
# Based on an idea from GNU coreutils
_scriptdir="$(unset CDPATH; cd $(dirname $0) && pwd)"
test -z "$abs_srcdir" && abs_srcdir=$_scriptdir
test -z "$abs_builddir" && abs_builddir=$_scriptdir
test -z "$abs_top_srcdir" && abs_top_srcdir=$_scriptdir/..
test -z "$abs_top_builddir" && abs_top_builddir=$_scriptdir/..
test -z "$LC_ALL" && LC_ALL=C
# Skip this test if the shell lacks support for functions.
unset function_test
eval 'function_test() { return 11; }; function_test'
if test $? != 11; then
echo "$0: /bin/sh lacks support for functions; skipping this test." 1>&2
(exit 77); exit 77
fi
test_intro()
{
name=$1
if test "$verbose" = "0" ; then
echo "TEST: $name"
printf " "
fi
}
test_skip_case()
{
counter=$1
name=$2
reason=$3
if test "$verbose" = "0" ; then
mod=`expr \( $counter + 40 - 1 \) % 40`
if test "$counter" != 1 && test "$mod" = 0 ; then
printf " %-3d\n" `expr $counter - 1`
printf " "
fi
printf "_"
else
printf "%3d) %-60s ... SKIP\n" "$counter" "$name"
printf " case skipped: %s\n" "$reason"
fi
}
test_result()
{
counter=$1
name=$2
status=$3
if test "$verbose" = "0" ; then
mod=`expr \( $counter + 40 - 1 \) % 40`
if test "$counter" != 1 && test "$mod" = 0 ; then
printf " %-3d\n" `expr $counter - 1`
printf " "
fi
if test "$status" = "0" ; then
printf "."
else
printf "!"
fi
else
if test "$status" = "0" ; then
printf "%3d) %-60s ... OK\n" "$counter" "$name"
else
printf "%3d) %-60s ... FAILED\n" "$counter" "$name"
fi
fi
}
test_final()
{
counter=$1
status=$2
if test "$verbose" = "0" ; then
len=`expr 39 - \( \( $counter - 1 \) % 40 \)`
printf "%${len}s" ""
if test "$status" = "0" ; then
printf " %-3d OK\n" $counter
else
printf " %-3d FAILED\n" $counter
fi
fi
}
skip_test_()
{
echo "$0: skipping test: $@" 1>&2
(exit 77); exit 77
}
require_acl_()
{
getfacl --version < /dev/null > /dev/null 2>&1 \
&& setfacl --version < /dev/null > /dev/null 2>&1 \
|| skip_test_ "This test requires getfacl and setfacl."
id -u bin > /dev/null 2>&1 \
|| skip_test_ "This test requires a local user named bin."
}
require_ulimit_()
{
ulimit_works=yes
# Expect to be able to exec a program in 10MB of virtual memory,
# but not in 20KB. I chose "date". It must not be a shell built-in
# function, so you can't use echo, printf, true, etc.
# Of course, in coreutils, I could use $top_builddir/src/true,
# but this should be able to work for other projects, too.
( ulimit -v 10000; date ) > /dev/null 2>&1 || ulimit_works=no
( ulimit -v 20; date ) > /dev/null 2>&1 && ulimit_works=no
test $ulimit_works = no \
&& skip_test_ "this shell lacks ulimit support"
}
require_readable_root_()
{
test -r / || skip_test_ "/ is not readable"
}
# Skip the current test if strace is not available or doesn't work.
require_strace_()
{
strace -V < /dev/null > /dev/null 2>&1 ||
skip_test_ 'no strace program'
strace -qe unlink echo > /dev/null 2>&1 ||
skip_test_ 'strace does not work'
}
require_built_()
{
skip_=no
for i in "$@"; do
case " $built_programs " in
*" $i "*) ;;
*) echo "$i: not built" 1>&2; skip_=yes ;;
esac
done
test $skip_ = yes && skip_test_ "required program(s) not built"
}
uid_is_privileged_()
{
# Make sure id -u succeeds.
my_uid=$(id -u) \
|| { echo "$0: cannot run \`id -u'" 1>&2; return 1; }
# Make sure it gives valid output.
case $my_uid in
0) ;;
*[!0-9]*)
echo "$0: invalid output (\`$my_uid') from \`id -u'" 1>&2
return 1 ;;
*) return 1 ;;
esac
}
skip_if_()
{
case $1 in
root) skip_test_ must be run as root ;;
non-root) skip_test_ must be run as non-root ;;
*) ;; # FIXME?
esac
}
require_selinux_()
{
case `ls -Zd .` in
'? .'|'unlabeled .')
skip_test_ "this system (or maybe just" \
"the current file system) lacks SELinux support"
;;
esac
}
test_expensive()
{
if test "$VIR_TEST_EXPENSIVE" != 1; then
skip_test_ '
This test is very expensive, so it is disabled by default.
To change the default, configure with: meson -Dexpensive_tests=enabled
'
fi
}
require_root_() { uid_is_privileged_ || skip_test_ "must be run as root"; }
skip_if_root_() { uid_is_privileged_ && skip_test_ "must be run as non-root"; }
error_() { echo "$0: $@" 1>&2; (exit 1); exit 1; }
framework_failure() { error_ 'failure in testing framework'; }
mkfifo_or_skip_()
{
test $# = 1 || framework_failure
if ! mkfifo "$1"; then
# Make an exception of this case -- usually we interpret framework-creation
# failure as a test failure. However, in this case, when running on a SunOS
# system using a disk NFS mounted from OpenBSD, the above fails like this:
# mkfifo: cannot make fifo `fifo-10558': Not owner
skip_test_ 'NOTICE: unable to create test prerequisites'
fi
}
# Create mock XDG files/directories to avoid permission problems.
# As it points inside $test_dir_, it is automatically cleaned.
mock_xdg_()
{
export XDG_CONFIG_HOME="$t_/.config"
export XDG_CACHE_HOME="$t_/.cache"
export XDG_RUNTIME_HOME="$XDG_CACHE_HOME"
mkdir -p "$XDG_CONFIG_HOME/libvirt" "$XDG_CONFIG_HOME/virsh"
mkdir -p "$XDG_CACHE_HOME/libvirt" "$XDG_CACHE_HOME/virsh"
mkdir -p "$XDG_RUNTIME_HOME/libvirt" "$XDG_RUNTIME_HOME/virsh"
}
test_dir_=$(pwd)
this_test_() { echo "./$0" | sed 's,.*/,,'; }
this_test=$(this_test_)
verbose=0
if test -n "$VIR_TEST_DEBUG" || test -n "$VIR_TEST_VERBOSE" ; then
verbose=1
fi
debug() { :; }
if test "$VIR_TEST_DEBUG" = "2"; then
debug() { echo "$@"; }
fi
# This is a stub function that is run upon trap (upon regular exit and
# interrupt). Override it with a per-test function, e.g., to unmount
# a partition, or to undo any other global state changes.
cleanup_() { :; }
t_=$("mktemp" "-d" "$test_dir_/lv-$this_test.XXXXXXXXXX") \
|| error_ "failed to create temporary directory in $test_dir_"
# Run each test from within a temporary sub-directory named after the
# test itself, and arrange to remove it upon exception or normal exit.
trap 'st=$?; cleanup_; d='"$t_"';
cd '"$test_dir_"' && chmod -R u+rwx "$d" && rm -rf "$d" && exit $st' 0
trap '(exit $?); exit $?' 1 2 13 15
cd "$t_" || error_ "failed to cd to $t_"
if ( diff --version < /dev/null 2>&1 | grep GNU ) > /dev/null 2>&1; then
compare() { diff -u "$@"; }
elif ( cmp --version < /dev/null 2>&1 | grep GNU ) > /dev/null 2>&1; then
compare() { cmp -s "$@"; }
else
compare() { cmp "$@"; }
fi
# Local Variables:
# indent-tabs-mode: nil
# End:

View File

@ -1,178 +0,0 @@
#!/bin/sh
# simple testing of checkpoint APIs on test driver
# Copyright (C) 2019 Red Hat, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
. "$(dirname $0)/test-lib.sh"
test_expensive
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/tools/virsh --version
fi
fail=0
mock_xdg_ || framework_failure
# The test driver loses states between restarts, so we perform a script
# with some convenient markers for later post-processing of output.
$abs_top_builddir/tools/virsh --connect test:///default >out 2>err '
# Create a series of checkpoints, with names that intentionally sort
# differently by topology than by name. For now, it is not possible
# to create fanout without hacking through redefines.
checkpoint-create-as test c1
checkpoint-create-as test c1
checkpoint-create-as test c3
checkpoint-create-as test c2
# snapshots cannot be created while checkpoints exist
echo --err marker
snapshot-create-as test s1
echo --err marker
# Checking tree view (siblings sorted alphabetically)
checkpoint-list test --tree
# Demonstrate list filtering
checkpoint-list test --roots
checkpoint-list test --leaves
checkpoint-list test --parent --no-leaves
checkpoint-list test --from c3
checkpoint-list test --from c1 --descendants --name
# Now the tree is linear, so we have an unambiguous topological order
checkpoint-list test --name
checkpoint-list test --name --topological
# Capture some XML for later redefine
checkpoint-delete test c1
echo "<!--MarkerA-->"
checkpoint-dumpxml test c3
echo "<!--MarkerB-->"
checkpoint-dumpxml test c2
echo "<!--MarkerC-->"
# Deleting current checkpoint moves current up to remaining parent
checkpoint-delete test --children-only c3
checkpoint-list test --leaves --name
checkpoint-delete test --children c3
checkpoint-list test --leaves --name
# All done
' || fail=1
# First part is expected output, --tree results in trailing spaces,
# and checkpoint-list produces timestamps
sed 's/ *$//; s/[0-9-]\{10\} [0-9:.]* .[0-9]\{4\}/TIMESTAMP/;
/MarkerA/,/MarkerC/d' < out > out.cooked || fail=1
# Second part holds domain checkpoint XMLs
sed -n '/MarkerA/,/MarkerB/p' < out > c3.xml || fail=1
sed -n '/MarkerB/,/MarkerC/p' < out > c2.xml || fail=1
cat <<\EOF > exp || fail=1
Domain checkpoint c1 created
Domain checkpoint c3 created
Domain checkpoint c2 created
c1
|
+- c3
|
+- c2
Name Creation Time
-----------------------------------
c1 TIMESTAMP
Name Creation Time
-----------------------------------
c2 TIMESTAMP
Name Creation Time Parent
--------------------------------------------
c1 TIMESTAMP
c3 TIMESTAMP c1
Name Creation Time
-----------------------------------
c2 TIMESTAMP
c2
c3
c1
c2
c3
c1
c3
c2
Domain checkpoint c1 deleted
Domain checkpoint c3 children deleted
c3
Domain checkpoint c3 deleted
EOF
compare exp out.cooked || fail=1
cat <<EOF > exp || fail=1
error: operation failed: domain moment c1 already exists
error: marker
error: Operation not supported: cannot create snapshot while checkpoint exists
error: marker
EOF
compare exp err || fail=1
# Restore state with redefine
$abs_top_builddir/tools/virsh -c test:///default >out 2>err '
# Redefine must be in topological order; this will fail
checkpoint-create test --redefine c2.xml
echo --err marker
# This is the right order
checkpoint-create test --redefine c3.xml
checkpoint-create test --redefine c2.xml
checkpoint-list test --leaves --name
checkpoint-info test c2
' || fail=1
cat <<\EOF > exp || fail=1
Domain checkpoint c3 created from 'c3.xml'
Domain checkpoint c2 created from 'c2.xml'
c2
Name: c2
Domain: test
Parent: c3
Children: 0
Descendants: 0
EOF
compare exp out || fail=1
cat <<EOF > exp || fail=1
error: invalid argument: parent c3 for moment c2 not found
error: marker
EOF
compare exp err || fail=1
(exit $fail); exit $fail

View File

@ -1,46 +0,0 @@
#!/bin/sh
# ensure that defining with an invalid vCPU cpuset elicits a diagnostic
# Copyright (C) 2008-2009 Red Hat, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
. "$(dirname $0)/test-lib.sh"
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/tools/virsh --version
fi
fail=0
# generate input
$abs_top_builddir/tools/virsh --connect test:///default dumpxml 1 > xml || fail=1
# require the presence of the string we'll transform
grep '<vcpu placement' xml > /dev/null || fail=1
sed "s/vcpu placement='static'>/vcpu cpuset='aaa'>/" xml > xml-invalid || fail=1
# Require failure and a diagnostic.
$abs_top_builddir/tools/virsh --connect test:///default define xml-invalid > out 2>&1 && fail=1
cat <<\EOF > exp || fail=1
error: Failed to define domain from xml-invalid
error: invalid argument: Failed to parse bitmap 'aaa'
EOF
compare exp out || fail=1
(exit $fail); exit $fail

View File

@ -1,18 +0,0 @@
#!/bin/sh
# Ensure that an invalid domain ID isn't interpreted as a valid one.
# Before, an ID of 2^32+2 would be treated just like an ID of 2.
. "$(dirname $0)/test-lib.sh"
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/tools/virsh --version
fi
echo "error: failed to get domain '4294967298'" > exp || fail=1
$abs_top_builddir/tools/virsh --quiet \
--connect test://$abs_top_srcdir/examples/xml/test/testnode.xml \
'domname 4294967298; quit' > /dev/null 2> err || fail=1
diff -u err exp || fail=1
exit $fail

View File

@ -1,292 +0,0 @@
#!/bin/sh
# Ensure that virsh option parsing doesn't regress
# Copyright (C) 2011-2012, 2014 Red Hat, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
. "$(dirname $0)/test-lib.sh"
test_expensive
VIRSH=$abs_top_builddir/tools/virsh
if test "$VERBOSE" = yes; then
set -x
$VIRSH --version
fi
cat <<\EOF > exp-out || framework_failure
setvcpus: <domain> trying as domain NAME
setvcpus: count(optdata): 2
setvcpus: domain(optdata): test
setvcpus: found option <domain>: test
EOF
fail=0
test_url=test:///default
for args in \
'test 2' \
'--domain test 2' \
'--domain=test 2' \
'test --count 2' \
'test --count=2' \
'--domain test --count 2' \
'--domain=test --count 2' \
'--domain test --count=2' \
'--domain=test --count=2' \
'--count 2 --domain test' \
'--count 2 --domain=test' \
'--count=2 --domain test' \
'--count=2 --domain=test' \
'--count 2 test' \
'--count=2 test' \
; do
$VIRSH -k0 -d0 -c $test_url setvcpus $args >out 2>>err || fail=1
LC_ALL=C sort out | compare exp-out - || fail=1
done
# Another complex parsing example
cat <<\EOF > exp-out || framework_failure
<domainsnapshot>
<description>1&lt;2</description>
<memory file='d,e'/>
<disks>
<disk name='vda' snapshot='external'>
<source file='a&amp;b,c'/>
</disk>
<disk name='vdb'/>
</disks>
</domainsnapshot>
EOF
$VIRSH -q -c $test_url snapshot-create-as --print-xml test \
--diskspec 'vda,file=a&b,,c,snapshot=external' --description '1<2' \
--diskspec vdb --memspec file=d,,e >out 2>>err || fail=1
compare exp-out out || fail=1
cat <<\EOF > exp-out || framework_failure
<domainsnapshot>
<name>name</name>
<description>vda</description>
<disks>
<disk name='vdb'/>
</disks>
</domainsnapshot>
EOF
$VIRSH -q -c $test_url snapshot-create-as --print-xml test name vda vdb \
>out 2>>err || fail=1
compare exp-out out || fail=1
cat <<\EOF > exp-out || framework_failure
<domainsnapshot>
<name>name</name>
<description>desc</description>
<disks>
<disk name='vda'/>
<disk name='vdb'/>
</disks>
</domainsnapshot>
EOF
for args in \
'test name desc vda vdb' \
'test name desc --diskspec vda vdb' \
'test name desc --diskspec vda --diskspec vdb' \
'test name desc vda vdb' \
'test --diskspec vda name --diskspec vdb desc' \
'--description desc --name name --domain test vda vdb' \
'--description desc --diskspec vda --name name --domain test vdb' \
; do
$VIRSH -q -c $test_url snapshot-create-as --print-xml $args \
>out 2>>err || fail=1
compare exp-out out || fail=1
done
test -s err && fail=1
# Test a required argv
cat <<\EOF > exp-err || framework_failure
error: this function is not supported by the connection driver: virDomainQemuMonitorCommand
EOF
$VIRSH -q -c $test_url qemu-monitor-command test a >out 2>err && fail=1
test -s out && fail=1
compare exp-err err || fail=1
### Test a regular numeric option
# Non-numeric value
cat <<\EOF > exp-err || framework_failure
error: Numeric value 'abc' for <start> option is malformed or out of range
EOF
$VIRSH -q -c $test_url cpu-stats test --start abc >out 2>err && fail=1
test -s out && fail=1
compare exp-err err || fail=1
# Numeric value with invalid suffix
cat <<\EOF > exp-err || framework_failure
error: Numeric value '42WB' for <start> option is malformed or out of range
EOF
$VIRSH -q -c $test_url cpu-stats test --start 42WB >out 2>err && fail=1
test -s out && fail=1
compare exp-err err || fail=1
# Numeric value with valid suffix. Suffixes are not supported for
# regular numeric options, so this value is rejected
cat <<\EOF > exp-err || framework_failure
error: Numeric value '42MB' for <start> option is malformed or out of range
EOF
$VIRSH -q -c $test_url cpu-stats test --start 42MB >out 2>err && fail=1
test -s out && fail=1
compare exp-err err || fail=1
# Numeric value bigger than INT_MAX
cat <<\EOF > exp-err || framework_failure
error: Numeric value '2147483648' for <start> option is malformed or out of range
EOF
$VIRSH -q -c $test_url cpu-stats test --start 2147483648 >out 2>err && fail=1
test -s out && fail=1
compare exp-err err || fail=1
# Negative numeric value. The value is not valid for the command
# we're testing, but it has been parsed correctly
cat <<\EOF > exp-err || framework_failure
error: Invalid value for start CPU
EOF
$VIRSH -q -c $test_url cpu-stats test --start -1 >out 2>err && fail=1
test -s out && fail=1
compare exp-err err || fail=1
### Test a scaled numeric option
# Non-numeric value
cat <<\EOF > exp-err || framework_failure
error: Scaled numeric value 'abc' for <size> option is malformed or out of range
EOF
$VIRSH -q -c $test_url setmaxmem test abc >out 2>err && fail=1
test -s out && fail=1
compare exp-err err || fail=1
# Numeric value with invalid suffix
cat <<\EOF > exp-err || framework_failure
error: Scaled numeric value '42WB' for <size> option is malformed or out of range
error: invalid argument: unknown suffix 'WB'
EOF
$VIRSH -q -c $test_url setmaxmem test 42WB >out 2>err && fail=1
test -s out && fail=1
compare exp-err err || fail=1
# Numeric value with valid suffix
$VIRSH -q -c $test_url setmaxmem test 42MB --config >out 2>err || fail=1
test -s out && fail=1
test -s err && fail=1
# Numeric value bigger than INT_MAX. No failure here because
# scaled numeric values are unsigned long long
$VIRSH -q -c $test_url setmaxmem test 2147483648 --config >out 2>err || fail=1
test -s out && fail=1
test -s err && fail=1
# Negative numeric value
cat <<\EOF > exp-err || framework_failure
error: Scaled numeric value '-1' for <size> option is malformed or out of range
EOF
$VIRSH -q -c $test_url setmaxmem test -1 >out 2>err && fail=1
test -s out && fail=1
compare exp-err err || fail=1
# Zero. The value is not valid for the command we're testing, but
# it has been parsed correctly
cat <<\EOF > exp-err || framework_failure
error: Unable to change MaxMemorySize
error: memory in virDomainSetMemoryFlags must not be zero
EOF
$VIRSH -q -c $test_url setmaxmem test 0 >out 2>err && fail=1
test -s out && fail=1
compare exp-err err || fail=1
# Numeric value
$VIRSH -q -c $test_url setmaxmem test 42 --config >out 2>err || fail=1
test -s out && fail=1
test -s err && fail=1
### Test the <timeout> option (numeric option converted to ms)
# Non-numeric value
cat <<\EOF > exp-err || framework_failure
error: Numeric value 'abc' for <timeout> option is malformed or out of range
EOF
$VIRSH -q -c $test_url event --all --timeout abc >out 2>err && fail=1
test -s out && fail=1
compare exp-err err || fail=1
# Numeric value that's too big to be converted to ms and still
# fit inside an int
cat <<\EOF > exp-err || framework_failure
error: Numeric value '2147484' for <timeout> option is malformed or out of range
EOF
$VIRSH -q -c $test_url event --all --timeout 2147484 >out 2>err && fail=1
test -s out && fail=1
compare exp-err err || fail=1
# Numeric value with invalid suffix
cat <<\EOF > exp-err || framework_failure
error: Numeric value '42WB' for <timeout> option is malformed or out of range
EOF
$VIRSH -q -c $test_url event --all --timeout 42WB >out 2>err && fail=1
test -s out && fail=1
compare exp-err err || fail=1
# Numeric value with valid suffix. Suffixes are not supported for
# the <timeout> option, so this value is rejected
cat <<\EOF > exp-err || framework_failure
error: Numeric value '42MB' for <timeout> option is malformed or out of range
EOF
$VIRSH -q -c $test_url event --all --timeout 42MB >out 2>err && fail=1
test -s out && fail=1
compare exp-err err || fail=1
# Negative value
cat <<\EOF > exp-err || framework_failure
error: Numeric value '-1' for <timeout> option is malformed or out of range
EOF
$VIRSH -q -c $test_url event --all --timeout -1 >out 2>err && fail=1
test -s out && fail=1
compare exp-err err || fail=1
# Zero. This is not a valid timeout, but the value is parsed
# correctly
cat <<\EOF > exp-err || framework_failure
error: Numeric value '0' for <timeout> option is malformed or out of range
EOF
$VIRSH -q -c $test_url event --all --timeout 0 >out 2>err && fail=1
test -s out && fail=1
compare exp-err err || fail=1
# Numeric value. No events will be received and the command will
# fail after a second, but the value has been parsed correctly
cat <<\EOF > exp-out || framework_failure
event loop timed out
events received: 0
EOF
$VIRSH -q -c $test_url event --all --timeout 1 >out 2>err && fail=1
test -s err && fail=1
compare exp-out out || fail=1
(exit $fail); exit $fail

View File

@ -1,29 +0,0 @@
#!/bin/sh
. "$(dirname $0)/test-lib.sh"
test_expensive
if [ ! -x /bin/bash ]; then
echo skipping test - no bash
exit 77
fi
mock_xdg_ || framework_failure
export LIBVIRT_DEFAULT_URI='test:///default'
ln -s $abs_top_builddir/tools/virsh virsh
$abs_top_srcdir/tests/virsh-output-commands > out 2>&1
echo end >> out
if compare $abs_top_srcdir/tests/virsh-output.out out; then
exit 0
else
if [ "x$VIR_TEST_REGENERATE_OUTPUT" = "x1" ]; then
cp out $abs_top_srcdir/tests/virsh-output.out
fi
exit 1
fi

View File

@ -1,94 +0,0 @@
#!/bin/bash
attach_disk()
{
./virsh attach-disk --print-xml --domain testdom $@ --source /nonexistent/file
}
set -x
./virsh attach-disk
./virsh attach-disk --print-xml --domain testdom $@ --source ""
./virsh attach-disk --print-xml --domain testdom $@ --source "" --sourcetype file
./virsh attach-disk --print-xml --domain testdom $@ --source "" --sourcetype blah
attach_disk --target hda
attach_disk --target hda --sourcetype file
attach_disk --target hda --sourcetype block
attach_disk --target hda --sourcetype nothing
attach_disk --target hda --sourcetype file --type disk
attach_disk --target hda --sourcetype block --type disk
attach_disk --target hda --sourcetype file --type cdrom
attach_disk --target hda --sourcetype block --type cdrom
attach_disk --target hda --sourcetype file --type blah
attach_disk --target hda --sourcetype block --type blah
attach_disk --target hda --sourcetype file --type disk --driver testdriver
attach_disk --target hda --sourcetype file --type disk --subdriver qcow2
attach_disk --target hda --sourcetype file --type disk --subdriver raw
attach_disk --target hda --sourcetype file --type disk --cache none
attach_disk --target hda --sourcetype file --type disk --subdriver qcow2 --cache none
attach_disk --target hda --sourcetype file --type disk --subdriver qcow2 --serial TEST_SERIAL
attach_disk --target hda --sourcetype file --type disk --mode readonly
attach_disk --target hda --sourcetype file --type disk --mode shareable
attach_disk --target hda --sourcetype file --type disk --mode whatever
attach_disk --target hda --sourcetype file --type disk --subdriver qcow2 --alias testalias
attach_disk --target hda --sourcetype file --type disk --rawio
attach_disk --target hda --sourcetype file --type disk --multifunction
attach_disk --target hda --sourcetype file --type disk --subdriver qcow2 --alias testalias --iothread 3 --mode readonly --cache none --driver qemu
attach_disk --target hda --sourcetype file --type disk --address ide:1.2.3
attach_disk --target hda --sourcetype file --type disk --address ide:1.2.4
attach_disk --target hda --sourcetype file --type disk --address ide:1:2:5
attach_disk --target sda --sourcetype file --type disk --address ide:1.2.3
attach_disk --target vda --sourcetype file --type disk --address ide:1.2.3
attach_disk --target sda --sourcetype file --type disk --address usb:12.34
attach_disk --target sda --sourcetype file --type disk --address usb:12.3
attach_disk --target sda --sourcetype file --type disk --address usb:12:34
attach_disk --target vda --sourcetype file --type disk --address usb:12.34
attach_disk --target hda --sourcetype file --type disk --address usb:12.34
attach_disk --target sda --sourcetype file --type disk --address scsi:1.2.3
attach_disk --target sda --sourcetype file --type disk --address scsi:1.2.4
attach_disk --target sda --sourcetype file --type disk --address scsi:1:2:5
attach_disk --target hda --sourcetype file --type disk --address scsi:1.2.3
attach_disk --target vda --sourcetype file --type disk --address scsi:1.2.3
attach_disk --target sda --sourcetype file --type disk --address sata:1.2.3
attach_disk --target sda --sourcetype file --type disk --address sata:1.2.4
attach_disk --target sda --sourcetype file --type disk --address sata:1:2:5
attach_disk --target hda --sourcetype file --type disk --address sata:1.2.3
attach_disk --target vda --sourcetype file --type disk --address sata:1.2.3
attach_disk --target vda --sourcetype file --type disk --address pci:12.34.56.78
attach_disk --target vda --sourcetype file --type disk --address pci:12:34:56:78
attach_disk --target vda --sourcetype file --type disk --address pci:12.34.56.aa
attach_disk --target hda --sourcetype file --type disk --address pci:12.34.56.aa
attach_disk --target sda --sourcetype file --type disk --address pci:12.34.56.aa
attach_disk --target vda --sourcetype file --type disk --address pci:12.34.56.78 --multifunction
attach_disk --target vda --sourcetype file --type disk --address pci:12:34:56:78 --multifunction
attach_disk --target vda --sourcetype file --type disk --address pci:12.34.56.aa --multifunction
attach_disk --target vda --sourcetype file --type disk --address ccw:12.34.56
attach_disk --target vda --sourcetype file --type disk --address ccw:12:34:56
attach_disk --target vda --sourcetype file --type disk --address ccw:12.34.56
attach_disk --target hda --sourcetype file --type disk --address ccw:12.34.56
attach_disk --target sda --sourcetype file --type disk --address ccw:12.34.56
attach_disk --target vda --sourcetype file --type disk --address test:12.34.56
attach_disk --target vda --sourcetype file --type disk --address test:12:34:56
attach_disk --target vda --sourcetype file --type disk --address test:12.34.56
./virsh attach-disk --print-xml --domain testdom $@ --source "" --source-protocol AAA
./virsh attach-disk --print-xml --domain testdom $@ --source "" --source-protocol AAA
attach_disk --target hda --source-protocol AAA --sourcetype file
attach_disk --target hda --sourcetype network
attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name hostname
attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name hostname:port
attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name hostname:
attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name :port
attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name :
attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name hostname:port --source-host-transport trnsp
attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-transport trnsp
attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-transport trnsp --source-host-socket /nonexistent/socket
attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-socket /nonexistent/socket

View File

@ -1,496 +0,0 @@
+ ./virsh attach-disk
error: command 'attach-disk' requires <domain> option
error: command 'attach-disk' requires <source> option
error: command 'attach-disk' requires <target> option
+ ./virsh attach-disk --print-xml --domain testdom --source ''
error: command 'attach-disk' requires <target> option
+ ./virsh attach-disk --print-xml --domain testdom --source '' --sourcetype file
error: command 'attach-disk' requires <target> option
+ ./virsh attach-disk --print-xml --domain testdom --source '' --sourcetype blah
error: command 'attach-disk' requires <target> option
+ attach_disk --target hda
+ ./virsh attach-disk --print-xml --domain testdom --target hda --source /nonexistent/file
<disk type='file'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype file
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --source /nonexistent/file
<disk type='file'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype block
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype block --source /nonexistent/file
<disk type='block'>
<source dev='/nonexistent/file'/>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype nothing
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype nothing --source /nonexistent/file
error: Unknown source type: 'nothing'
+ attach_disk --target hda --sourcetype file --type disk
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype block --type disk
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype block --type disk --source /nonexistent/file
<disk type='block' device='disk'>
<source dev='/nonexistent/file'/>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype file --type cdrom
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type cdrom --source /nonexistent/file
<disk type='file' device='cdrom'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype block --type cdrom
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype block --type cdrom --source /nonexistent/file
<disk type='block' device='cdrom'>
<source dev='/nonexistent/file'/>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype file --type blah
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type blah --source /nonexistent/file
<disk type='file' device='blah'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype block --type blah
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype block --type blah --source /nonexistent/file
<disk type='block' device='blah'>
<source dev='/nonexistent/file'/>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --driver testdriver
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --driver testdriver --source /nonexistent/file
<disk type='file' device='disk'>
<driver name='testdriver'/>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --subdriver qcow2
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --subdriver qcow2 --source /nonexistent/file
<disk type='file' device='disk'>
<driver type='qcow2'/>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --subdriver raw
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --subdriver raw --source /nonexistent/file
<disk type='file' device='disk'>
<driver type='raw'/>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --cache none
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --cache none --source /nonexistent/file
<disk type='file' device='disk'>
<driver cache='none'/>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --subdriver qcow2 --cache none
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --subdriver qcow2 --cache none --source /nonexistent/file
<disk type='file' device='disk'>
<driver type='qcow2' cache='none'/>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --subdriver qcow2 --serial TEST_SERIAL
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --subdriver qcow2 --serial TEST_SERIAL --source /nonexistent/file
<disk type='file' device='disk'>
<driver type='qcow2'/>
<source file='/nonexistent/file'/>
<target dev='hda'/>
<serial>TEST_SERIAL</serial>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --mode readonly
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --mode readonly --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
<readonly/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --mode shareable
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --mode shareable --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
<shareable/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --mode whatever
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --mode whatever --source /nonexistent/file
error: No support for whatever in command 'attach-disk'
+ attach_disk --target hda --sourcetype file --type disk --subdriver qcow2 --alias testalias
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --subdriver qcow2 --alias testalias --source /nonexistent/file
<disk type='file' device='disk'>
<driver type='qcow2'/>
<source file='/nonexistent/file'/>
<target dev='hda'/>
<alias name='testalias'/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --rawio
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --rawio --source /nonexistent/file
<disk type='file' device='disk' rawio='yes'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --multifunction
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --multifunction --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --subdriver qcow2 --alias testalias --iothread 3 --mode readonly --cache none --driver qemu
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --subdriver qcow2 --alias testalias --iothread 3 --mode readonly --cache none --driver qemu --source /nonexistent/file
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' iothread='3' cache='none'/>
<source file='/nonexistent/file'/>
<target dev='hda'/>
<readonly/>
<alias name='testalias'/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --address ide:1.2.3
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --address ide:1.2.3 --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
<address type='drive' controller='1' bus='2' unit='3'/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --address ide:1.2.4
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --address ide:1.2.4 --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
<address type='drive' controller='1' bus='2' unit='4'/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --address ide:1:2:5
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --address ide:1:2:5 --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
<address type='drive' controller='1' bus='2' unit='5'/>
</disk>
+ attach_disk --target sda --sourcetype file --type disk --address ide:1.2.3
+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type disk --address ide:1.2.3 --source /nonexistent/file
error: expecting a scsi:00.00.00 or usb:00.00 or sata:00.00.00 address.
+ attach_disk --target vda --sourcetype file --type disk --address ide:1.2.3
+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type disk --address ide:1.2.3 --source /nonexistent/file
error: expecting a pci:0000.00.00.00 or ccw:00.0.0000 address.
+ attach_disk --target sda --sourcetype file --type disk --address usb:12.34
+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type disk --address usb:12.34 --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='usb' bus='12' port='34'/>
</disk>
+ attach_disk --target sda --sourcetype file --type disk --address usb:12.3
+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type disk --address usb:12.3 --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='usb' bus='12' port='3'/>
</disk>
+ attach_disk --target sda --sourcetype file --type disk --address usb:12:34
+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type disk --address usb:12:34 --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='usb' bus='12' port='34'/>
</disk>
+ attach_disk --target vda --sourcetype file --type disk --address usb:12.34
+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type disk --address usb:12.34 --source /nonexistent/file
error: expecting a pci:0000.00.00.00 or ccw:00.0.0000 address.
+ attach_disk --target hda --sourcetype file --type disk --address usb:12.34
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --address usb:12.34 --source /nonexistent/file
error: expecting an ide:00.00.00 address.
+ attach_disk --target sda --sourcetype file --type disk --address scsi:1.2.3
+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type disk --address scsi:1.2.3 --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='drive' controller='1' bus='2' unit='3'/>
</disk>
+ attach_disk --target sda --sourcetype file --type disk --address scsi:1.2.4
+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type disk --address scsi:1.2.4 --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='drive' controller='1' bus='2' unit='4'/>
</disk>
+ attach_disk --target sda --sourcetype file --type disk --address scsi:1:2:5
+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type disk --address scsi:1:2:5 --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='drive' controller='1' bus='2' unit='5'/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --address scsi:1.2.3
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --address scsi:1.2.3 --source /nonexistent/file
error: expecting an ide:00.00.00 address.
+ attach_disk --target vda --sourcetype file --type disk --address scsi:1.2.3
+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type disk --address scsi:1.2.3 --source /nonexistent/file
error: expecting a pci:0000.00.00.00 or ccw:00.0.0000 address.
+ attach_disk --target sda --sourcetype file --type disk --address sata:1.2.3
+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type disk --address sata:1.2.3 --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='drive' controller='1' bus='2' unit='3'/>
</disk>
+ attach_disk --target sda --sourcetype file --type disk --address sata:1.2.4
+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type disk --address sata:1.2.4 --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='drive' controller='1' bus='2' unit='4'/>
</disk>
+ attach_disk --target sda --sourcetype file --type disk --address sata:1:2:5
+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type disk --address sata:1:2:5 --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='drive' controller='1' bus='2' unit='5'/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --address sata:1.2.3
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --address sata:1.2.3 --source /nonexistent/file
error: expecting an ide:00.00.00 address.
+ attach_disk --target vda --sourcetype file --type disk --address sata:1.2.3
+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type disk --address sata:1.2.3 --source /nonexistent/file
error: expecting a pci:0000.00.00.00 or ccw:00.0.0000 address.
+ attach_disk --target vda --sourcetype file --type disk --address pci:12.34.56.78
+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type disk --address pci:12.34.56.78 --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='pci' domain='0x0012' bus='0x34' slot='0x56' function='0x78'/>
</disk>
+ attach_disk --target vda --sourcetype file --type disk --address pci:12:34:56:78
+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type disk --address pci:12:34:56:78 --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='pci' domain='0x0012' bus='0x34' slot='0x56' function='0x78'/>
</disk>
+ attach_disk --target vda --sourcetype file --type disk --address pci:12.34.56.aa
+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type disk --address pci:12.34.56.aa --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='pci' domain='0x0012' bus='0x34' slot='0x56' function='0xaa'/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --address pci:12.34.56.aa
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --address pci:12.34.56.aa --source /nonexistent/file
error: expecting an ide:00.00.00 address.
+ attach_disk --target sda --sourcetype file --type disk --address pci:12.34.56.aa
+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type disk --address pci:12.34.56.aa --source /nonexistent/file
error: expecting a scsi:00.00.00 or usb:00.00 or sata:00.00.00 address.
+ attach_disk --target vda --sourcetype file --type disk --address pci:12.34.56.78 --multifunction
+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type disk --address pci:12.34.56.78 --multifunction --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='pci' domain='0x0012' bus='0x34' slot='0x56' function='0x78' multifunction='on'/>
</disk>
+ attach_disk --target vda --sourcetype file --type disk --address pci:12:34:56:78 --multifunction
+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type disk --address pci:12:34:56:78 --multifunction --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='pci' domain='0x0012' bus='0x34' slot='0x56' function='0x78' multifunction='on'/>
</disk>
+ attach_disk --target vda --sourcetype file --type disk --address pci:12.34.56.aa --multifunction
+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type disk --address pci:12.34.56.aa --multifunction --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='pci' domain='0x0012' bus='0x34' slot='0x56' function='0xaa' multifunction='on'/>
</disk>
+ attach_disk --target vda --sourcetype file --type disk --address ccw:12.34.56
+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type disk --address ccw:12.34.56 --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='ccw' cssid='0x12' ssid='0x34' devno='0x0056'/>
</disk>
+ attach_disk --target vda --sourcetype file --type disk --address ccw:12:34:56
+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type disk --address ccw:12:34:56 --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='ccw' cssid='0x12' ssid='0x34' devno='0x0056'/>
</disk>
+ attach_disk --target vda --sourcetype file --type disk --address ccw:12.34.56
+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type disk --address ccw:12.34.56 --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='ccw' cssid='0x12' ssid='0x34' devno='0x0056'/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --address ccw:12.34.56
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --address ccw:12.34.56 --source /nonexistent/file
error: expecting an ide:00.00.00 address.
+ attach_disk --target sda --sourcetype file --type disk --address ccw:12.34.56
+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type disk --address ccw:12.34.56 --source /nonexistent/file
error: expecting a scsi:00.00.00 or usb:00.00 or sata:00.00.00 address.
+ attach_disk --target vda --sourcetype file --type disk --address test:12.34.56
+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type disk --address test:12.34.56 --source /nonexistent/file
error: Invalid address.
+ attach_disk --target vda --sourcetype file --type disk --address test:12:34:56
+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type disk --address test:12:34:56 --source /nonexistent/file
error: Invalid address.
+ attach_disk --target vda --sourcetype file --type disk --address test:12.34.56
+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type disk --address test:12.34.56 --source /nonexistent/file
error: Invalid address.
+ ./virsh attach-disk --print-xml --domain testdom --source '' --source-protocol AAA
error: command 'attach-disk' requires <target> option
+ ./virsh attach-disk --print-xml --domain testdom --source '' --source-protocol AAA
error: command 'attach-disk' requires <target> option
+ attach_disk --target hda --source-protocol AAA --sourcetype file
+ ./virsh attach-disk --print-xml --domain testdom --target hda --source-protocol AAA --sourcetype file --source /nonexistent/file
error: --source-protocol option requires --sourcetype network
+ attach_disk --target hda --sourcetype network
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype network --source /nonexistent/file
error: --source-protocol option requires --sourcetype network
+ attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name hostname
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype network --source-protocol TEST --source-host-name hostname --source /nonexistent/file
<disk type='network'>
<source protocol='TEST' name='/nonexistent/file'>
<host name='hostname'/>
</source>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name hostname:port
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype network --source-protocol TEST --source-host-name hostname:port --source /nonexistent/file
<disk type='network'>
<source protocol='TEST' name='/nonexistent/file'>
<host name='hostname' port='port'/>
</source>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name hostname:
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype network --source-protocol TEST --source-host-name hostname: --source /nonexistent/file
<disk type='network'>
<source protocol='TEST' name='/nonexistent/file'>
<host name='hostname' port=''/>
</source>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name :port
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype network --source-protocol TEST --source-host-name :port --source /nonexistent/file
<disk type='network'>
<source protocol='TEST' name='/nonexistent/file'>
<host name='' port='port'/>
</source>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name :
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype network --source-protocol TEST --source-host-name : --source /nonexistent/file
<disk type='network'>
<source protocol='TEST' name='/nonexistent/file'>
<host name='' port=''/>
</source>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name hostname:port --source-host-transport trnsp
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype network --source-protocol TEST --source-host-name hostname:port --source-host-transport trnsp --source /nonexistent/file
<disk type='network'>
<source protocol='TEST' name='/nonexistent/file'>
<host transport='trnsp' name='hostname' port='port'/>
</source>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-transport trnsp
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype network --source-protocol TEST --source-host-transport trnsp --source /nonexistent/file
<disk type='network'>
<source protocol='TEST' name='/nonexistent/file'>
<host transport='trnsp'/>
</source>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-transport trnsp --source-host-socket /nonexistent/socket
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype network --source-protocol TEST --source-host-transport trnsp --source-host-socket /nonexistent/socket --source /nonexistent/file
<disk type='network'>
<source protocol='TEST' name='/nonexistent/file'>
<host transport='trnsp' socket='/nonexistent/socket'/>
</source>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-socket /nonexistent/socket
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype network --source-protocol TEST --source-host-socket /nonexistent/socket --source /nonexistent/file
error: Option --source-host-transport is required by option --source-host-socket
end

View File

@ -1,49 +0,0 @@
#!/bin/sh
# ensure that reading a file larger than BUFSIZ works
# Copyright (C) 2008, 2010 Red Hat, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
. "$(dirname $0)/test-lib.sh"
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/tools/virsh --version
fi
fail=0
# Output a valid definition, to be used as input.
$abs_top_builddir/tools/virsh -c test:///default dumpxml 1 > xml.t || fail=1
# Change the VM name and UUID
sed -e "s|<name>test</name>|<name>newtest</name>|g" \
-e "\|<uuid>.*</uuid>|d" \
xml.t > xml
for i in before after; do
# The largest BUFSIZ I've seen is 128K. This is slightly larger.
printf %132000s ' ' > sp || fail=1
in=in-$i
# Append or prepend enough spaces to push the size over the limit:
( test $i = before && cat sp xml || cat xml sp ) > $in || fail=1
$abs_top_builddir/tools/virsh --connect test:///default define $in > out || fail=1
printf "Domain 'newtest' defined from $in\n\n" > exp || fail=1
compare exp out || fail=1
done
(exit $fail); exit $fail

View File

@ -1,51 +0,0 @@
#!/bin/sh
# ensure that certain file-reading commands can handle non-seekable files
# Copyright (C) 2008 Red Hat, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
. "$(dirname $0)/test-lib.sh"
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/tools/virsh --version
fi
fail=0
cat <<\EOF > dom
<domain type='test' id='2'>
<name>t2</name>
<uuid>004b96e1-2d78-c30f-5aa5-000000000000</uuid>
<memory>8388608</memory>
<vcpu>2</vcpu>
<os>
<type>xen</type>
</os>
<on_reboot>restart</on_reboot>
<on_poweroff>destroy</on_poweroff>
<on_crash>restart</on_crash>
</domain>
EOF
$abs_top_builddir/tools/virsh -c test:///default define dom > /dev/null || fail=1
mkfifo_or_skip_ fifo
cat dom > fifo &
$abs_top_builddir/tools/virsh -c test:///default define fifo > /dev/null || fail=1
(exit $fail); exit $fail

View File

@ -1,40 +0,0 @@
#!/bin/sh
# Ensure that virsh schedinfo --set invalid=val fails
# Copyright (C) 2010-2011, 2013 Red Hat, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
. "$(dirname $0)/test-lib.sh"
VIRSH=$abs_top_builddir/tools/virsh
if test "$VERBOSE" = yes; then
set -x
$VIRSH --version
fi
printf 'Scheduler : fair\n\n' > exp-out || framework_failure
printf 'error: invalid scheduler option: j\n' > exp-err || framework_failure
fail=0
test_url=test:///default
$VIRSH -c $test_url schedinfo 1 --set j=k >out 2>err && fail=1
compare exp-out out || fail=1
compare exp-err err || fail=1
(exit $fail); exit $fail

View File

@ -1,48 +0,0 @@
#!/bin/sh
# run virsh self-test to make sure command option structures are valid
# Copyright (C) 2016 Red Hat, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
. "$(dirname $0)/test-lib.sh"
fail=0
basename=$(basename $0)
if test "x$basename" = "xvirsh-self-test" ; then
binary=virsh
extra_args="-c test:///default"
elif test "x$basename" = "xvirt-admin-self-test" ; then
binary=virt-admin
extra_args=""
else
echo "Unknown binary: $basename";
exit 1
fi
test_intro "$0"
$abs_top_builddir/tools/${binary} ${extra_args} self-test > /dev/null
status=$?
test_result 1 "$0" ${status}
if test "${status}" != "0" ; then
fail=1
fi
test_final $counter $fail
(exit $fail); exit $fail

View File

@ -1,233 +0,0 @@
#!/bin/sh
# simple testing of snapshot APIs on test driver
# Copyright (C) 2019 Red Hat, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
. "$(dirname $0)/test-lib.sh"
test_expensive
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/tools/virsh --version
fi
fail=0
mock_xdg_ || framework_failure
# The test driver loses states between restarts, so we perform a script
# with some convenient markers for later post-processing of output.
$abs_top_builddir/tools/virsh --connect test:///default >out 2>err '
# Create a series of snapshots, with names that intentionally sort
# differently by topology than by name. Use revert to create fanout.
snapshot-create-as test s1
snapshot-create-as test s1
snapshot-create-as test s3
snapshot-create-as test s2
snapshot-revert test s3
snapshot-create-as test s6
snapshot-create-as test s5
snapshot-revert test s6
snapshot-create-as test s4
snapshot-revert test s1
snapshot-create-as test s7
snapshot-create-as test s8
# checkpoints cannot be created while snapshots exist
echo --err marker
checkpoint-create-as test c1
echo --err marker
# Checking tree view (siblings sorted alphabetically)
snapshot-list test --tree
# Current was last one created, but we can change that
snapshot-current test --name
snapshot-current test s1
snapshot-current test --name
# Deleting current root leads to multiple roots, demonstrate list filtering
snapshot-delete test --current
echo --err marker
snapshot-current test --name
echo --err marker
snapshot-list test --roots
snapshot-list test --leaves
snapshot-list test --parent --no-leaves
snapshot-list test --from s3
snapshot-list test --from s3 --descendants --name
# More fun with delete flags, current node moves up to remaining parent
snapshot-current test s4
snapshot-delete test --children-only s6
snapshot-current test --name
snapshot-delete test --children s7
snapshot-current test --name
snapshot-delete test s6
snapshot-current test --name
# Now the tree is linear, so we have an unambiguous topological order
snapshot-list test --name
snapshot-list test --name --topological
# Capture some XML for later redefine
echo "<!--MarkerA-->"
snapshot-dumpxml test s3
echo "<!--MarkerB-->"
snapshot-dumpxml test s2
echo "<!--MarkerC-->"
# All done
' || fail=1
# First part is expected output, --tree results in trailing spaces,
# and snapshot-list produces timestamps
sed 's/ *$//; s/[0-9-]\{10\} [0-9:.]* .[0-9]\{4\}/TIMESTAMP/;
/MarkerA/,/MarkerC/d' < out > out.cooked || fail=1
# Second part holds domain snapshot XMLs
sed -n '/MarkerA/,/MarkerB/p' < out > s3.xml || fail=1
sed -n '/MarkerB/,/MarkerC/p' < out > s2.xml || fail=1
cat <<\EOF > exp || fail=1
Domain snapshot s1 created
Domain snapshot s3 created
Domain snapshot s2 created
Domain snapshot s3 reverted
Domain snapshot s6 created
Domain snapshot s5 created
Domain snapshot s6 reverted
Domain snapshot s4 created
Domain snapshot s1 reverted
Domain snapshot s7 created
Domain snapshot s8 created
s1
|
+- s3
| |
| +- s2
| +- s6
| |
| +- s4
| +- s5
|
+- s7
|
+- s8
s8
Snapshot s1 set as current
s1
Domain snapshot s1 deleted
Name Creation Time State
---------------------------------------------
s3 TIMESTAMP running
s7 TIMESTAMP running
Name Creation Time State
---------------------------------------------
s2 TIMESTAMP running
s4 TIMESTAMP running
s5 TIMESTAMP running
s8 TIMESTAMP running
Name Creation Time State Parent
------------------------------------------------------
s3 TIMESTAMP running
s6 TIMESTAMP running s3
s7 TIMESTAMP running
Name Creation Time State
---------------------------------------------
s2 TIMESTAMP running
s6 TIMESTAMP running
s2
s4
s5
s6
Snapshot s4 set as current
Domain snapshot s6 children deleted
s6
Domain snapshot s7 deleted
s6
Domain snapshot s6 deleted
s3
s2
s3
s3
s2
EOF
compare exp out.cooked || fail=1
cat <<EOF > exp || fail=1
error: operation failed: domain moment s1 already exists
error: marker
error: Operation not supported: cannot create checkpoint while snapshot exists
error: marker
error: marker
error: domain 'test' has no current snapshot
error: marker
EOF
compare exp err || fail=1
# Restore state with redefine
$abs_top_builddir/tools/virsh -c test:///default >out 2>err '
# Redefine must be in topological order; this will fail
snapshot-create test --redefine s2.xml --validate
echo --err marker
# This is the right order
snapshot-create test --redefine s3.xml --validate
snapshot-create test --redefine s2.xml --current --validate
snapshot-info test --current
' || fail=1
cat <<\EOF > exp || fail=1
Domain snapshot s3 created from 's3.xml'
Domain snapshot s2 created from 's2.xml'
Name: s2
Domain: test
Current: yes
State: running
Location: internal
Parent: s3
Children: 0
Descendants: 0
Metadata: yes
EOF
compare exp out || fail=1
cat <<EOF > exp || fail=1
error: invalid argument: parent s3 for moment s2 not found
error: marker
EOF
compare exp err || fail=1
(exit $fail); exit $fail

View File

@ -1,41 +0,0 @@
#!/bin/sh
# ensure that virsh start works properly
# Copyright (C) 2008 Red Hat, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
. "$(dirname $0)/test-lib.sh"
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/tools/virsh --version
fi
fail=0
test_url=test:///default
# expect this to fail
$abs_top_builddir/tools/virsh -c $test_url start test > out 2> err && fail=1
# stdout gets a newline
echo > exp || fail=1
compare exp out || fail=1
echo 'error: Domain is already active' > exp || fail=1
compare exp err || fail=1
(exit $fail); exit $fail

View File

@ -1,76 +0,0 @@
#!/bin/sh
# exercise virsh's "undefine" command
# Copyright (C) 2008-2009, 2011 Red Hat, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
. "$(dirname $0)/test-lib.sh"
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/tools/virsh --version
fi
fail=0
# Attempt to undefine a running domain, by domain name. Every time a new
# connection is opened to the test driver, it starts life with a new
# persistent running domain named 'test' with a different uuid, so
# testing this command requires batch mode use of virsh.
$abs_top_builddir/tools/virsh -c test:///default \
'dominfo test; undefine test; dominfo test' > out1 2>&1
test $? = 0 || fail=1
sed '/^Persistent/n; /:/d' < out1 > out
cat <<\EOF > exp || fail=1
Persistent: yes
Domain 'test' has been undefined
Persistent: no
EOF
compare exp out || fail=1
# A similar diagnostic when specifying a domain ID
$abs_top_builddir/tools/virsh -c test:///default \
'dominfo 1; undefine 1; dominfo 1' > out1 2>&1
test $? = 0 || fail=1
sed '/^Persistent/n; /:/d' < out1 > out
cat <<\EOF > exp || fail=1
Persistent: yes
Domain '1' has been undefined
Persistent: no
EOF
compare exp out || fail=1
# Succeed, now: first shut down, then undefine, both via name.
$abs_top_builddir/tools/virsh -c test:///default \
'shutdown test; undefine test; dominfo test' > out 2>&1
test $? = 1 || fail=1
cat <<\EOF > expout || fail=1
Domain 'test' is being shutdown
Domain 'test' has been undefined
error: failed to get domain 'test'
EOF
compare expout out || fail=1
(exit $fail); exit $fail

View File

@ -1,97 +0,0 @@
#!/bin/sh
. "$(dirname $0)/test-lib.sh"
# This test checks if virsh obeys the proper precedence of different
# URI settings
test_intro "virsh-uriprecedence"
virsh_bin="$abs_top_builddir/tools/virsh"
virsh_cmd="$virsh_bin"
counter=0
ret=0
mock_xdg_ || framework_failure
is_uri_good()
{
echo "$1" | grep -F "$good_uri" >/dev/null
}
test_uri_internal()
{
test_name=$1
test_cmd="$virsh_cmd \"$2\""
result=0
debug "Running '$test_cmd'"
out="$($virsh_cmd "$2")"
if ! is_uri_good "$out"; then
debug "Invalid output: '$out'"
result=1
ret=1
fi
counter="$((counter+1))"
test_result "$counter" "$1" "$result"
}
test_uri_connect()
{
test_uri_internal "$1" "connect; uri"
}
test_uri_noconnect()
{
test_uri_internal "$1" "uri"
}
test_uri()
{
test_uri_connect "$1"
test_uri_noconnect "$1"
}
# Precedence is the following (lowest priority first):
#
# 1) if run as root, 'uri_default' from /etc/libvirtd/libvirt.conf,
# otherwise qemu:///session. There is no way to mock this file for
# virsh/libvirt.so and the user may have set anything in there that
# would spoil the test, so we don't test this
#
# 2) 'uri_default' from $XDG_CONFIG_HOME/libvirt/libvirt.conf
#
# 3) LIBVIRT_DEFAULT_URI
#
# 4) VIRSH_DEFAULT_CONNECT_URI
#
# 5) parameter -c (--connect)
unset LIBVIRT_DEFAULT_URI
unset VIRSH_DEFAULT_CONNECT_URI
bad_uri="test:///default?bad_uri"
good_uri="test:///default?good_uri"
printf "uri_default=\"%s\"\n" "$good_uri" >"$XDG_CONFIG_HOME/libvirt/libvirt.conf"
if uid_is_privileged_; then
counter="$((counter+1))"
test_skip_case "$counter" "User config file" "must not be run as root"
else
test_uri "User config file"
fi
printf "uri_default=\"%s\"\n" "$bad_uri" >"$XDG_CONFIG_HOME/libvirt/libvirt.conf"
export LIBVIRT_DEFAULT_URI="$good_uri"
test_uri "LIBVIRT_DEFAULT_URI"
export LIBVIRT_DEFAULT_URI="$bad_uri"
export VIRSH_DEFAULT_CONNECT_URI="$good_uri"
test_uri "VIRSH_DEFAULT_CONNECT_URI"
export VIRSH_DEFAULT_CONNECT_URI="$bad_uri"
virsh_cmd="$virsh_bin --connect $good_uri"
test_uri "Parameter"
test_final "$counter" "$ret"
(exit "$ret"); exit "$ret"

View File

@ -1,100 +0,0 @@
#!/bin/sh
# ensure that an invalid CPU spec elicits a diagnostic
# Copyright (C) 2008 Red Hat, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
. "$(dirname $0)/test-lib.sh"
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/tools/virsh --version
fi
fail=0
# Invalid syntax.
$abs_top_builddir/tools/virsh --connect test:///default vcpupin test a 0,1 > out 2>&1
test $? = 1 || fail=1
cat <<\EOF > exp || fail=1
error: Numeric value 'a' for <vcpu> option is malformed or out of range
EOF
compare exp out || fail=1
# An out-of-range vCPU number deserves a diagnostic, too.
$abs_top_builddir/tools/virsh --connect test:///default vcpupin test 100 0,1 > out 2>&1
test $? = 1 || fail=1
cat <<\EOF > exp || fail=1
error: invalid argument: requested vcpu '100' is not present in the domain
EOF
compare exp out || fail=1
# Negative number
$abs_top_builddir/tools/virsh --connect test:///default vcpupin test -100 0,1 > out 2>&1
test $? = 1 || fail=1
cat <<\EOF > exp || fail=1
error: Numeric value '-100' for <vcpu> option is malformed or out of range
EOF
compare exp out || fail=1
# missing argument
$abs_top_builddir/tools/virsh --connect test:///default vcpupin test --cpulist 0,1 > out 2>&1
test $? = 1 || fail=1
cat <<\EOF > exp || fail=1
error: vcpupin: Missing vCPU number in pin mode.
EOF
compare exp out || fail=1
# An out-of-range vCPU number when get information with live flag
$abs_top_builddir/tools/virsh --connect test:///default vcpupin test 100 --live > out 2>&1
test $? = 1 || fail=1
cat <<\EOF > exp || fail=1
error: vcpu 100 is out of range of live cpu count 2
EOF
compare exp out || fail=1
# An out-of-range vCPU number when get information without flag
$abs_top_builddir/tools/virsh --connect test:///default vcpupin test 100 > out 2>&1
test $? = 1 || fail=1
cat <<\EOF > exp || fail=1
error: vcpu 100 is out of range of live cpu count 2
EOF
compare exp out || fail=1
# An out-of-range vCPU number when get information with config flag
$abs_top_builddir/tools/virsh --connect test:///default vcpupin test 100 --config > out 2>&1
test $? = 1 || fail=1
cat <<\EOF > exp || fail=1
error: vcpu 100 is out of range of persistent cpu count 2
EOF
compare exp out || fail=1
# An out-of-range vCPU number when get information with current flag
$abs_top_builddir/tools/virsh --connect test:///default vcpupin test 100 --current > out 2>&1
test $? = 1 || fail=1
cat <<\EOF > exp || fail=1
error: vcpu 100 is out of range of live cpu count 2
EOF
compare exp out || fail=1
(exit $fail); exit $fail

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,15 @@
setvcpus test 2
setvcpus --domain test 2
setvcpus --domain=test 2
setvcpus test --count 2
setvcpus test --count=2
setvcpus --domain test --count 2
setvcpus --domain=test --count 2
setvcpus --domain test --count=2
setvcpus --domain=test --count=2
setvcpus --count 2 --domain test
setvcpus --count 2 --domain=test
setvcpus --count=2 --domain test
setvcpus --count=2 --domain=test
setvcpus --count 2 test
setvcpus --count=2 test

View File

@ -0,0 +1,91 @@
commands: "setvcpus test 2
setvcpus --domain test 2
setvcpus --domain=test 2
setvcpus test --count 2
setvcpus test --count=2
setvcpus --domain test --count 2
setvcpus --domain=test --count 2
setvcpus --domain test --count=2
setvcpus --domain=test --count=2
setvcpus --count 2 --domain test
setvcpus --count 2 --domain=test
setvcpus --count=2 --domain test
setvcpus --count=2 --domain=test
setvcpus --count 2 test
setvcpus --count=2 test
"
setvcpus: domain(optdata): test
setvcpus: count(optdata): 2
setvcpus: domain(optdata): test
setvcpus: count(optdata): 2
setvcpus: domain(optdata): test
setvcpus: count(optdata): 2
setvcpus: domain(optdata): test
setvcpus: count(optdata): 2
setvcpus: domain(optdata): test
setvcpus: count(optdata): 2
setvcpus: domain(optdata): test
setvcpus: count(optdata): 2
setvcpus: domain(optdata): test
setvcpus: count(optdata): 2
setvcpus: domain(optdata): test
setvcpus: count(optdata): 2
setvcpus: domain(optdata): test
setvcpus: count(optdata): 2
setvcpus: count(optdata): 2
setvcpus: domain(optdata): test
setvcpus: count(optdata): 2
setvcpus: domain(optdata): test
setvcpus: count(optdata): 2
setvcpus: domain(optdata): test
setvcpus: count(optdata): 2
setvcpus: domain(optdata): test
setvcpus: count(optdata): 2
setvcpus: domain(optdata): test
setvcpus: count(optdata): 2
setvcpus: domain(optdata): test
setvcpus: found option <domain>: test
setvcpus: <domain> trying as domain NAME
setvcpus: found option <domain>: test
setvcpus: <domain> trying as domain NAME
setvcpus: found option <domain>: test
setvcpus: <domain> trying as domain NAME
setvcpus: found option <domain>: test
setvcpus: <domain> trying as domain NAME
setvcpus: found option <domain>: test
setvcpus: <domain> trying as domain NAME
setvcpus: found option <domain>: test
setvcpus: <domain> trying as domain NAME
setvcpus: found option <domain>: test
setvcpus: <domain> trying as domain NAME
setvcpus: found option <domain>: test
setvcpus: <domain> trying as domain NAME
setvcpus: found option <domain>: test
setvcpus: <domain> trying as domain NAME
setvcpus: found option <domain>: test
setvcpus: <domain> trying as domain NAME
setvcpus: found option <domain>: test
setvcpus: <domain> trying as domain NAME
setvcpus: found option <domain>: test
setvcpus: <domain> trying as domain NAME
setvcpus: found option <domain>: test
setvcpus: <domain> trying as domain NAME
setvcpus: found option <domain>: test
setvcpus: <domain> trying as domain NAME
setvcpus: found option <domain>: test
setvcpus: <domain> trying as domain NAME

View File

@ -0,0 +1,79 @@
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype block
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype nothing
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype block --type disk
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type cdrom
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype block --type cdrom
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type blah
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype block --type blah
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --driver testdriver
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --subdriver qcow2
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --subdriver raw
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --cache none
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --subdriver qcow2 --cache none
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --subdriver qcow2 --serial TEST_SERIAL
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --mode readonly
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --mode shareable
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --mode whatever
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --subdriver qcow2 --alias testalias
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --rawio
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --multifunction
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --subdriver qcow2 --alias testalias --iothread 3 --mode readonly --cache none --driver qemu
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --address ide:1.2.3
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --address ide:1.2.4
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --address ide:1:2:5
attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda --sourcetype file --type disk --address ide:1.2.3
attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda --sourcetype file --type disk --address ide:1.2.3
attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda --sourcetype file --type disk --address usb:12.34
attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda --sourcetype file --type disk --address usb:12.3
attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda --sourcetype file --type disk --address usb:12:34
attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda --sourcetype file --type disk --address usb:12.34
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --address usb:12.34
attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda --sourcetype file --type disk --address scsi:1.2.3
attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda --sourcetype file --type disk --address scsi:1.2.4
attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda --sourcetype file --type disk --address scsi:1:2:5
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --address scsi:1.2.3
attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda --sourcetype file --type disk --address scsi:1.2.3
attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda --sourcetype file --type disk --address sata:1.2.3
attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda --sourcetype file --type disk --address sata:1.2.4
attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda --sourcetype file --type disk --address sata:1:2:5
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --address sata:1.2.3
attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda --sourcetype file --type disk --address sata:1.2.3
attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda --sourcetype file --type disk --address pci:12.34.56.78
attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda --sourcetype file --type disk --address pci:12:34:56:78
attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda --sourcetype file --type disk --address pci:12.34.56.aa
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --address pci:12.34.56.aa
attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda --sourcetype file --type disk --address pci:12.34.56.aa
attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda --sourcetype file --type disk --address pci:12.34.56.78 --multifunction
attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda --sourcetype file --type disk --address pci:12:34:56:78 --multifunction
attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda --sourcetype file --type disk --address pci:12.34.56.aa --multifunction
attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda --sourcetype file --type disk --address ccw:12.34.56
attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda --sourcetype file --type disk --address ccw:12:34:56
attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda --sourcetype file --type disk --address ccw:12.34.56
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --address ccw:12.34.56
attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda --sourcetype file --type disk --address ccw:12.34.56
attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda --sourcetype file --type disk --address test:12.34.56
attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda --sourcetype file --type disk --address test:12:34:56
attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda --sourcetype file --type disk --address test:12.34.56
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --source-protocol AAA --sourcetype file
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype network
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype network --source-protocol TEST --source-host-name hostname
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype network --source-protocol TEST --source-host-name hostname:port
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype network --source-protocol TEST --source-host-name hostname:
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype network --source-protocol TEST --source-host-name :port
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype network --source-protocol TEST --source-host-name :
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype network --source-protocol TEST --source-host-name hostname:port --source-host-transport trnsp
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype network --source-protocol TEST --source-host-transport trnsp
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype network --source-protocol TEST --source-host-transport trnsp --source-host-socket /nonexistent/socket
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype network --source-protocol TEST --source-host-socket /nonexistent/socket

View File

@ -0,0 +1,343 @@
<disk type='file'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
<disk type='file'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
<disk type='block'>
<source dev='/nonexistent/file'/>
<target dev='hda'/>
</disk>
error: Unknown source type: 'nothing'
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
<disk type='block' device='disk'>
<source dev='/nonexistent/file'/>
<target dev='hda'/>
</disk>
<disk type='file' device='cdrom'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
<disk type='block' device='cdrom'>
<source dev='/nonexistent/file'/>
<target dev='hda'/>
</disk>
<disk type='file' device='blah'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
<disk type='block' device='blah'>
<source dev='/nonexistent/file'/>
<target dev='hda'/>
</disk>
<disk type='file' device='disk'>
<driver name='testdriver'/>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
<disk type='file' device='disk'>
<driver type='qcow2'/>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
<disk type='file' device='disk'>
<driver type='raw'/>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
<disk type='file' device='disk'>
<driver cache='none'/>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
<disk type='file' device='disk'>
<driver type='qcow2' cache='none'/>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
<disk type='file' device='disk'>
<driver type='qcow2'/>
<source file='/nonexistent/file'/>
<target dev='hda'/>
<serial>TEST_SERIAL</serial>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
<readonly/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
<shareable/>
</disk>
error: No support for whatever in command 'attach-disk'
<disk type='file' device='disk'>
<driver type='qcow2'/>
<source file='/nonexistent/file'/>
<target dev='hda'/>
<alias name='testalias'/>
</disk>
<disk type='file' device='disk' rawio='yes'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' iothread='3' cache='none'/>
<source file='/nonexistent/file'/>
<target dev='hda'/>
<readonly/>
<alias name='testalias'/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
<address type='drive' controller='1' bus='2' unit='3'/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
<address type='drive' controller='1' bus='2' unit='4'/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
<address type='drive' controller='1' bus='2' unit='5'/>
</disk>
error: expecting a scsi:00.00.00 or usb:00.00 or sata:00.00.00 address.
error: expecting a pci:0000.00.00.00 or ccw:00.0.0000 address.
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='usb' bus='12' port='34'/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='usb' bus='12' port='3'/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='usb' bus='12' port='34'/>
</disk>
error: expecting a pci:0000.00.00.00 or ccw:00.0.0000 address.
error: expecting an ide:00.00.00 address.
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='drive' controller='1' bus='2' unit='3'/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='drive' controller='1' bus='2' unit='4'/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='drive' controller='1' bus='2' unit='5'/>
</disk>
error: expecting an ide:00.00.00 address.
error: expecting a pci:0000.00.00.00 or ccw:00.0.0000 address.
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='drive' controller='1' bus='2' unit='3'/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='drive' controller='1' bus='2' unit='4'/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='drive' controller='1' bus='2' unit='5'/>
</disk>
error: expecting an ide:00.00.00 address.
error: expecting a pci:0000.00.00.00 or ccw:00.0.0000 address.
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='pci' domain='0x0012' bus='0x34' slot='0x56' function='0x78'/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='pci' domain='0x0012' bus='0x34' slot='0x56' function='0x78'/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='pci' domain='0x0012' bus='0x34' slot='0x56' function='0xaa'/>
</disk>
error: expecting an ide:00.00.00 address.
error: expecting a scsi:00.00.00 or usb:00.00 or sata:00.00.00 address.
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='pci' domain='0x0012' bus='0x34' slot='0x56' function='0x78' multifunction='on'/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='pci' domain='0x0012' bus='0x34' slot='0x56' function='0x78' multifunction='on'/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='pci' domain='0x0012' bus='0x34' slot='0x56' function='0xaa' multifunction='on'/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='ccw' cssid='0x12' ssid='0x34' devno='0x0056'/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='ccw' cssid='0x12' ssid='0x34' devno='0x0056'/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='ccw' cssid='0x12' ssid='0x34' devno='0x0056'/>
</disk>
error: expecting an ide:00.00.00 address.
error: expecting a scsi:00.00.00 or usb:00.00 or sata:00.00.00 address.
error: Invalid address.
error: Invalid address.
error: Invalid address.
error: --source-protocol option requires --sourcetype network
error: --source-protocol option requires --sourcetype network
<disk type='network'>
<source protocol='TEST' name='/nonexistent/file'>
<host name='hostname'/>
</source>
<target dev='hda'/>
</disk>
<disk type='network'>
<source protocol='TEST' name='/nonexistent/file'>
<host name='hostname' port='port'/>
</source>
<target dev='hda'/>
</disk>
<disk type='network'>
<source protocol='TEST' name='/nonexistent/file'>
<host name='hostname' port=''/>
</source>
<target dev='hda'/>
</disk>
<disk type='network'>
<source protocol='TEST' name='/nonexistent/file'>
<host name='' port='port'/>
</source>
<target dev='hda'/>
</disk>
<disk type='network'>
<source protocol='TEST' name='/nonexistent/file'>
<host name='' port=''/>
</source>
<target dev='hda'/>
</disk>
<disk type='network'>
<source protocol='TEST' name='/nonexistent/file'>
<host transport='trnsp' name='hostname' port='port'/>
</source>
<target dev='hda'/>
</disk>
<disk type='network'>
<source protocol='TEST' name='/nonexistent/file'>
<host transport='trnsp'/>
</source>
<target dev='hda'/>
</disk>
<disk type='network'>
<source protocol='TEST' name='/nonexistent/file'>
<host transport='trnsp' socket='/nonexistent/socket'/>
</source>
<target dev='hda'/>
</disk>
error: Option --source-host-transport is required by option --source-host-socket
## Exit code: 1

View File

@ -0,0 +1,3 @@
blkiotune fv0
blkiotune fv0 --weight 500 --device-weights /dev/hda,1000 --device-read-iops-sec /dev/hda,1000 --device-write-iops-sec /dev/hda,1000 --device-read-bytes-sec /dev/hda,1000 --device-write-bytes-sec /dev/hda,1000
blkiotune fv0

View File

@ -0,0 +1,15 @@
weight : 800
device_weight : /dev/hda,700
device_read_iops_sec: /dev/hda,700
device_write_iops_sec: /dev/hda,700
device_read_bytes_sec: /dev/hda,700
device_write_bytes_sec: /dev/hda,700
weight : 500
device_weight : /dev/hda,1000
device_read_iops_sec: /dev/hda,1000
device_write_iops_sec: /dev/hda,1000
device_read_bytes_sec: /dev/hda,1000
device_write_bytes_sec: /dev/hda,1000

View File

@ -0,0 +1,41 @@
<domaincheckpoint>
<name>c2</name>
<parent>
<name>c3</name>
</parent>
<creationTime>1234</creationTime>
<disks>
<disk name='vda' checkpoint='bitmap' bitmap='c2'/>
</disks>
<domain type='test'>
<name>test</name>
<uuid>6695eb01-f6a4-8304-79aa-97f2502e193f</uuid>
<memory unit='KiB'>8388608</memory>
<currentMemory unit='KiB'>2097152</currentMemory>
<vcpu placement='static'>2</vcpu>
<os>
<type arch='i686'>hvm</type>
<boot dev='hd'/>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<disk type='file' device='disk'>
<source file='/guest/diskimage1'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</disk>
<interface type='network'>
<mac address='aa:bb:cc:dd:ee:ff'/>
<source network='default'/>
<target dev='testnet0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
</interface>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</memballoon>
</devices>
</domain>
</domaincheckpoint>

View File

@ -0,0 +1,38 @@
<domaincheckpoint>
<name>c3</name>
<creationTime>5678</creationTime>
<disks>
<disk name='vda' checkpoint='bitmap' bitmap='c3'/>
</disks>
<domain type='test'>
<name>test</name>
<uuid>6695eb01-f6a4-8304-79aa-97f2502e193f</uuid>
<memory unit='KiB'>8388608</memory>
<currentMemory unit='KiB'>2097152</currentMemory>
<vcpu placement='static'>2</vcpu>
<os>
<type arch='i686'>hvm</type>
<boot dev='hd'/>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<disk type='file' device='disk'>
<source file='/guest/diskimage1'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</disk>
<interface type='network'>
<mac address='aa:bb:cc:dd:ee:ff'/>
<source network='default'/>
<target dev='testnet0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
</interface>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</memballoon>
</devices>
</domain>
</domaincheckpoint>

View File

@ -0,0 +1,13 @@
Redefine must be in topological order; this will fail
error: invalid argument: parent c3 for moment c2 not found
correct order
Domain checkpoint c3 created from 'checkpoint-c3.xml'
Domain checkpoint c2 created from 'checkpoint-c2.xml'
Name: c2
Domain: test
Parent: c3
Children: 0
Descendants: 0

View File

@ -0,0 +1,35 @@
echo Create a series of checkpoints, with names that intentionally sort
echo differently by topology than by name. For now, it is not possible
echo to create fanout without hacking through redefines.
checkpoint-create-as test c1
checkpoint-create-as test c1
checkpoint-create-as test c3
checkpoint-create-as test c2
echo snapshots cannot be created while checkpoints exist
snapshot-create-as test s1
echo Checking tree view (siblings sorted alphabetically)
checkpoint-list test --tree
echo Demonstrate list filtering
checkpoint-list test --roots --name
checkpoint-list test --leaves --name
checkpoint-list test --parent --no-leaves --name
checkpoint-list test --from c3 --name
checkpoint-list test --from c1 --descendants --name
echo Now the tree is linear, so we have an unambiguous topological order
checkpoint-list test --name
checkpoint-list test --name --topological
echo validate XML
checkpoint-delete test c1
checkpoint-dumpxml test c3
checkpoint-dumpxml test c2
echo Deleting current checkpoint moves current up to remaining parent
checkpoint-delete test --children-only c3
checkpoint-list test --leaves --name
checkpoint-delete test --children c3
checkpoint-list test --leaves --name

View File

@ -0,0 +1,133 @@
Create a series of checkpoints, with names that intentionally sort
differently by topology than by name. For now, it is not possible
to create fanout without hacking through redefines.
Domain checkpoint c1 created
error: operation failed: domain moment c1 already exists
Domain checkpoint c3 created
Domain checkpoint c2 created
snapshots cannot be created while checkpoints exist
error: Operation not supported: cannot create snapshot while checkpoint exists
Checking tree view (siblings sorted alphabetically)
c1
|
+- c3
|
+- c2
Demonstrate list filtering
c1
c2
c1
c3 c1
c2
c2
c3
Now the tree is linear, so we have an unambiguous topological order
c1
c2
c3
c1
c3
c2
validate XML
Domain checkpoint c1 deleted
<domaincheckpoint>
<name>c3</name>
<disks>
<disk name='vda' checkpoint='bitmap' bitmap='c3'/>
</disks>
<domain type='test'>
<name>test</name>
<uuid>6695eb01-f6a4-8304-79aa-97f2502e193f</uuid>
<memory unit='KiB'>8388608</memory>
<currentMemory unit='KiB'>2097152</currentMemory>
<vcpu placement='static'>2</vcpu>
<os>
<type arch='i686'>hvm</type>
<boot dev='hd'/>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<disk type='file' device='disk'>
<source file='/guest/diskimage1'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</disk>
<interface type='network'>
<mac address='aa:bb:cc:dd:ee:ff'/>
<source network='default'/>
<target dev='testnet0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
</interface>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</memballoon>
</devices>
</domain>
</domaincheckpoint>
<domaincheckpoint>
<name>c2</name>
<parent>
<name>c3</name>
</parent>
<disks>
<disk name='vda' checkpoint='bitmap' bitmap='c2'/>
</disks>
<domain type='test'>
<name>test</name>
<uuid>6695eb01-f6a4-8304-79aa-97f2502e193f</uuid>
<memory unit='KiB'>8388608</memory>
<currentMemory unit='KiB'>2097152</currentMemory>
<vcpu placement='static'>2</vcpu>
<os>
<type arch='i686'>hvm</type>
<boot dev='hd'/>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<disk type='file' device='disk'>
<source file='/guest/diskimage1'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</disk>
<interface type='network'>
<mac address='aa:bb:cc:dd:ee:ff'/>
<source network='default'/>
<target dev='testnet0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
</interface>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</memballoon>
</devices>
</domain>
</domaincheckpoint>
Deleting current checkpoint moves current up to remaining parent
Domain checkpoint c3 children deleted
c3
Domain checkpoint c3 deleted

View File

@ -0,0 +1 @@
a

View File

@ -0,0 +1 @@
a

View File

@ -0,0 +1 @@
a --shell

View File

@ -0,0 +1 @@
-- --shell a

View File

@ -0,0 +1 @@
a

View File

@ -0,0 +1 @@
--shell a

View File

@ -0,0 +1,3 @@
error: failed to get domain '4294967298'
## Exit code: 1

View File

@ -0,0 +1,18 @@
dominfo ef861801-45b9-11cb-88e3-afbfe5370493
dominfo fc4
dominfo fc5
domid fc4
domid ef861801-45b9-11cb-88e3-afbfe5370493
domuuid 2
domuuid fc4
domname 2
domname ef861801-45b9-11cb-88e3-afbfe5370493
domstate 2
domstate ef861801-45b9-11cb-88e3-afbfe5370493
domstate fc4
domcontrol fc4

View File

@ -0,0 +1,73 @@
Id: 2
Name: fc4
UUID: ef861801-45b9-11cb-88e3-afbfe5370493
OS Type: linux
State: running
CPU(s): 1
Max memory: 261072 KiB
Used memory: 131072 KiB
Persistent: yes
Autostart: disable
Managed save: no
Security model: testSecurity
Security DOI:
Security label: libvirt-test (enforcing)
Messages: tainted: network configuration using opaque shell scripts
Id: 2
Name: fc4
UUID: ef861801-45b9-11cb-88e3-afbfe5370493
OS Type: linux
State: running
CPU(s): 1
Max memory: 261072 KiB
Used memory: 131072 KiB
Persistent: yes
Autostart: disable
Managed save: no
Security model: testSecurity
Security DOI:
Security label: libvirt-test (enforcing)
Messages: tainted: network configuration using opaque shell scripts
Id: 3
Name: fc5
UUID: 08721f99-3d1d-4aec-96eb-97803297bb36
OS Type: linux
State: running
CPU(s): 4
Max memory: 2097152 KiB
Used memory: 2097152 KiB
Persistent: yes
Autostart: disable
Managed save: no
Security model: testSecurity
Security DOI:
Security label: libvirt-test (enforcing)
Messages: tainted: running with undesirable elevated privileges
tainted: network configuration using opaque shell scripts
tainted: use of host cdrom passthrough
tainted: custom device tree blob used
tainted: use of deprecated configuration settings
deprecated configuration: CPU model Deprecated-Test
2
2
ef861801-45b9-11cb-88e3-afbfe5370493
ef861801-45b9-11cb-88e3-afbfe5370493
fc4
fc4
running
running
running
ok

View File

@ -0,0 +1 @@
hello

View File

@ -0,0 +1,3 @@
echo --string hello
echo --str hello
echo --hi;

View File

@ -0,0 +1,3 @@
hello
hello
hello

View File

@ -0,0 +1,2 @@
a A 0 + * ; . ' " / ? =
< > &

View File

@ -0,0 +1,2 @@
a A 0 + '*' ';' . ''\''' '"' / '?' = ' ' '
' '<' '>' '&'

View File

@ -0,0 +1,2 @@
a A 0 + * ; . &apos; &quot; / ? =
&lt; &gt; &amp;

View File

@ -0,0 +1,11 @@
echo a A 0 + * . \' / ? = < > &
echo --xml a A 0 + * . \' / ? = < > &
echo --shell a A 0 + * . \' / ? = < > &
echo ""
echo --shell
echo --xml
echo --shell
echo ''
echo --shell ""
echo --xml ''
echo --shell ""''

View File

@ -0,0 +1,11 @@
a A 0 + * . ' / ? = < > &
a A 0 + * . &apos; / ? = &lt; &gt; &amp;
a A 0 + '*' . ''\''' / '?' = '<' '>' '&'
''
''

View File

@ -0,0 +1 @@
a b

View File

@ -0,0 +1 @@
a b

View File

@ -0,0 +1 @@
a b

View File

@ -0,0 +1 @@
a b

View File

@ -0,0 +1 @@
' " \;echo a

View File

@ -0,0 +1 @@
' " ;echo a

View File

@ -0,0 +1,2 @@
' " \
a

View File

@ -0,0 +1 @@
' " \\

View File

@ -0,0 +1,5 @@
echo --split a,b,,c,,,d,,,,e,,,,,f,,,,,,e
echo --split ,a,b,,c,,,d,,,,e,,,,,f,,,,,,e,
echo --split ,,a,b,,c,,,d,,,,e,,,,,f,,,,,,e,,
echo --split ,,,a,b,,c,,,d,,,,e,,,,,f,,,,,,e,,,
echo --split ,,,,a,b,,c,,,d,,,,e,,,,,f,,,,,,e,,,,

View File

@ -0,0 +1,24 @@
a
b,c,
d,,e,,
f,,,e
a
b,c,
d,,e,,
f,,,e
,a
b,c,
d,,e,,
f,,,e,
,
a
b,c,
d,,e,,
f,,,e,
,,a
b,c,
d,,e,,
f,,,e,,

View File

@ -0,0 +1,2 @@
list
nodeinfo

View File

@ -0,0 +1,15 @@
Id Name State
----------------------
1 fv0 running
2 fc4 running
3 fc5 running
CPU model: i986
CPU(s): 50
CPU frequency: 6000 MHz
CPU socket(s): 4
Core(s) per socket: 4
Thread(s) per core: 2
NUMA cell(s): 4
Memory size: 8192000 KiB

View File

@ -0,0 +1,2 @@
list
nodeinfo

View File

@ -0,0 +1,13 @@
Id Name State
----------------------
1 test running
CPU model: i686
CPU(s): 16
CPU frequency: 1400 MHz
CPU socket(s): 2
Core(s) per socket: 2
Thread(s) per core: 2
NUMA cell(s): 2
Memory size: 3145728 KiB

View File

@ -0,0 +1,14 @@
iothreadinfo --domain fc4
iothreadadd --domain fc4 --id 6
iothreadinfo --domain fc4
iothreaddel --domain fc4 --id 2
iothreadinfo --domain fc4
domstats --domain fc4
iothreadset --domain fc4 --id 6 --poll-max-ns 100 --poll-shrink 10 --poll-grow 10
domstats --domain fc4
iothreadadd --domain fc5 --id 2
iothreadinfo --domain fc5
iothreadpin --domain fc5 --iothread 2 --cpulist 0
iothreadinfo --domain fc5

View File

@ -0,0 +1,51 @@
IOThread ID CPU Affinity
-----------------------------
2 0
4 0
IOThread ID CPU Affinity
-----------------------------
2 0
4 0
6 0
IOThread ID CPU Affinity
-----------------------------
4 0
6 0
Domain: 'fc4'
state.state=1
state.reason=0
iothread.count=2
iothread.4.poll-max-ns=32768
iothread.4.poll-grow=0
iothread.4.poll-shrink=0
iothread.6.poll-max-ns=32768
iothread.6.poll-grow=0
iothread.6.poll-shrink=0
Domain: 'fc4'
state.state=1
state.reason=0
iothread.count=2
iothread.4.poll-max-ns=32768
iothread.4.poll-grow=0
iothread.4.poll-shrink=0
iothread.6.poll-max-ns=100
iothread.6.poll-grow=10
iothread.6.poll-shrink=10
IOThread ID CPU Affinity
-----------------------------
2 0-3
IOThread ID CPU Affinity
-----------------------------
2 0

View File

@ -0,0 +1,23 @@
list --all
echo test failure when starting already running guest
start fv0
echo undefine a running domain - by domain name
dominfo fc4
undefine fc4
dominfo fc4
shutdown fc4
dominfo fc4
echo undefine a running domain - by domain id
dominfo 3
undefine 3
dominfo 3
shutdown 3
dominfo fc5
echo shutdown then undefine
shutdown fv0
undefine fv0
dominfo fv0

View File

@ -0,0 +1,106 @@
Id Name State
----------------------
1 fv0 running
2 fc4 running
3 fc5 running
test failure when starting already running guest
error: Domain is already active
undefine a running domain - by domain name
Id: 2
Name: fc4
UUID: ef861801-45b9-11cb-88e3-afbfe5370493
OS Type: linux
State: running
CPU(s): 1
Max memory: 261072 KiB
Used memory: 131072 KiB
Persistent: yes
Autostart: disable
Managed save: no
Security model: testSecurity
Security DOI:
Security label: libvirt-test (enforcing)
Messages: tainted: network configuration using opaque shell scripts
Domain 'fc4' has been undefined
Id: 2
Name: fc4
UUID: ef861801-45b9-11cb-88e3-afbfe5370493
OS Type: linux
State: running
CPU(s): 1
Max memory: 261072 KiB
Used memory: 131072 KiB
Persistent: no
Autostart: disable
Managed save: no
Security model: testSecurity
Security DOI:
Security label: libvirt-test (enforcing)
Messages: tainted: network configuration using opaque shell scripts
Domain 'fc4' is being shutdown
error: failed to get domain 'fc4'
undefine a running domain - by domain id
Id: 3
Name: fc5
UUID: 08721f99-3d1d-4aec-96eb-97803297bb36
OS Type: linux
State: running
CPU(s): 4
Max memory: 2097152 KiB
Used memory: 2097152 KiB
Persistent: yes
Autostart: disable
Managed save: no
Security model: testSecurity
Security DOI:
Security label: libvirt-test (enforcing)
Messages: tainted: running with undesirable elevated privileges
tainted: network configuration using opaque shell scripts
tainted: use of host cdrom passthrough
tainted: custom device tree blob used
tainted: use of deprecated configuration settings
deprecated configuration: CPU model Deprecated-Test
Domain '3' has been undefined
Id: 3
Name: fc5
UUID: 08721f99-3d1d-4aec-96eb-97803297bb36
OS Type: linux
State: running
CPU(s): 4
Max memory: 2097152 KiB
Used memory: 2097152 KiB
Persistent: no
Autostart: disable
Managed save: no
Security model: testSecurity
Security DOI:
Security label: libvirt-test (enforcing)
Messages: tainted: running with undesirable elevated privileges
tainted: network configuration using opaque shell scripts
tainted: use of host cdrom passthrough
tainted: custom device tree blob used
tainted: use of deprecated configuration settings
deprecated configuration: CPU model Deprecated-Test
Domain '3' is being shutdown
error: failed to get domain 'fc5'
shutdown then undefine
Domain 'fv0' is being shutdown
Domain 'fv0' has been undefined
error: failed to get domain 'fv0'
## Exit code: 1

View File

@ -0,0 +1,2 @@
a
b

View File

@ -0,0 +1 @@
a # b

View File

@ -0,0 +1 @@
a

View File

@ -0,0 +1 @@
a

View File

@ -0,0 +1,2 @@
a
b

View File

@ -0,0 +1,2 @@
a
b

View File

@ -0,0 +1,2 @@
a
b

View File

@ -0,0 +1,3 @@
a
\
b

View File

@ -0,0 +1 @@
a

View File

@ -0,0 +1,2 @@
a
c

View File

@ -0,0 +1,2 @@
a
c

View File

@ -0,0 +1 @@
a # b

View File

@ -0,0 +1,26 @@
echo Test the <timeout> option (numeric option converted to ms)
echo Non-numeric value
event --all --timeout abc
echo Numeric value that is too big to be converted to ms and still
echo fit inside an int
event --all --timeout 2147484
echo Numeric value with invalid suffix
event --all --timeout 42WB
echo Numeric value with valid suffix. Suffixes are not supported for
echo the <timeout> option, so this value is rejected
event --all --timeout 42MB
echo Negative value
event --all --timeout -1
echo Zero. This is not a valid timeout, but the value is parsed
echo correctly
event --all --timeout 0
echo Numeric value. No events will be received and the command will
echo fail after a second, but the value has been parsed correctly
event --all --timeout 1

Some files were not shown because too many files have changed in this diff Show More