Commit Graph

43294 Commits

Author SHA1 Message Date
Kristina Hanicova
409ccebcaa virsh: remove variable 'ret' in cmdVersion()
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-09-24 09:58:04 +02:00
Kristina Hanicova
28051aaa9b virsh: remove variable 'ret' and use early return if possible
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-09-24 09:58:01 +02:00
Kristina Hanicova
978a124659 virsh: volume: refactor cmdVolInfo()
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-09-24 09:52:42 +02:00
Kristina Hanicova
096da894cd virsh: host: refactor cmdNodeCpuStats()
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-09-24 09:52:42 +02:00
Kristina Hanicova
21a0019392 virsh: host: refactor cmdFreecell()
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-09-24 09:52:42 +02:00
Kristina Hanicova
ba78db1f73 virsh: domain: refactor cmdLxcEnterNamespace()
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-09-24 09:52:42 +02:00
Kristina Hanicova
637d98b329 virsh: domain: refactor virshCPUCountCollect()
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-09-24 09:52:42 +02:00
Kristina Hanicova
e31502544c virsh: domain: refactor cmdSchedinfo()
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-09-24 09:52:42 +02:00
simmon
55178b5c9e Translated using Weblate (Korean)
Currently translated at 82.9% (8591 of 10353 strings)

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

Co-authored-by: simmon <simmon@nplob.com>
Signed-off-by: simmon <simmon@nplob.com>
2021-09-24 02:05:04 +02:00
Daniel P. Berrangé
e0e0bf6628 scripts: include function versions in API definition
In order to auto-generate more of the language binding code, it is
desirable to know what libvirt version an API was introduced in.
We can extract this information from the .syms files and expose
it in the API description

eg instead of

  <function name='virNodeNumOfDevices' file='libvirt-nodedev'
            module='libvirt-nodedev'>

we now have

  <function name='virNodeNumOfDevices' file='libvirt-nodedev'
            module='libvirt-nodedev' version='0.5.0'>

This will benefit this proposal:

  https://gitlab.com/libvirt/libvirt-go-module/-/merge_requests/7

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Tested-by: Victor Toso <victortoso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-09-23 16:30:18 +01:00
Ján Tomko
4a6d874946 ch: use g_auto in virCHMonitorBuildVMJson
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-09-23 15:32:01 +02:00
Ján Tomko
b4436cc3f5 ch: use g_auto in virCHMonitorBuildNetsJson
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-09-23 15:32:00 +02:00
Ján Tomko
08b943d641 ch: use g_auto in virCHMonitorBuildNetJson
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-09-23 15:32:00 +02:00
Ján Tomko
1149a6ddc7 ch: use g_auto in virCHMonitorBuildDisksJson
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-09-23 15:32:00 +02:00
Ján Tomko
48a089a964 ch: use g_auto in virCHMonitorBuildDiskJson
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-09-23 15:32:00 +02:00
Ján Tomko
25ffb2ce86 ch: use g_auto in virCHMonitorBuildCPUJson
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-09-23 15:32:00 +02:00
Peter Krempa
ef8f06c882 qemuxml2argvtest: remove 'fs9p' cases with fake capabilities.
The filesystem commandline doesn't differ in the '-latest' cases.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:51 +02:00
Peter Krempa
4dc709a983 qemuxml2argvtest: Pin old-style '-no-reboot' usage to qemu-5.2
After qemu-5.2 we always use -no-shutdown.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:51 +02:00
Peter Krempa
c8b6dde975 qemuxml2argvtest: Use versioned ("4.1.0") capabilities for pre '-audiodev' cases
Use real caps instead of fake caps for the legacy cases. This will also
show us when we can remove the old-style code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:51 +02:00
Peter Krempa
102b84451a tests: qemu: Remove 's390-ccw' machine type from fake capabilities
Modern QEMUs don't support the machine type at all. Remove it from our
fake caps generator too and adjust test cases which depend on it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:51 +02:00
Peter Krempa
266628906f qemuxml2argvtest: Modernize s390x disk tests
An update to the machine type was necessary as 's390-ccw' is no longer
supported.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:51 +02:00
Peter Krempa
bf4595d8d5 qemuxml2argvtest: Modernize 'disk-floppy-pseries' case
Use real caps. The flooppy device still is forbidden for ppc64.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:51 +02:00
Peter Krempa
62b0be5fda qemuxml2argvtest: Modernize outstanding disk-backend related tests
For backend related tests we need to cover the pre-blockdev and
post-blockdev era, so the fake-capability test is converted to a
combination of DO_TEST_CAPS_VER(..., "4.1.0") and DO_TEST_CAPS_LATEST.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:51 +02:00
Peter Krempa
01766f74eb qemuxml2argvtest: Modernize 'disk-network-rbd-no-colon' case
The test case fails in pre-blockdev scenarios as it would pass RBD
parameters behind our back but succeeds after as we pass it in JSON form
which doesn't have that defect.

