Commit Graph

43134 Commits

Author SHA1 Message Date
Daniel P. Berrangé
69254cafa0 qemu: stop probing for '-device sga' support
Since we no longer use '-device sga' we can stop probing for this device
in our capabilities code.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-09-09 16:17:30 +01:00
Daniel P. Berrangé
40dfef297a qemu: switch to use -M graphics=off instead of -device sga
SeaBIOS >= 1.11 has built-in support for outputting to the serial
console when QEMU sets -M graphics=off. Our minimum QEMU version
is 2.11.0, which bundled SeaBIOS 1.11. Thus we have no need to
use '-device sga' anymore.

This change results in a slight layout difference for option ROMs
in memory, however, it does not affect the migration data stream
format on the wire and once migration is complete the target QEMU
memory layout for ROMs matches the source QEMU once again.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-09-09 16:17:30 +01:00
Daniel P. Berrangé
58dfbca51d qemu: tweak error message to be more general purpose
The BIOS serial console output is currently implemented using the QEMU
'sga' device, but this is going to change in future patches, so the
error message ought to be more generically phrased.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-09-09 16:17:30 +01:00
Daniel P. Berrangé
c82726a460 qemu: prevent use of <bios useserial='yes'> on non-x86 arches
The <bios useserial='yes'> config results in use of the '-device sga'
QEMU options. This in turn causes QEMU go load the sgabios.bin option
ROM, which contains x86 machine code. This cannot work on non-x86
arches, thus we should block the bad config.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-09-09 16:17:30 +01:00
jason lee
046f1b4da0 Translated using Weblate (Korean)
Currently translated at 49.4% (5118 of 10353 strings)

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

Co-authored-by: jason lee <ppark5237@gmail.com>
Signed-off-by: jason lee <ppark5237@gmail.com>
2021-09-09 15:54:50 +02:00
Göran Uddeborg
4dba8af02a Translated using Weblate (Swedish)
Currently translated at 27.7% (2873 of 10353 strings)

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

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
2021-09-09 15:54:50 +02:00
simmon
419bd693b6 Translated using Weblate (Korean)
Currently translated at 49.3% (5110 of 10353 strings)

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

Translated using Weblate (Korean)

Currently translated at 48.6% (5038 of 10353 strings)

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

Translated using Weblate (Korean)

Currently translated at 48.3% (5008 of 10353 strings)

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

Translated using Weblate (Korean)

Currently translated at 48.3% (5003 of 10353 strings)

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

Translated using Weblate (Korean)

