Commit Graph

33140 Commits

Author SHA1 Message Date
Andrea Bolognani
4ebefac793 examples: Organize C examples into categories
Most C examples live in their own directory, which seems a
bit unnecessary especially considering that all virt-admin
related examples share a single admin/ directory. Reorganize
non-admin C examples in two categories: domain/ for those
that act on a domain, and misc/ for everything else.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
2019-06-03 17:27:37 +02:00
Andrea Bolognani
81c2486ab7 examples: Move and install shell examples
The virt-lxc-convert shell script is at this point the
only example we don't install on the target system.

Create a sh/ subdirectory, following the example set by
the existing polkit/, systemtap/ and xml/, and move the
script there; then add rules that will install all example
shell scripts as documentation.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
2019-06-03 17:27:35 +02:00
Andrea Bolognani
bc43533e53 examples: Install remaining XML examples
We already install nwfilters separately.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
2019-06-03 17:27:32 +02:00
Andrea Bolognani
a37b59c39f examples: Install SystemTap examples
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
2019-06-03 17:27:30 +02:00
Andrea Bolognani
925bfbd809 examples: Install Polkit examples
Right now we install the files in RPMs only, and we include
them in the -daemon package which is probably not the best
option either. Start installing them via autotools; the RPMs
will get them automatically in the -docs package.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
2019-06-03 17:27:28 +02:00
Andrea Bolognani
db4529c5ee examples: Install nwfilters without shell scripting
We're doing nothing more than copying files to a target
directory, so we don't need any custom shell commands and
can just use the standard autotools data installation
support instead.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
2019-06-03 17:27:25 +02:00
Andrea Bolognani
24f62f7bf1 examples: Drop unnecessary $(mkinstalldirs) call
$(mkinstalldirs) works like 'mkdir -p' in that it will
create all the necessary parts of the path leading up to
the actual directory, which means creating $(examplesdir)
beforehand is not necessary.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
2019-06-03 17:27:23 +02:00
Andrea Bolognani
a5544e021f examples: Move $(WARN_CFLAGS) to $(AM_CFLAGS)
$(AM_CPPFLAGS) is for passing options to the C preprocessor,
not the C compiler, and the stuff in $(WARN_CFLAGS) belongs
to the latter category.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
2019-06-03 17:27:21 +02:00
Andrea Bolognani
0a7b5b6e10 examples: Move $(STATIC_BINARIES) to $(AM_LDFLAGS)
$(LDADD) is for object files that should be added during
linking, not for options that should be passed to the
linker: that's what $(AM_LDFLAGS) is for.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
2019-06-03 17:27:19 +02:00
Andrea Bolognani
9469bb3710 examples: Don't look for headers in $(top_srcdir)
The C programs in this directory are supposed to be only
using public functions, so having $(top_srcdir) in the
header search path is unnecessary at best and actively
harmful at worst.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
2019-06-03 17:27:17 +02:00
Andrea Bolognani
40d4aaf928 examples: Remove $(WARN_CFLAGS) from $(LDADD)
$(WARN_CFLAGS) contains options intended for the compiler,
whereas $(LDADD) is supposed to list additional objects
required during linking, so the former clearly doesn't
belong in the latter.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
2019-06-03 17:27:15 +02:00
Andrea Bolognani
40c230fa2a examples: Reformat $(AM_CPPFLAGS) and $(LDADDS)
This will make further changes easier to review.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
2019-06-03 17:27:13 +02:00
Andrea Bolognani
f91dfc4890 examples: Drop object_events_event_test_CFLAGS
$(AM_CPPFLAGS) already includes $(WARN_CFLAGS), so this is
not doing anything useful.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
2019-06-03 17:27:11 +02:00
Andrea Bolognani
4f274bd7e3 spec: Don't install libvirt-api.xml as documentation
We already install the file, along with its driver-specific
counterparts, into ${datadir}/libvirt/api/ where language
bindings will actually look for them.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
2019-06-03 17:27:03 +02:00
Andrea Bolognani
0e331942a0 maint: Post-release version bump to 5.5.0
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2019-06-03 17:19:28 +02:00
Daniel Veillard
1465879463 Release of libvirt-5.4.0
* docs/news.xml: update for release