Cover both cases instead of the fake-caps version.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:51 +02:00
Peter Krempa
9ce94fae04 qemuxml2argvtest: Merge 'disk-iscsi' case into 'disk-cache'
Use the iSCSI disk path in one of the disks of the 'disk-cache' test as
it's the only specialty of 'disk-iscsi' case and remove the now
pointless files.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:51 +02:00
Peter Krempa
d8023425f1 qemuxml2argvtest: Replace 'disk-network-iscsi' by the more comprehensive 'disk-network-iscsi-modern'
Move the contents of 'disk-network-iscsi-modern' into 'disk-network-iscsi'
to reuse the name and also invocation with real capablities and remove
the leftovers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:51 +02:00
Peter Krempa
b54aaafe4d qemuxml2argvtest: Use real caps for all disk frontend property tests
Cases for covering disk frontend properties can be converted to
DO_TEST_CAPS_LATEST without any need for intermediate capabilities.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:51 +02:00
Peter Krempa
fe6816eb93 qemuxml2argvtest: Use DO_TEST_CAPS_LATEST_PARSE_ERROR for disk cases
Convert all the disk-related negative cases to use 'latest'
capabilities. The checks are mostly related to validation so using
real capabilities doesn't influence the outcome.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:51 +02:00
Peter Krempa
70906cec03 qemuxml2argvtest: Convert encrypted disk test cases to DO_TEST_CAPS_LATEST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:50 +02:00
Peter Krempa
1323408151 qemuxml2argvtest: Remove 'disk-usb-nosupport' case
In effor to convert all test cases to real capability testing, this
test doesn't make sense any more as even the oldest QEMU supported
supports USB storage.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:50 +02:00
Peter Krempa
b5ce2a652c qemuxml2argvtest: Remove negative case for 'luks-disks-source-qcow2'
Currently we no longer support qemus which would miss the necessary
capability, thus the test can't be converted to DO_TEST_CAPS_LATEST.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:50 +02:00
Peter Krempa
646c06bb48 qemuxml2argvtest: Remove fake caps versions of disk tests we have a versioned test for
Many disk-related test case have both a fake capability version and one
tied to qemu-2.12. Remove all of those fake caps tests as we have
coverage.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:50 +02:00
Peter Krempa
ba491ddab7 qemuxml2argvtest: Agregate all 'disk'-related test cases
There were a few disk-related test cases spread around in the test
invocation calls. Move them together with disk tests and move one
irrelevant case away from the disk test block.

Note that there are still a few tests having 'disk' in the name but they
belong to different groups mostly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:50 +02:00
Peter Krempa
b59b2319a6 qemuxml2argvtest: Remove 'boot-strict' case
It's identical to 'boot-order'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:50 +02:00
Peter Krempa
4560736c9c testQemuInfoInitArgs: Report error if path to 'latest' caps for an arch is NULL
When looking up the 'latest' caps they might not be present. Report an
error instead of crashing.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:50 +02:00
Peter Krempa
1bb7b3aa9c testCompareXMLToArgv: Avoid use of uninitialized 'monitor_chr'
Failure of 'testQemuInfoInitArgs' jumps over the initialization of
'monitor_chr' via memset, which leads to a crash.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-23 14:48:50 +02:00
Peter Krempa
f5d8913f91 qemu: driver: Remove unused variable 'cfg'
Commit a50c473ad6 removed last use of 'cfg' from
qemuDomainMemoryPeek and qemuDomainScreenshot triggering a compile time
warning.

Fixes: a50c473ad6
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2021-09-23 13:47:00 +02:00
Luke Yue
6cd6225778 tests: Test IOThread related functions for test driver
testIOThreadAdd tests iothreadinfo and iothreadadd
testIOThreadDel tests iothreadinfo and iothreaddel
testIOThreadSet tests domstats and iothreadset
testIOThreadPin tests iothreadadd, iothreadinfo and iothreadpin

Above tests should cover the IOThreads related APIs for test driver

Signed-off-by: Luke Yue <lukedyue@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-09-23 13:41:39 +02:00
Luke Yue
28d5ee324a test_driver: Introduce testDomainGetStatsIOThread
Introduce testDomainGetStatsIOThread to add support for
testConnectGetAllDomainStats to get IOThread infos.

Signed-off-by: Luke Yue <lukedyue@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-09-23 13:41:36 +02:00
Luke Yue
57709f0579 test_driver: Implement virConnectGetAllDomainStats
Implement virConnectGetAllDomainStats in a modular way just like QEMU
driver, though remove some params in GetStatsWorker that we don't need
in test driver currently.

Only add the worker to get state so far, more worker will be added
in the future.