Currently translated at 47.9% (4968 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-09 15:54:50 +02:00
William Douglas
c88b26a656 ch_driver: Handle validation failure correctly
When validation like deviceValidateCallback fails, the vm will not be
set and so the call to virDomainObjListRemove will be passed a NULL
pointer causing a segfault. To prevent this add a check that the vm is
defined before calling out to virDomainObjListRemove.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: William Douglas <william.douglas@intel.com>
2021-09-09 14:51:02 +01:00
William Douglas
d4f047dbd1 ch_driver: Add handler for console API
Enable the handler function to find and open the console character
device that will be used by the console API.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: William Douglas <william.douglas@intel.com>
2021-09-09 14:51:02 +01:00
William Douglas
6a77dd2b67 ch_domain: Allow controller and chr devices
With the console and serial device handling fully functional, allow
the required device types to be specified in the domain
configuration.

The configuration only supports a single serial or console device.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: William Douglas <william.douglas@intel.com>
2021-09-09 14:51:02 +01:00
William Douglas
d79b9a5a17 ch_process: Handle enabled console devices
Add functionality to allow libvirt console to connect to the
cloud-hypervisor created PTY associated with a VM by updating the
domain with console path information. This has to be run after the VM
is created by cloud-hypervisor.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: William Douglas <william.douglas@intel.com>
2021-09-09 14:51:02 +01:00
William Douglas
93accefd9e ch_monitor: Add pty json builder function
Add function to build the the json structure to configure a PTY in
cloud-hypervisor.

The devices themselves still aren't allowed in configurations yet
though.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: William Douglas <william.douglas@intel.com>
2021-09-09 14:51:02 +01:00
William Douglas
3b164e6897 ch_monitor: Make virCHMonitorGet function static
The virCHMonitorGet function isn't going to be used outside of the
monitor, so remove the initial declaration and define the function
to be static.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: William Douglas <william.douglas@intel.com>
2021-09-09 14:51:02 +01:00
William Douglas
14da5cb95a ch_monitor: Use virCHMonitorGet to access cloud-hypervisor API
Now that virCHMonitorGet is capable of handling data returned by the
cloud-hypervisor API, make use of this via virCHMonitorGetInfo to call
into the vm.info endpoint.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: William Douglas <william.douglas@intel.com>
2021-09-09 14:51:02 +01:00
William Douglas
e727cc8041 ch_monitor: Update virCHMonitorGet to handle accept a response
The virCHMonitorGet function needed to be able to return data from the
hypervisor. This functionality is needed in order for the driver to
support PTY enablement and getting details about the VM state.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: William Douglas <william.douglas@intel.com>
2021-09-09 14:51:02 +01:00
William Douglas
f84286c0b3 ch_domain: Add virChrdevs for console support
Add and initialize a virChrdevs to the _virCHDomainObjPrivate
structure in order to eventually track the consoles in use by a domain.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: William Douglas <william.douglas@intel.com>
2021-09-09 14:51:02 +01:00
Peter Krempa
4f7aaa1b7b virstoragetest: Reinstate testing of images without 'backing_fmt'
There are important security implications when we'd misprobe those
images. This commit reinstates the tests removed by commit 979d1ba3ae
since 'qemu-img' refused to format them.

With the new testing approach with stored images we won't run into that
problem.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
12906d1985 virstoragetest: Remove pointless goto from mymain
Improve the error message and abort the test. Continuing here is not
desired as without chdiring into the appropriate directory the test
would fail anyways and worse could attempt stat-ing random files on the
host.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
6aaa4d3cfe virstoragetest: Don't skip the whole test when qemu-img fails to format images
We have plenty of other work to do in this test. Skip only the real
image testing case when we can't find qemu-img or it failed to format
the image.

This allows us to also remove the last global variable in the test and
move the creation and cleanup of the images closer to the actual test.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
dad6d609cc virstoragetest: testStorageChain: Skip test if filename is NULL
Prepare the test runner for skipping individual tests if images can't be
formatted rather than the whole virstoragetest.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
aa3b29f8fc virstoragetest: testPrepImages: Use 'qemu-img' to format 'raw' image
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
570455d6be virstoragetest: testPrepImages: Don't reuse 'cmd' pointer
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
3ec180f58d virstoragetest: Assume that 'qemu-img' supports '-o compat='
All supported qemu versions have the parameter, so we don't need to
check. This allows us to simplify the code used for formating real
images for virstoragetest.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
b8732224a7 virstoragetest: Don't rewrite the 'qcow2' image
Create it with the appropriate backing file path rather than using
another instance of 'qemu-img rebase'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
2d6bd113e2 virstoragetest: Stop rewriting images in 'mymain'
For testing of real images formatted by 'qemu-img' it's now sufficient
to format them once without the need to rewrtie them since we use the
real images only for testing of one scenario.

This allows us to also remove most of the global variables holding the
path to the images which was necessary when they were being rewritten.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
dc80ca18e0 virstoragetest: Unify testing of QCOW2 images with absolute backing
We have 3 test cases for this currently:

1) "qcow2->raw"
 1.1) VIR_STORAGE_FILE_QCOW2 as top level format
 1.2) VIR_STORAGE_FILE_AUTO as top level format
2) "wrap->qcow2->raw" whith just VIR_STORAGE_FILE_QCOW2

This patch adds also testing of VIR_STORAGE_FILE_AUTO for case 2) and
removes both 1) subcases as they are being actually tested as part of
2).

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
8f36cf91ac virstoragetest: Use preformatted qcow2 image for testing relative paths
More preparation for eliminating image rewriting.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
229a6d6992 virstoragetest: Convert symlink and relative image testing use preformatted images
Use prepared test images instead to simplify and clarify the code
instead of rewriting existing images multiple times.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
0ee87da294 virstoragetest: Use existing file for testing 'raw' image lookup
We've already added a 'raw' file to the example image directory so we
can use that instead of formatting one.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
df020845d5 virstoragetest: Use preformatted file for testing missing backing store
Similarly to previous ones, this one doesn't need to be created by
qemu-img in order for the test to make sense.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
80412bfbeb virstoragetest: Use pre-formatted file for non-path extraction test
This one doesn't require using qemu-img either.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
325fce82d1 virstoragetest: Use a pre-formatted QED file for testing backing store extraction
The QED format isn't really being developed any more. Use a
pre-formatted image to test the existing code. In this instance we
switch to using a relative backing path for simplicity.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
55688197ee virstoragetest: Use existing directory in the source tree for 'directory' probing tests
We don't need a special directory for the tests. Reuse the directory
holding the data for the virstoragetest.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
df94a4e907 virstoragetest: Test backing chain loops with hardcoded images
Provide the images for the self and mutual backing image loop cases in
the repository rather than formatting them with qemu-img.