Signed-off-by: Daniel Veillard <veillard@redhat.com>
2019-06-03 16:17:15 +02:00
Jiri Denemark
b58ab7e824 cpu_x86: Drop extra empty lines
They were introduced by commit 0a97486e09 when moving functions.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-06-03 16:02:48 +02:00
Jiri Denemark
18a0326c3c maint: Add support for .ctags.d
Depending on the way ctags was compiled, it may look for
.ctags.d/*.ctags files rather than .ctags for reading configuration.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
2019-05-31 17:54:28 +02:00
Erik Skultety
610635a8da docs: Drop the external AMD SEV links
One of the current SEV document links went dead as AMD moved the
resource to another place (document store), so there's probably very
little point in maintaining 3rd party links if the resources are being
moved.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
2019-05-31 16:19:04 +02:00
Andrea Bolognani
4c7b5cdb16 news: Update for 5.4.0 release
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
2019-05-31 13:29:47 +02:00
Andrea Bolognani
61c1e5e007 news: Reformat overgrown line
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
2019-05-31 13:29:12 +02:00
Jim Fehlig
76b420d003 build: fix linking libqemutestdriver with LTO enabled
openSUSE Factory is in the process of enabling Link Time Optimization [0]
and stumbled upon missing symbols when linking libqemutestdriver

libtool: link: gcc -shared  -fPIC -DPIC  ../src/libvirt_qemu_probes.o  \
-Wl,--whole-archive ../src/.libs/libvirt_driver_qemu_impl.a \
../src/.libs/libvirt_driver_network_impl.a \
../src/.libs/libvirt_driver_storage_impl.a -Wl,--no-whole-archive  \
-lcap-ng -lgnutls -lnl-route-3 -lnl-3 -ldbus-1 -lselinux -lapparmor \
/usr/lib/libxml2.so -ldl -lz -llzma -lm -lblkid -ltirpc  \
-fstack-protector-strong -O2 -fstack-protector-strong -flto=16 -g -O2 \
-fstack-protector-strong -flto=16 -g \
-Wl,-soname -Wl,libqemutestdriver.so -o .libs/libqemutestdriver.so
...
/usr/lib/gcc/i586-suse-linux/9/../../../../i586-suse-linux/bin/ld: ./.libs/libqemutestdriver.so: undefined reference to `mdir_name'
/usr/lib/gcc/i586-suse-linux/9/../../../../i586-suse-linux/bin/ld: ./.libs/libqemutestdriver.so: undefined reference to `rpl_ioctl'
/usr/lib/gcc/i586-suse-linux/9/../../../../i586-suse-linux/bin/ld: ./.libs/libqemutestdriver.so: undefined reference to `rpl_pipe2'
/usr/lib/gcc/i586-suse-linux/9/../../../../i586-suse-linux/bin/ld: ./.libs/libqemutestdriver.so: undefined reference to `recvfd'
/usr/lib/gcc/i586-suse-linux/9/../../../../i586-suse-linux/bin/ld: ./.libs/libqemutestdriver.so: undefined reference to `c_strcasecmp'

The missing symbols are provided by GNUlib. Add it when linking
libqemutestdriver.

[0] https://en.opensuse.org/openSUSE:LTO

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
2019-05-30 09:09:10 -06:00
Nikolay Shirokovskiy
76be4f5dda vz: fixes: snapshot: s/parent/parent_name/ as prep for virObject
Apply renaming of 36603bc56 for the vz driver.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2019-05-28 13:35:17 +03:00
Martin Kletzander
e4030aac15 docs: Add emulatorsched fix info to news.xml
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2019-05-27 16:05:23 +02:00
Martin Kletzander
c67a3c0fc3 qemu: Set emulator thread scheduler only after QEMU starts
If the scheduler is set before vCPU0 cannot be moved into its cpu,cpuacct
cgroup.  While it is not yet known whether this is a bug or not, it makes sense
for us to do that later as otherwise the scheduler would be inherited by vCPU
and I/O Threads even when they do not have any such setting specified.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2019-05-27 16:05:23 +02:00
Ilias Stamatis
b3908d2efb test_driver: implement virDomainMemoryPeek
Begins by writing a @start byte in the first position of @buffer and
then for every next byte it stores the value of its previous one
incremented by one.

Behaves the same for both supported flags.

Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-05-27 15:29:13 +02:00
Andrea Bolognani
f8c734572c spec: Improve handling for default network
This is exactly how we already treat nwfilters, which require
the same kind of care (aka nasty hacks) as the default network,
because in both cases the UUID is generated and written to
disk the first time libvirtd is started after installing the
corresponding subpackage.

After this patch, RPM will be aware of the fact that the
libvirt-daemon-config-network subpackage owns the default
network.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
2019-05-27 15:24:05 +02:00
Jiri Denemark
7cf7eab52d spec: Fix permissions of /var/run/libvirt/qemu
While libvirtd creates this directory with the default 0755 mode, the
spec file stores 0700 in the RPM database. Thus RPM verification always
complains about this directory. Let's fix the spec file to match
reality.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2019-05-27 15:00:11 +02:00
Jiri Denemark
f87d5a964f spec: Fix permissions of nwfilter XMLs
The nwfilter XML files stored in /etc/libvirt/nwfilter are copied in a
%post scriptlet from /usr/share/libvirt/nwfilter/*.xml. While the files
in /usr/share are created with mode 0644, libvirt creates the files in
/etc/libvirt/nwfilter with mode 0600. Since 0600 is also stored in the
RPM database, we need to chmod the files copied from /usr/share to make
sure RPM verification does not complain about changed permissions.

https://bugzilla.redhat.com/show_bug.cgi?id=1628475

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2019-05-27 15:00:11 +02:00
Jiri Denemark
e67b0a4576 spec: Unconditionally set ownership of /var/lib/libvirt/sanlock
The libvirt-lock-sanlock subpackage requires sanlock to be installed
first and the sanlock package creates the sanlock group on all distros
we care about in the spec file (Fedora and RHEL >= 7). Thus instead of
setting the ownership and permissions in a post scriptlet only when the
sanlock group exists we can just install the directory with the
appropriate metadata.

https://bugzilla.redhat.com/show_bug.cgi?id=1702758

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
2019-05-27 15:00:11 +02:00
Michal Privoznik
c46bdad576 qemu: Get default hugepage size only if needed
Fixes: 6864d8f740

Hugepages don't work in session mode but when building memory
part of command line we query for the default size anyway. This
breaks creating domains under session daemon. Query the page size
only if it's clear we need hugepages.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2019-05-27 14:51:39 +02:00
Erik Skultety
3f4d0341e4 docs: Link the relevant SEV formatdomain section from formatdomaincaps
formatdomaincaps.html provides explanation of SEV fields, but doesn't
link to the domain XML docs to show how it can be actually used in
libvirt.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2019-05-27 09:24:05 +02:00
Erik Skultety
ab48fe7991 driver: test: Fix the mingw build caused by wrong printf format specifier
Caused by commit 326c3f54.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2019-05-24 14:24:18 +02:00
Ján Tomko
7389b08488 virDomainDefPostParse: use DOMAIN_DEVICE_ITERATE_MISSING_INFO
Apart from virDomainDefValidate, virDomainDefPostParse is another
place where operating on info-less devices makes sense.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-05-24 10:17:16 +02:00
Ilias Stamatis
326c3f54f2 test_driver: implement virDomainInterfaceAddresses
Ignore @source in the case of the test driver and return fixed private
IPv4 addresses for all the interfaces defined in the domain.

Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2019-05-24 10:01:05 +02:00
Ilias Stamatis
057b12d62a test_driver: add a guest interface in the default config
Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2019-05-24 10:01:05 +02:00
Daniel P. Berrangé
c6cbe18771 network: delay global firewall setup if no networks are running
Creating firewall rules for the virtual networks causes the kernel to
load the conntrack module. This imposes a significant performance
penalty on Linux network traffic. Thus we want to only take that hit if
we actually have virtual networks running.

We need to create global firewall rules during startup in order to
"upgrade" rules for any running networks created by older libvirt.
If no running networks are present though, we can safely delay setup
until the time we actually start a network.

Reviewed-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-05-23 16:29:48 +01:00
Daniel P. Berrangé
3b66bd9aa1 network: add more debugging of firewall chain creation
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-05-23 16:28:15 +01:00
Daniel P. Berrangé
4330d13852 network: pull global chain init into separate method
Pull the logic for creating global iptables chains into a separate
method and protect its invocation with virOnce, to make it possible
to reuse it in non-startup paths.

Reviewed-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-05-23 16:28:12 +01:00
Andrea Bolognani
435330d084 qemu: Tweak Intel IOMMU command line generation
Mostly add comments explaining why there are two capabilites
for the same feature and how they interact.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-05-23 15:19:06 +02:00
Andrea Bolognani
a7a78c273e qemu: Introduce qemuDomainDeviceDefValidateIOMMU()
Device validation should not have to wait until command line
generation time. Moving the code to a separate function also
allows us to avoid some unnecessary repetition.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-05-23 15:19:01 +02:00
Ján Tomko
b00f32c34d Introduce DOMAIN_DEVICE_ITERATE_MISSING_INFO
Rename the DOMAIN_DEVICE_ITERATE_GRAPHICS flag.
It was introduced by commit dd45c2710f
with the intention to run the Validate callback even on the graphics
device.

However, enumerating every single device in virDomainDeviceIterateFlags
is unsustainable and what really was special about the graphics device
was the lack of DeviceInfo.

Rename the flag and iterate over more info-less devices. (and leases)

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-05-23 14:41:16 +02:00
Erik Skultety
f3e777a3c4 docs: Change the 'Launch Security' section id to "launchSecurity"
Although there's currently only support for SEV, it's likely other
solutions will appear, so we should not refer to the documentation
section simply with 'sev'.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2019-05-23 14:29:00 +02:00
Michal Privoznik
ce0037442f misc: Drop useless checks from *Dispose() functions
Due to the way that our virObjectUnref() is written it's not
possible that a NULL is passed into *Dispose() function. However,
some functions check for that regardless.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2019-05-23 13:59:06 +02:00
Andrea Bolognani
69a8c64f4b tests: Add negative test for Intel IOMMU
Make sure validation is working as intended by trying to use
Intel IOMMU with the i440fx machine type, though we know it's
a q35-only feature, and expecting an error to be returned.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-05-22 14:54:32 +02:00
Andrea Bolognani
5b0dcbcdef tests: Use DO_TEST_CAPS_*() for Intel IOMMU
We can drop the intel-iommu-machine test case while doing so,
since it is supposed to showcase how we generate different
command lines for older QEMU versions and we can do that
using a single input file now.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-05-22 14:54:32 +02:00
Andrea Bolognani
4a744b578d tests: Simplify Intel IOMMU testing
Remove a bunch of irrelevant devices and make sure all input
files explicitly opt out of USB controllers: the latter change
will help later, when we start using DO_TEST_CAPS_*().

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-05-22 14:54:32 +02:00
Peter Krempa
9343db59ce docs: hacking: Discourage use of the ternary operator and ban it's abuse
Forbid breaking lines inside the two branches of the ternary operator
and nesting them. Using it in these instances does not help readability.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
ACKed-by: Eric Blake <eblake@redhat.com>
2019-05-22 14:46:29 +02:00
Peter Krempa
27dfb0280f docs: hacking: Add good practices for shortening conditional expressions
Document that checking if a integer is (non-)zero should (not must)
avoid the shortened form that C allows as it may confuse readers into
overlooking the other possible values which might be interresting to
handle.

While pointers have distinct values from the point of view of the code
we only care whether it's non-NULL and thus it's documented it's okay
to shorten those.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
ACKed-by: Eric Blake <eblake@redhat.com>
2019-05-22 14:46:29 +02:00
Peter Krempa
be432131ee docs: hacking: Document few practices for creating error messages
State that error messages should not be broken into multiple lines for
programmer friendliness and should not be concatenated on the fly for
translator friendliness and few other details.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
ACKed-by: Eric Blake <eblake@redhat.com>
2019-05-22 14:46:29 +02:00