[libvirt] [PATCH] qemu: Get default hugepage size only if needed
by Michal Privoznik
Fixes: 6864d8f740e2502dc7625bdf18ffde4465b14f69
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(a)redhat.com>
---
As a penance, I'll backport this onto v5.3-main branch too.
src/qemu/qemu_command.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 73f570c419..5bf6c704e0 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3573,7 +3573,7 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps,
pagesize = 0;
needHugepage = false;
useHugepage = false;
- } else if (pagesize == 0) {
+ } else if (useHugepage && pagesize == 0) {
if (qemuBuildMemoryGetDefaultPagesize(cfg, &pagesize) < 0)
goto cleanup;
}
--
2.21.0
5 years, 5 months
[libvirt] [PATCH] spec: Improve handling for default network
by Andrea Bolognani
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(a)redhat.com>
---
libvirt.spec.in | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index b159c50d8f..94691c38fb 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1250,8 +1250,8 @@ install -d -m 0755 $RPM_BUILD_ROOT%{_datadir}/lib/libvirt/dnsmasq/
install -d -m 0755 $RPM_BUILD_ROOT%{_datadir}/libvirt/networks/
cp $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu/networks/default.xml \
$RPM_BUILD_ROOT%{_datadir}/libvirt/networks/default.xml
-rm -f $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu/networks/default.xml
-rm -f $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu/networks/autostart/default.xml
+# libvirt saves this file with mode 0600
+chmod 0600 $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu/networks/default.xml
# nwfilter files are installed in /usr/share/libvirt and copied to /etc in %post
# to avoid verification errors on changed files in /etc
@@ -1427,6 +1427,8 @@ if test $1 -eq 1 && test ! -f %{_sysconfdir}/libvirt/qemu/networks/default.xml ;
< %{_datadir}/libvirt/networks/default.xml \
> %{_sysconfdir}/libvirt/qemu/networks/default.xml
ln -s ../default.xml %{_sysconfdir}/libvirt/qemu/networks/autostart/default.xml
+ # libvirt saves this file with mode 0600
+ chmod 0600 %{_sysconfdir}/libvirt/qemu/networks/default.xml
# Make sure libvirt picks up the new network defininiton
mkdir -p %{_localstatedir}/lib/rpm-state/libvirt || :
@@ -1577,6 +1579,8 @@ exit 0
%files daemon-config-network
%dir %{_datadir}/libvirt/networks/
%{_datadir}/libvirt/networks/default.xml
+%ghost %{_sysconfdir}/libvirt/qemu/networks/default.xml
+%ghost %{_sysconfdir}/libvirt/qemu/networks/autostart/default.xml
%files daemon-config-nwfilter
%dir %{_datadir}/libvirt/nwfilter/
--
2.21.0
5 years, 5 months
[libvirt] [PATCH] spec: Fix permissions of nwfilter XMLs
by Jiri Denemark
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.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
libvirt.spec.in | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 5bd3e30509..970d2742ac 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1441,6 +1441,8 @@ rm -rf %{_localstatedir}/lib/rpm-state/libvirt || :
%post daemon-config-nwfilter
cp %{_datadir}/libvirt/nwfilter/*.xml %{_sysconfdir}/libvirt/nwfilter/
+# libvirt saves these files with mode 600
+chmod 600 %{_sysconfdir}/libvirt/nwfilter/*.xml
# Make sure libvirt picks up the new nwfilter defininitons
mkdir -p %{_localstatedir}/lib/rpm-state/libvirt || :
touch %{_localstatedir}/lib/rpm-state/libvirt/restart || :
--
2.21.0
5 years, 5 months
[libvirt] [PATCH 0/5] Support embedding the QEMU driver in client apps directly
by Daniel P. Berrangé
This patch series proposes a new way to build a "libvirt QEMU shim"
which supports more use cases than the previous approach from last year,
as well as being vastly simpler to implement.
Specifically
- We can use this to embed the QEMU driver in unit tests allowing
the full range of odriver functionality to be exercised during
*unit* testing without interfering with the host OS libvirtd.
- Apps like libguestfs can embed the QEMU driver to allow them to
spawn VMs that are immediate children of their app, thus inheriting
process context, as well as hiding these "service VM" from the
main libvirtd.
This would avoid a common irritation where libguestfs VMs suddenly
appear & disappear in virt-manager's VM list.
- Apps like kubevirt could use this to eliminate the need to use the
RPC layer for libvirt. It can directly embed the QEMU driver giving
it more direct control over how it is run & again inheriting process
state. This is useful for kubevirt's one VM per container model
where Kubernetes itself provides the aggregated view, thus making
libvirtd's aggregated view redundant
- The previous shim was very much one shim == one QEMU process. This
new embed approach supports that of course, but there's also the
option to run multiple VMs if desired.
- Using a virtual root directory for QEMU driver state meams we do
not need to solve the hard refactoring problem of getting the main
libvirtd to detect the VMs launched via the shim. They can safely
live independantly.
- Thanks to the driver refactoring work it is still possible for the
embedded drivers to talk to main libvirtd to use the secondary
drivers for storage/network/etc if needed. Ideally we would allow
those secondary drivers to be embedded too but that's not implemented
here. Most important would be the secrets driver. Other drivers are
much less important.
Daniel P. Berrangé (5):
access: report an error if no access manager is present
libvirt: pass a root directory path into drivers
qemu: honour the root parameter during driver initialization
libvirt: support an "embed" URI path selector for QEMU driver
qemu: introduce a new style libvirt_qemu_shim program
src/access/viraccessmanager.c | 5 ++
src/driver-state.h | 1 +
src/interface/interface_backend_netcf.c | 1 +
src/interface/interface_backend_udev.c | 1 +
src/libvirt.c | 41 ++++++++++++++-
src/libvirt_internal.h | 1 +
src/libxl/libxl_driver.c | 1 +
src/lxc/lxc_driver.c | 2 +
src/network/bridge_driver.c | 1 +
src/node_device/node_device_hal.c | 1 +
src/node_device/node_device_udev.c | 1 +
src/nwfilter/nwfilter_driver.c | 1 +
src/qemu/Makefile.inc.am | 7 +++
src/qemu/qemu_conf.c | 41 +++++++++------
src/qemu/qemu_conf.h | 3 +-
src/qemu/qemu_driver.c | 9 ++--
src/qemu/qemu_shim.c | 70 +++++++++++++++++++++++++
src/remote/remote_daemon.c | 1 +
src/remote/remote_driver.c | 8 +++
src/secret/secret_driver.c | 1 +
src/storage/storage_driver.c | 1 +
src/vz/vz_driver.c | 1 +
22 files changed, 179 insertions(+), 20 deletions(-)
create mode 100644 src/qemu/qemu_shim.c
--
2.21.0
5 years, 5 months
[libvirt] [glib PATCH 0/2] Simplify autogen.sh & get rid of our own gtk-doc.make
by Fabiano Fidêncio
Let's use a similiar autogen.sh as the one used by libosinfo and, with
the change, let's also drop our own crafted gtk-doc.make (as we'll be
using gtkdocize to generate the file).
Fabiano Fidêncio (2):
autogen.sh: Simplify autogen.sh
gtk-doc.make: Remove the file
.gitignore | 4 +
autogen.sh | 70 +++++---------
gtk-doc.make | 256 ---------------------------------------------------
3 files changed, 29 insertions(+), 301 deletions(-)
delete mode 100644 gtk-doc.make
--
2.21.0
5 years, 5 months
[libvirt] [glib PATCH] docs: explicitly link against libvirt-g{config, lib, object}
by Fabiano Fidêncio
Let's explicitly link against the built libvirt-gconfig, libvirt-glib,
and libvirt-gobject libtool files for introspecting the gobjects.
In case it's *not* done we can run into some issues when where we try to
link against installed library, causing failures related to undefined
reference of the new symbols.
Signed-off-by: Fabiano Fidêncio <fidencio(a)redhat.com>
---
This issue was caught by libvirt-jenkins-ci on a debian-9 machine only.
However, it's easily reproducible with other distros.
https://ci.centos.org/job/libvirt-glib-build/systems=libvirt-debian-9/445...
---
docs/libvirt-gconfig/Makefile.am | 5 ++++-
docs/libvirt-glib/Makefile.am | 5 ++++-
docs/libvirt-gobject/Makefile.am | 5 ++++-
3 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/docs/libvirt-gconfig/Makefile.am b/docs/libvirt-gconfig/Makefile.am
index 6a3df37..7d02354 100644
--- a/docs/libvirt-gconfig/Makefile.am
+++ b/docs/libvirt-gconfig/Makefile.am
@@ -34,6 +34,9 @@ GTKDOC_CFLAGS= \
GTKDOC_LIBS = \
$(GOBJECT2_LIBS) \
$(LIBXML2_LIBS) \
- $(top_builddir)/libvirt-gconfig/libvirt-gconfig-1.0.la
+ $(top_builddir)/libvirt-glib/libvirt-glib-1.0.la \
+ $(top_builddir)/libvirt-gconfig/libvirt-gconfig-1.0.la \
+ $(top_builddir)/libvirt-gobject/libvirt-gobject-1.0.la \
+ $(NULL)
include $(top_srcdir)/gtk-doc.make
diff --git a/docs/libvirt-glib/Makefile.am b/docs/libvirt-glib/Makefile.am
index 186f8ff..e3445b9 100644
--- a/docs/libvirt-glib/Makefile.am
+++ b/docs/libvirt-glib/Makefile.am
@@ -36,7 +36,10 @@ GTKDOC_LIBS = \
$(LIBVIRT_LIBS) \
$(GLIB2_LIBS) \
$(GTHREAD2_LIBS) \
- $(top_builddir)/libvirt-glib/libvirt-glib-1.0.la
+ $(top_builddir)/libvirt-glib/libvirt-glib-1.0.la \
+ $(top_builddir)/libvirt-gconfig/libvirt-gconfig-1.0.la \
+ $(top_builddir)/libvirt-gobject/libvirt-gobject-1.0.la \
+ $(NULL)
include $(top_srcdir)/gtk-doc.make
diff --git a/docs/libvirt-gobject/Makefile.am b/docs/libvirt-gobject/Makefile.am
index c068a96..f54c389 100644
--- a/docs/libvirt-gobject/Makefile.am
+++ b/docs/libvirt-gobject/Makefile.am
@@ -36,6 +36,9 @@ GTKDOC_LIBS = \
$(LIBVIRT_LIBS) \
$(GOBJECT2_LIBS) \
$(GIO2_LIBS) \
- $(top_builddir)/libvirt-gobject/libvirt-gobject-1.0.la
+ $(top_builddir)/libvirt-glib/libvirt-glib-1.0.la \
+ $(top_builddir)/libvirt-gconfig/libvirt-gconfig-1.0.la \
+ $(top_builddir)/libvirt-gobject/libvirt-gobject-1.0.la \
+ $(NULL)
include $(top_srcdir)/gtk-doc.make
--
2.21.0
5 years, 5 months
[libvirt] [PATCH] nodesuspend: report unsupported if systemd & pm-utils aren't available
by Daniel P. Berrangé
When libvirtd is run inside a container it is normal that neither
systemd nor pm-utils will be available. In this case there is no way to
suspend the host, so libvirt should just report the feature unsupported
instead of raising an error.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/util/virnodesuspend.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/util/virnodesuspend.c b/src/util/virnodesuspend.c
index 0af0908e4a..3fc5b93ac7 100644
--- a/src/util/virnodesuspend.c
+++ b/src/util/virnodesuspend.c
@@ -330,11 +330,10 @@ virNodeSuspendSupportsTarget(unsigned int target, bool *supported)
if (ret == -2)
ret = virNodeSuspendSupportsTargetPMUtils(target, supported);
- /* If still unavailable, then report error */
+ /* If still unavailable, then report unsupported */
if (ret == -2) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Cannot probe for supported suspend types"));
- ret = -1;
+ *supported = false;
+ ret = 0;
}
return ret;
--
2.21.0
5 years, 5 months
[libvirt] [PATCH] spec: Unconditionally set ownership of /var/lib/libvirt/sanlock
by Jiri Denemark
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(a)redhat.com>
---
libvirt.spec.in | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index b159c50d8f..5bd3e30509 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1479,14 +1479,6 @@ exit 0
%postun client
%systemd_postun libvirt-guests.service
-%if %{with_sanlock}
-%post lock-sanlock
-if getent group sanlock > /dev/null ; then
- chmod 0770 %{_localstatedir}/lib/libvirt/sanlock
- chown root:sanlock %{_localstatedir}/lib/libvirt/sanlock
-fi
-%endif
-
%if %{with_lxc}
%pre login-shell
getent group virtlogin >/dev/null || groupadd -r virtlogin
@@ -1739,7 +1731,7 @@ exit 0
%attr(0755, root, root) %{_libdir}/libvirt/lock-driver/sanlock.so
%{_datadir}/augeas/lenses/libvirt_sanlock.aug
%{_datadir}/augeas/lenses/tests/test_libvirt_sanlock.aug
-%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/sanlock
+%dir %attr(0770, root, sanlock) %{_localstatedir}/lib/libvirt/sanlock
%{_sbindir}/virt-sanlock-cleanup
%{_mandir}/man8/virt-sanlock-cleanup.8*
%attr(0755, root, root) %{_libexecdir}/libvirt_sanlock_helper
--
2.21.0
5 years, 5 months