This makes the code more readable and also decouples the backing chain
tests from each other.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
0a67ae731a virstoragetest: Rework TEST_LOOKUP* cases to work on fake backing chain
Rather than using 'qemu-img' and rewriting the chain we can use fake
data and few empty files to ensure the same level of coverage. This is
possible since we've already tested that the metadata parsing from files
works properly and the only thing we are testing here is that the
symlink resolution works properly.

Additionally after the refactor of 'virstoragetest' is complete
additional tests on real data will be added.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
d361234549 virstoragetest: Remove redundant arguments for chain lookup tests
Passing in both "chain*" and "chain*->path" is pointless. Use only the
full struct which we can use to infer the rest.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
80c1fea639 virstoragetest: Store output of TEST_CHAIN in output files
The TEST_CHAIN cases were storing the expected output (or rather data
to generate the expected output) in code. This made the code really hard
to follow and even harder to modify to add new cases.

This patch modifies the code to store the expected output in text files
(using the same generator as we've used to) and uses
'virTestCompareToFile' to check the outputs.

The result is that the code is way simpler and doesn't require fiddling
with 'testFileData' structs when adding new cases. Additionally this
removes mixing of code and declaration so we can stop disabling the
warning for this file.

Another advantage is that the tests are now named so it's easier to
figure out if one of them breaks.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
de59c4bba2 testutils: Introduce helper for stripping bulilddir/srcdir from test outputs
In certain cases we want to be able to compare test output containing
real paths against a static output file and thus we need a helper which
strips srcdir/builddir from given path.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
aea559fa74 virstoragetest: Drop testing of NBD backends via parsing real images
We now have specific tests for the backing store parser and previous
tests cover the extraction of the backing store string so there's no
need for these particular tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
Peter Krempa
97d7177a11 virstoragetest: Drop testing of RBD backends via parsing real images
We now have specific tests for the backing store parser and previous
tests cover the extraction of the backing store string so there's no
need for these particular tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-09 15:29:00 +02:00
dinglimin
6e89972541 virsh: Display vhostuser socket path in domblklist
The domblklist command is designed to show a brief information
about the blocks of a domain. One piece of information that is
shows is "Target "and "Source". Before the modification, the
Vhost disk of SPDK is displayed as "-". After the modification,
the socket associated with it can be displayed.

Signed-off-by: dinglimin <dinglimin@cmss.chinamobile.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-09-09 13:56:06 +02:00
Peter Krempa
5a3c35dc83 qemuxml2argvtest: Add test case for missing disk '<target>'
Cover the case of missing disk target to cover the case fixed by
previous commit.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-09-09 10:17:28 +02:00
Peter Krempa
0404d4fc38 virDomainDiskDefValidate: Move validation of disk target
The disk target is mandatory and used as a designator in error messages
of other validation steps, so we must validate it first.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-09-09 10:17:28 +02:00
Peter Krempa
cf6b34c683 conf: Don't call 'virDomainDiskDefAssignAddress' when disk->dst is NULL
The code rejecting a XML when the disk target is missing was moved to
the validation code which goes after post parse. One of the cases in the
disk post parse code didn't check whether 'disk->dst' is set which at
that point isn't guaranteed.

Fixes: 61fd7174c2
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2001627
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-09-09 10:17:28 +02:00
Peter Krempa
002de683c6 conf: validate: Run global device definition validation before callbacks
The validation infrastructure doesn't modify the definition and
additionally it makes sense to run the global code first as it's
validating certain corner cases.

The changed error messages from qemuxml2argvtest show that this is
indeed the proper ordering as all changed messages are actually better
describing the error.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-09-09 10:17:28 +02:00
Peter Krempa
7dee442677 conf: validate: Move qemu-specific LUN disk validation to global validation
LUN disks are supported only by VMX and QEMU drivers and the VMX
implementation is a subset of qemu's implementation, thus we can move
the qemu-specific validator to the global validation code providing that
we allow the format to be 'none' (qemu driver always sets 'raw' if it's
not set) and allow disk type 'volume' as a source (qemu always
translates the source, and VMX doesn't implement 'volume' at all).

Moving the code to the global validation allows us to stop calling it
from the qemu specific validation and also deduplicates the checks.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-09-09 10:17:28 +02:00
Peter Krempa
5ccb39616f qemuDomainDefValidateDiskLunSource: Unbreak error messages
Simplify looking for the error messages.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-09-09 10:17:28 +02:00
Ján Tomko
fa8ce012a3 libxl: use g_auto in libxlDomainGetEmulatorType
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2021-09-08 16:19:55 +02:00
Ján Tomko
d6cd7a478f libxl: use g_auto in libxlCapsNodeData
Also remove pointless labels.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2021-09-08 16:19:55 +02:00
Ján Tomko
3e4c5e20b8 libxl: refactor libxlCapsInitCPU
Use g_auto, g_steal_pointer and remove unnecessary labels.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2021-09-08 16:19:55 +02:00