Signed-off-by: Luke Yue <lukedyue@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-09-23 13:41:31 +02:00
Luke Yue
fd205b6712 test_driver: Implement testDomainSetIOThreadParams
Signed-off-by: Luke Yue <lukedyue@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-09-23 13:41:27 +02:00
Luke Yue
cde87e941f test_driver: Implement virDomainPinIOThread
Signed-off-by: Luke Yue <lukedyue@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-09-23 13:41:24 +02:00
Luke Yue
5af7036ec0 test_driver: Implement virDomainGetIOThreadInfo
If we use test driver on different machines, and use 0 as bitmap_size
for virDomainDriverGetIOThreadsConfig(), we would get different results for
the `CPU Affinity`, because it's depending on the host CPU's bitmap. In
order to get a stable result for testing, use result of
virDomainDefGetVcpus() as bitmap_size instead.

Signed-off-by: Luke Yue <lukedyue@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-09-23 13:41:22 +02:00
Luke Yue
fac57323fc domain_driver.c: Introduce and use virDomainDriverGetIOThreadsConfig()
The test driver can share the same code with qemu driver when implement
testDomainGetIOThreadsConfig, so extract it for test driver to use.

Also add a new parameter `bitmap_size` to the function, it's used for
specifying the bitmap size of the bitmap to generate, it would be helpful
for test driver or some special situation.

Signed-off-by: Luke Yue <lukedyue@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-09-23 13:41:19 +02:00
Luke Yue
958d0a5099 test_driver: Implement virDomainDelIOThread
Signed-off-by: Luke Yue <lukedyue@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-09-23 13:41:16 +02:00
Luke Yue
04d25261a6 test_driver: Implement virDomainAddIOThread
Introduce testDomainChgIOThread at the same time, could be used for
virDomainDelIOThread etc.

Signed-off-by: Luke Yue <lukedyue@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-09-23 13:41:13 +02:00
Luke Yue
6650d14f6c test_driver: Introduce testIOThreadInfo and generate IOThread infos
Introduce testIOThreadInfo to store IOThread infos: iothread_id,
poll_max_ns, poll_grow and poll_shrink for future usage.

Add an example of IOThread configuration to testdomfc4.xml, we also want
to generate default testIOThreadInfo for the IOThread configured in the
xml, so introduce testDomainGenerateIOThreadInfos, the values are taken
from QEMU.

Signed-off-by: Luke Yue <lukedyue@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-09-23 13:41:11 +02:00
Luke Yue
cb3033776f domain_driver.c: Introduce and use virDomainDriverAddIOThreadCheck()
The test driver can share the same code with qemu driver when implement
testDomainAddIOThreadCheck and testDomainDelIOThreadCheck, so extract
them for test driver to use.

Signed-off-by: Luke Yue <lukedyue@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-09-23 13:41:07 +02:00
Peng Liang
c4f3c955d5 qemu: don't change ownership of cache directory
Commit 6bcf25017b ("virDomainMemoryPeek API") introduced memory peek
and commit 9936aecfd1 ("qemu: Implement the driver methods")
introduced screenshot.  Both of them will put temporary files in
/var/cache/libvirt/qemu, and the temporary files are created by QEMU.
Therefore, the ownership of /var/cache/libvirt/qemu should be changed to
user and group configured in qemu.conf to make sure that QEMU process
can create and write files in the cache directory.

Libvirt will only put the temporary files in /var/cache/libvirt/qemu
until commit cbde35899b ("Cache result of QEMU capabilities
extraction"), which will put the cache of QEMU capabilities in
'capabilities' subdir of the cache directory.  Because the capabilities
is used by libvirt, the ownership of both 'capabilities' subdir and
capabilities files are root.  However, when QEMU process runs as a
regular user (e.g. qemu user), the ownership of /var/cache/libvirt/qemu
will be changed to qemu:qemu while that of
/var/cache/libvirt/qemu/capabilities will be still root:root.  Then the
regular user could spoof different capabilities, which maybe lead to
denial of service.

Since the previous patch has move the temp files of screenshot and
memory peek to per-domain directory, no one except domain capabilities
uses cacheDir currently.  And since domain capabilities are used by
libvirtd instead of QEMU, no need to change the ownership of cacheDir to
qemu:qemu explicitly.

Signed-off-by: Peng Liang <liangpeng10@huawei.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-09-23 12:42:26 +02:00
Peng Liang
a50c473ad6 qemu: move temp file of screenshot and memorypeek to per-domain dir
The temp files of screenshot and memory peek, which are created by QEMU,
are put in the cache directory.  However, the caches of domain
capabilities, which are created and used by libvirtd, are also put in
the cache directory.  In order to make the cache directory more secure,
move the temp files of screenshot and memory peek to per-domain
directory.

Since the temp files are just temporary files and are only used by
libvirtd (libvirtd will delete them after use), the use of screenshot
and memory peek will be affected.

Signed-off-by: Peng Liang <liangpeng10@huawei.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-09-23 12:42:26 +02:00