Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
90207a429e | ||
|
ea04e2dddf | ||
|
c207216544 | ||
|
598f426d2a | ||
|
997d61802f |
55
0001-Fix-padding-of-encrypted-data.patch
Normal file
55
0001-Fix-padding-of-encrypted-data.patch
Normal file
@ -0,0 +1,55 @@
|
||||
From: "Daniel P. Berrange" <berrange@redhat.com>
|
||||
Date: Tue, 2 May 2017 11:32:43 +0100
|
||||
Subject: [PATCH] Fix padding of encrypted data
|
||||
|
||||
If we are encoding a block of data that is 16 bytes in length,
|
||||
we cannot leave it as 16 bytes, we must pad it out to the next
|
||||
block boundary, 32 bytes. Without this padding, the decoder will
|
||||
incorrectly treat the last byte of plain text as the padding
|
||||
length, as it can't distinguish padded from non-padded data.
|
||||
|
||||
The problem exhibited itself when using a 16 byte passphrase
|
||||
for a LUKS volume
|
||||
|
||||
$ virsh secret-set-value 55806c7d-8e93-456f-829b-607d8c198367 \
|
||||
$(echo -n 1234567812345678 | base64)
|
||||
Secret value set
|
||||
|
||||
$ virsh start demo
|
||||
error: Failed to start domain demo
|
||||
error: internal error: process exited while connecting to monitor: >>>>>>>>>>Len 16
|
||||
2017-05-02T10:35:40.016390Z qemu-system-x86_64: -object \
|
||||
secret,id=virtio-disk1-luks-secret0,data=SEtNi5vDUeyseMKHwc1c1Q==,\
|
||||
keyid=masterKey0,iv=zm7apUB1A6dPcH53VW960Q==,format=base64: \
|
||||
Incorrect number of padding bytes (56) found on decrypted data
|
||||
|
||||
Notice how the padding '56' corresponds to the ordinal value of
|
||||
the character '8'.
|
||||
|
||||
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
|
||||
(cherry picked from commit 71890992daf37ec78b00b4ce873369421dc99731)
|
||||
---
|
||||
src/util/vircrypto.c | 10 ++++++++--
|
||||
1 file changed, 8 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/util/vircrypto.c b/src/util/vircrypto.c
|
||||
index 03410a1a4..8f1e0b7b7 100644
|
||||
--- a/src/util/vircrypto.c
|
||||
+++ b/src/util/vircrypto.c
|
||||
@@ -152,8 +152,14 @@ virCryptoEncryptDataAESgnutls(gnutls_cipher_algorithm_t gnutls_enc_alg,
|
||||
uint8_t *ciphertext;
|
||||
size_t ciphertextlen;
|
||||
|
||||
- /* Allocate a padded buffer, copy in the data */
|
||||
- ciphertextlen = VIR_ROUND_UP(datalen, 16);
|
||||
+ /* Allocate a padded buffer, copy in the data.
|
||||
+ *
|
||||
+ * NB, we must *always* have at least 1 byte of
|
||||
+ * padding - we can't skip it on multiples of
|
||||
+ * 16, otherwise decoder can't distinguish padded
|
||||
+ * data from non-padded data. Hence datalen + 1
|
||||
+ */
|
||||
+ ciphertextlen = VIR_ROUND_UP(datalen + 1, 16);
|
||||
if (VIR_ALLOC_N(ciphertext, ciphertextlen) < 0)
|
||||
return -1;
|
||||
memcpy(ciphertext, data, datalen);
|
@ -1,242 +0,0 @@
|
||||
From c0bc172383c2c955394589e5808457935ae06f1d Mon Sep 17 00:00:00 2001
|
||||
From: "Daniel P. Berrange" <berrange@redhat.com>
|
||||
Date: Mon, 6 Jun 2016 15:03:27 +0100
|
||||
Subject: [PATCH] systemd: directly notify systemd instead of using sd_notify
|
||||
|
||||
The sd_notify method is used to tell systemd when libvirtd
|
||||
has finished starting up. All it does is send a datagram
|
||||
containing the string parameter to systemd on a UNIX socket
|
||||
named in the NOTIFY_SOCKET environment variable. Rather than
|
||||
pulling in the systemd libraries for this, just code the
|
||||
notification directly in libvirt as this is a stable ABI
|
||||
from systemd's POV which explicitly allows independant
|
||||
implementations:
|
||||
|
||||
See "Reimplementable Independently" column in the
|
||||
"$NOTIFY_SOCKET Daemon Notifications" row:
|
||||
|
||||
https://www.freedesktop.org/wiki/Software/systemd/InterfacePortabilityAndStabilityChart/
|
||||
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1314881
|
||||
|
||||
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
|
||||
---
|
||||
configure.ac | 2 --
|
||||
libvirt.spec.in | 12 -----------
|
||||
m4/virt-systemd-daemon.m4 | 34 ------------------------------
|
||||
src/Makefile.am | 4 ++--
|
||||
src/util/virsystemd.c | 53 ++++++++++++++++++++++++++++++++++++++++++-----
|
||||
5 files changed, 50 insertions(+), 55 deletions(-)
|
||||
delete mode 100644 m4/virt-systemd-daemon.m4
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index f2554a4..12eb3b3 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -256,7 +256,6 @@ LIBVIRT_CHECK_SANLOCK
|
||||
LIBVIRT_CHECK_SASL
|
||||
LIBVIRT_CHECK_SELINUX
|
||||
LIBVIRT_CHECK_SSH2
|
||||
-LIBVIRT_CHECK_SYSTEMD_DAEMON
|
||||
LIBVIRT_CHECK_UDEV
|
||||
LIBVIRT_CHECK_WIRESHARK
|
||||
LIBVIRT_CHECK_NSS
|
||||
@@ -2787,7 +2786,6 @@ LIBVIRT_RESULT_SANLOCK
|
||||
LIBVIRT_RESULT_SASL
|
||||
LIBVIRT_RESULT_SELINUX
|
||||
LIBVIRT_RESULT_SSH2
|
||||
-LIBVIRT_RESULT_SYSTEMD_DAEMON
|
||||
LIBVIRT_RESULT_UDEV
|
||||
LIBVIRT_RESULT_WIRESHARK
|
||||
LIBVIRT_RESULT_NSS
|
||||
diff --git a/libvirt.spec.in b/libvirt.spec.in
|
||||
index 8b88eef..b93a53c 100644
|
||||
--- a/libvirt.spec.in
|
||||
+++ b/libvirt.spec.in
|
||||
@@ -79,7 +79,6 @@
|
||||
%define with_firewalld 0%{!?_without_firewalld:0}
|
||||
%define with_libssh2 0%{!?_without_libssh2:0}
|
||||
%define with_wireshark 0%{!?_without_wireshark:0}
|
||||
-%define with_systemd_daemon 0%{!?_without_systemd_daemon:0}
|
||||
%define with_pm_utils 1
|
||||
|
||||
# Finally set the OS / architecture specific special cases
|
||||
@@ -133,7 +132,6 @@
|
||||
# Fedora has systemd, libvirt still used sysvinit there.
|
||||
%if 0%{?fedora} || 0%{?rhel} >= 7
|
||||
%define with_systemd 1
|
||||
- %define with_systemd_daemon 1
|
||||
%define with_pm_utils 0
|
||||
%endif
|
||||
|
||||
@@ -268,9 +266,6 @@ BuildRequires: python
|
||||
%if %{with_systemd}
|
||||
BuildRequires: systemd-units
|
||||
%endif
|
||||
-%if %{with_systemd_daemon}
|
||||
-BuildRequires: systemd-devel
|
||||
-%endif
|
||||
%if %{with_xen} || %{with_libxl}
|
||||
BuildRequires: xen-devel
|
||||
%endif
|
||||
@@ -1061,12 +1056,6 @@ rm -rf .git
|
||||
%define arg_wireshark --without-wireshark-dissector
|
||||
%endif
|
||||
|
||||
-%if %{with_systemd_daemon}
|
||||
- %define arg_systemd_daemon --with-systemd-daemon
|
||||
-%else
|
||||
- %define arg_systemd_daemon --without-systemd-daemon
|
||||
-%endif
|
||||
-
|
||||
%if %{with_pm_utils}
|
||||
%define arg_pm_utils --with-pm-utils
|
||||
%else
|
||||
@@ -1157,7 +1146,6 @@ rm -f po/stamp-po
|
||||
--with-driver-modules \
|
||||
%{?arg_firewalld} \
|
||||
%{?arg_wireshark} \
|
||||
- %{?arg_systemd_daemon} \
|
||||
%{?arg_pm_utils} \
|
||||
--with-nss-plugin \
|
||||
%{arg_packager} \
|
||||
diff --git a/m4/virt-systemd-daemon.m4 b/m4/virt-systemd-daemon.m4
|
||||
deleted file mode 100644
|
||||
index 8516e41..0000000
|
||||
--- a/m4/virt-systemd-daemon.m4
|
||||
+++ /dev/null
|
||||
@@ -1,34 +0,0 @@
|
||||
-dnl The libsystemd-daemon.so library
|
||||
-dnl
|
||||
-dnl Copyright (C) 2012-2013 Red Hat, Inc.
|
||||
-dnl
|
||||
-dnl This library is free software; you can redistribute it and/or
|
||||
-dnl modify it under the terms of the GNU Lesser General Public
|
||||
-dnl License as published by the Free Software Foundation; either
|
||||
-dnl version 2.1 of the License, or (at your option) any later version.
|
||||
-dnl
|
||||
-dnl This library is distributed in the hope that it will be useful,
|
||||
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
-dnl Lesser General Public License for more details.
|
||||
-dnl
|
||||
-dnl You should have received a copy of the GNU Lesser General Public
|
||||
-dnl License along with this library. If not, see
|
||||
-dnl <http://www.gnu.org/licenses/>.
|
||||
-dnl
|
||||
-
|
||||
-AC_DEFUN([LIBVIRT_CHECK_SYSTEMD_DAEMON],[
|
||||
- LIBVIRT_CHECK_PKG([SYSTEMD_DAEMON], [libsystemd-daemon], [0.27.1])
|
||||
-
|
||||
- old_CFLAGS="$CFLAGS"
|
||||
- old_LIBS="$LIBS"
|
||||
- CFLAGS="$CFLAGS $SYSTEMD_DAEMON_CFLAGS"
|
||||
- LIBS="$LIBS $SYSTEMD_DAEMON_LIBS"
|
||||
- AC_CHECK_FUNCS([sd_notify])
|
||||
- CFLAGS="$old_CFLAGS"
|
||||
- LIBS="$old_LIBS"
|
||||
-])
|
||||
-
|
||||
-AC_DEFUN([LIBVIRT_RESULT_SYSTEMD_DAEMON],[
|
||||
- LIBVIRT_RESULT_LIB([SYSTEMD_DAEMON])
|
||||
-])
|
||||
diff --git a/src/Makefile.am b/src/Makefile.am
|
||||
index f3c9a14..f020b92 100644
|
||||
--- a/src/Makefile.am
|
||||
+++ b/src/Makefile.am
|
||||
@@ -1107,12 +1107,12 @@ libvirt_util_la_SOURCES = \
|
||||
libvirt_util_la_CFLAGS = $(CAPNG_CFLAGS) $(YAJL_CFLAGS) $(LIBNL_CFLAGS) \
|
||||
$(AM_CFLAGS) $(AUDIT_CFLAGS) $(DEVMAPPER_CFLAGS) \
|
||||
$(DBUS_CFLAGS) $(LDEXP_LIBM) $(NUMACTL_CFLAGS) \
|
||||
- $(SYSTEMD_DAEMON_CFLAGS) $(POLKIT_CFLAGS) $(GNUTLS_CFLAGS) \
|
||||
+ $(POLKIT_CFLAGS) $(GNUTLS_CFLAGS) \
|
||||
-I$(srcdir)/conf
|
||||
libvirt_util_la_LIBADD = $(CAPNG_LIBS) $(YAJL_LIBS) $(LIBNL_LIBS) \
|
||||
$(THREAD_LIBS) $(AUDIT_LIBS) $(DEVMAPPER_LIBS) \
|
||||
$(LIB_CLOCK_GETTIME) $(DBUS_LIBS) $(MSCOM_LIBS) $(LIBXML_LIBS) \
|
||||
- $(SECDRIVER_LIBS) $(NUMACTL_LIBS) $(SYSTEMD_DAEMON_LIBS) \
|
||||
+ $(SECDRIVER_LIBS) $(NUMACTL_LIBS) \
|
||||
$(POLKIT_LIBS)
|
||||
|
||||
|
||||
diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
|
||||
index 4883f94..871db7e 100644
|
||||
--- a/src/util/virsystemd.c
|
||||
+++ b/src/util/virsystemd.c
|
||||
@@ -21,8 +21,9 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
-#ifdef WITH_SYSTEMD_DAEMON
|
||||
-# include <systemd/sd-daemon.h>
|
||||
+#include <sys/socket.h>
|
||||
+#ifdef HAVE_SYS_UN_H
|
||||
+# include <sys/un.h>
|
||||
#endif
|
||||
|
||||
#include "virsystemd.h"
|
||||
@@ -34,6 +35,7 @@
|
||||
#include "virutil.h"
|
||||
#include "virlog.h"
|
||||
#include "virerror.h"
|
||||
+#include "virfile.h"
|
||||
|
||||
#define VIR_FROM_THIS VIR_FROM_SYSTEMD
|
||||
|
||||
@@ -480,9 +482,50 @@ int virSystemdTerminateMachine(const char *name)
|
||||
void
|
||||
virSystemdNotifyStartup(void)
|
||||
{
|
||||
-#ifdef WITH_SYSTEMD_DAEMON
|
||||
- sd_notify(0, "READY=1");
|
||||
-#endif
|
||||
+#ifdef HAVE_SYS_UN_H
|
||||
+ const char *path;
|
||||
+ const char *msg = "READY=1";
|
||||
+ int fd;
|
||||
+ struct sockaddr_un un = {
|
||||
+ .sun_family = AF_UNIX,
|
||||
+ };
|
||||
+ struct iovec iov = {
|
||||
+ .iov_base = (char *)msg,
|
||||
+ .iov_len = strlen(msg),
|
||||
+ };
|
||||
+ struct msghdr mh = {
|
||||
+ .msg_name = &un,
|
||||
+ .msg_namelen = sizeof(un),
|
||||
+ .msg_iov = &iov,
|
||||
+ .msg_iovlen = 1,
|
||||
+ };
|
||||
+
|
||||
+ if (!(path = virGetEnvBlockSUID("NOTIFY_SOCKET"))) {
|
||||
+ VIR_DEBUG("Skipping systemd notify, not requested");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ /* NB sun_path field is *not* NUL-terminated, hence >, not >= */
|
||||
+ if (strlen(path) > sizeof(un.sun_path)) {
|
||||
+ VIR_WARN("Systemd notify socket path '%s' too long", path);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ memcpy(un.sun_path, path, strlen(path));
|
||||
+ if (un.sun_path[0] == '@')
|
||||
+ un.sun_path[0] = '\0';
|
||||
+
|
||||
+ fd = socket(AF_UNIX, SOCK_DGRAM, 0);
|
||||
+ if (fd < 0) {
|
||||
+ VIR_WARN("Unable to create socket FD");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (sendmsg(fd, &mh, MSG_NOSIGNAL) < 0)
|
||||
+ VIR_WARN("Failed to notify systemd");
|
||||
+
|
||||
+ VIR_FORCE_CLOSE(fd);
|
||||
+#endif /* HAVE_SYS_UN_H */
|
||||
}
|
||||
|
||||
static int
|
||||
--
|
||||
2.5.5
|
||||
|
@ -0,0 +1,90 @@
|
||||
From: Neal Gompa <ngompa13@gmail.com>
|
||||
Date: Mon, 17 Jul 2017 11:32:46 -0400
|
||||
Subject: [PATCH] spec: Add support for building the zfs storage driver
|
||||
|
||||
Where it can be supported in Fedora, the driver is built and made
|
||||
available as a subpackage.
|
||||
|
||||
Signed-off-by: Neal Gompa <ngompa13@gmail.com>
|
||||
(cherry picked from commit 9af764e86aef7dfb0191a9561bf1d1abf941da05)
|
||||
---
|
||||
libvirt.spec.in | 31 +++++++++++++++++++++++++++++++
|
||||
1 file changed, 31 insertions(+)
|
||||
|
||||
diff --git a/libvirt.spec.in b/libvirt.spec.in
|
||||
index 8eb67fa2e..f9a705e7c 100644
|
||||
--- a/libvirt.spec.in
|
||||
+++ b/libvirt.spec.in
|
||||
@@ -70,6 +70,13 @@
|
||||
%define with_storage_gluster 0%{!?_without_storage_gluster:1}
|
||||
%define with_numactl 0%{!?_without_numactl:1}
|
||||
|
||||
+# F25+ has zfs-fuse
|
||||
+%if 0%{?fedora} >= 25
|
||||
+ %define with_storage_zfs 0%{!?_without_storage_zfs:1}
|
||||
+%else
|
||||
+ %define with_storage_zfs 0
|
||||
+%endif
|
||||
+
|
||||
# A few optional bits off by default, we enable later
|
||||
%define with_fuse 0%{!?_without_fuse:0}
|
||||
%define with_cgconfig 0%{!?_without_cgconfig:0}
|
||||
@@ -113,6 +120,12 @@
|
||||
%endif
|
||||
%endif
|
||||
|
||||
+# zfs-fuse is not available on some architectures
|
||||
+%ifarch s390 s390x aarch64
|
||||
+ %define with_storage_zfs 0
|
||||
+%endif
|
||||
+
|
||||
+
|
||||
# RHEL doesn't ship OpenVZ, VBox, UML, PowerHypervisor,
|
||||
# VMware, libxenserver (xenapi), libxenlight (Xen 4.1 and newer),
|
||||
# or HyperV.
|
||||
@@ -364,6 +377,12 @@ BuildRequires: glusterfs-devel >= 3.4.1
|
||||
%if %{with_storage_sheepdog}
|
||||
BuildRequires: sheepdog
|
||||
%endif
|
||||
+%if %{with_storage_zfs}
|
||||
+# Support any conforming implementation of zfs. On stock Fedora
|
||||
+# this is zfs-fuse, but could be zfsonlinux upstream RPMs
|
||||
+BuildRequires: /sbin/zfs
|
||||
+BuildRequires: /sbin/zpool
|
||||
+%endif
|
||||
%if %{with_numactl}
|
||||
# For QEMU/LXC numa info
|
||||
BuildRequires: numactl-devel
|
||||
@@ -597,6 +616,11 @@ Requires: device-mapper
|
||||
# For Sheepdog support
|
||||
Requires: sheepdog
|
||||
%endif
|
||||
+%if %{with_storage_zfs}
|
||||
+# Support any conforming implementation of zfs
|
||||
+Requires: /sbin/zfs
|
||||
+Requires: /sbin/zpool
|
||||
+%endif
|
||||
%if %{with_qemu}
|
||||
# From QEMU RPMs
|
||||
Requires: /usr/bin/qemu-img
|
||||
@@ -1063,6 +1087,12 @@ rm -rf .git
|
||||
%define arg_storage_gluster --without-storage-gluster
|
||||
%endif
|
||||
|
||||
+%if %{with_storage_zfs}
|
||||
+ %define arg_storage_zfs --with-storage-zfs
|
||||
+%else
|
||||
+ %define arg_storage_zfs --without-storage-zfs
|
||||
+%endif
|
||||
+
|
||||
%if %{with_numactl}
|
||||
%define arg_numactl --with-numactl
|
||||
%else
|
||||
@@ -1170,6 +1200,7 @@ rm -f po/stamp-po
|
||||
%{?arg_storage_rbd} \
|
||||
%{?arg_storage_sheepdog} \
|
||||
%{?arg_storage_gluster} \
|
||||
+ %{?arg_storage_zfs} \
|
||||
%{?arg_numactl} \
|
||||
%{?arg_numad} \
|
||||
--with-capng \
|
150
0003-Avoid-hidden-cgroup-mount-points.patch
Normal file
150
0003-Avoid-hidden-cgroup-mount-points.patch
Normal file
@ -0,0 +1,150 @@
|
||||
From: Juan Hernandez <jhernand@redhat.com>
|
||||
Date: Thu, 6 Jul 2017 17:03:31 +0200
|
||||
Subject: [PATCH] Avoid hidden cgroup mount points
|
||||
|
||||
Currently the scan of the /proc/mounts file used to find cgroup mount
|
||||
points doesn't take into account that mount points may hidden by other
|
||||
mount points. For, example in certain Kubernetes environments the
|
||||
/proc/mounts contains the following lines:
|
||||
|
||||
cgroup /sys/fs/cgroup/net_prio,net_cls cgroup ...
|
||||
tmpfs /sys/fs/cgroup tmpfs ...
|
||||
cgroup /sys/fs/cgroup/net_cls,net_prio cgroup ...
|
||||
|
||||
In this particular environment the first mount point is hidden by the
|
||||
second one. The correct mount point is the third one, but libvirt will
|
||||
never process it because it only checks the first mount point for each
|
||||
controller (net_cls in this case). So libvirt will try to use the first
|
||||
mount point, which doesn't actually exist, and the complete detection
|
||||
process will fail.
|
||||
|
||||
To avoid that issue this patch changes the virCgroupDetectMountsFromFile
|
||||
function so that when there are duplicates it takes the information from
|
||||
the last line in /proc/mounts. This requires removing the previous
|
||||
explicit condition to skip duplicates, and adding code to free the
|
||||
memory used by the processing of duplicated lines.
|
||||
|
||||
Related-To: https://bugzilla.redhat.com/1468214
|
||||
Related-To: https://github.com/kubevirt/libvirt/issues/4
|
||||
Signed-off-by: Juan Hernandez <jhernand@redhat.com>
|
||||
(cherry picked from commit dacd160d7479e0ec2d8a63f102145fd30636a1c8)
|
||||
---
|
||||
src/util/vircgroup.c | 23 ++++++++++++++---------
|
||||
tests/vircgroupdata/kubevirt.mounts | 25 +++++++++++++++++++++++++
|
||||
tests/vircgroupdata/kubevirt.parsed | 10 ++++++++++
|
||||
tests/vircgrouptest.c | 1 +
|
||||
4 files changed, 50 insertions(+), 9 deletions(-)
|
||||
create mode 100644 tests/vircgroupdata/kubevirt.mounts
|
||||
create mode 100644 tests/vircgroupdata/kubevirt.parsed
|
||||
|
||||
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
|
||||
index f2477d5e9..322f7fb54 100644
|
||||
--- a/src/util/vircgroup.c
|
||||
+++ b/src/util/vircgroup.c
|
||||
@@ -396,6 +396,7 @@ virCgroupDetectMountsFromFile(virCgroupPtr group,
|
||||
const char *typestr = virCgroupControllerTypeToString(i);
|
||||
int typelen = strlen(typestr);
|
||||
char *tmp = entry.mnt_opts;
|
||||
+ struct virCgroupController *controller = &group->controllers[i];
|
||||
while (tmp) {
|
||||
char *next = strchr(tmp, ',');
|
||||
int len;
|
||||
@@ -405,18 +406,22 @@ virCgroupDetectMountsFromFile(virCgroupPtr group,
|
||||
} else {
|
||||
len = strlen(tmp);
|
||||
}
|
||||
- /* NB, the same controller can appear >1 time in mount list
|
||||
- * due to bind mounts from one location to another. Pick the
|
||||
- * first entry only
|
||||
- */
|
||||
- if (typelen == len && STREQLEN(typestr, tmp, len) &&
|
||||
- !group->controllers[i].mountPoint) {
|
||||
+
|
||||
+ if (typelen == len && STREQLEN(typestr, tmp, len)) {
|
||||
char *linksrc;
|
||||
struct stat sb;
|
||||
char *tmp2;
|
||||
|
||||
- if (VIR_STRDUP(group->controllers[i].mountPoint,
|
||||
- entry.mnt_dir) < 0)
|
||||
+ /* Note that the lines in /proc/mounts have the same
|
||||
+ * order than the mount operations, and that there may
|
||||
+ * be duplicates due to bind mounts. This means
|
||||
+ * that the same mount point may be processed more than
|
||||
+ * once. We need to save the results of the last one,
|
||||
+ * and we need to be careful to release the memory used
|
||||
+ * by previous processing. */
|
||||
+ VIR_FREE(controller->mountPoint);
|
||||
+ VIR_FREE(controller->linkPoint);
|
||||
+ if (VIR_STRDUP(controller->mountPoint, entry.mnt_dir) < 0)
|
||||
goto error;
|
||||
|
||||
tmp2 = strrchr(entry.mnt_dir, '/');
|
||||
@@ -452,7 +457,7 @@ virCgroupDetectMountsFromFile(virCgroupPtr group,
|
||||
VIR_WARN("Expecting a symlink at %s for controller %s",
|
||||
linksrc, typestr);
|
||||
} else {
|
||||
- group->controllers[i].linkPoint = linksrc;
|
||||
+ controller->linkPoint = linksrc;
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/tests/vircgroupdata/kubevirt.mounts b/tests/vircgroupdata/kubevirt.mounts
|
||||
new file mode 100644
|
||||
index 000000000..ca036196b
|
||||
--- /dev/null
|
||||
+++ b/tests/vircgroupdata/kubevirt.mounts
|
||||
@@ -0,0 +1,25 @@
|
||||
+rootfs / rootfs rw 0 0
|
||||
+proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
|
||||
+udev /dev devtmpfs rw,nosuid,relatime,size=10240k,nr_inodes=1006404,mode=755 0 0
|
||||
+devpts /dev/pts devpts rw,relatime,gid=5,mode=620,ptmxmode=000 0 0
|
||||
+sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
|
||||
+/dev/sda1 / ext4 rw,noatime,data=ordered 0 0
|
||||
+tmpfs /run tmpfs rw,nodev,relatime,size=812296k,mode=755 0 0
|
||||
+mqueue /dev/mqueue mqueue rw,nosuid,nodev,noexec,relatime 0 0
|
||||
+shm /dev/shm tmpfs rw,nosuid,nodev,noexec,relatime 0 0
|
||||
+debugfs /sys/kernel/debug debugfs rw,nosuid,nodev,noexec,relatime 0 0
|
||||
+cgroup_root /sys/fs/cgroup tmpfs rw,nosuid,nodev,noexec,relatime,size=10240k,mode=755 0 0
|
||||
+openrc /sys/fs/cgroup/openrc cgroup rw,nosuid,nodev,noexec,relatime,release_agent=/lib64/rc/sh/cgroup-release-agent.sh,name=openrc 0 0
|
||||
+cpuset /some/random/location/cpuset cgroup rw,nosuid,nodev,noexec,relatime,cpuset 0 0
|
||||
+cpuset /sys/fs/cgroup/cpuset cgroup rw,nosuid,nodev,noexec,relatime,cpuset 0 0
|
||||
+cpu /sys/fs/cgroup/cpu cgroup rw,nosuid,nodev,noexec,relatime,cpu 0 0
|
||||
+cpuacct /some/random/location/cpuset cgroup rw,nosuid,nodev,noexec,relatime,cpuacct 0 0
|
||||
+cpuacct /sys/fs/cgroup/cpuacct cgroup rw,nosuid,nodev,noexec,relatime,cpuacct 0 0
|
||||
+memory /sys/fs/cgroup/memory cgroup rw,nosuid,nodev,noexec,relatime,memory 0 0
|
||||
+devices /sys/fs/cgroup/devices cgroup rw,nosuid,nodev,noexec,relatime,devices 0 0
|
||||
+freezer /sys/fs/cgroup/freezer cgroup rw,nosuid,nodev,noexec,relatime,freezer 0 0
|
||||
+blkio /sys/fs/cgroup/blkio cgroup rw,nosuid,nodev,noexec,relatime,blkio 0 0
|
||||
+perf_event /sys/fs/cgroup/perf_event cgroup rw,nosuid,nodev,noexec,relatime,perf_event 0 0
|
||||
+hugetlb /sys/fs/cgroup/hugetlb cgroup rw,nosuid,nodev,noexec,relatime,hugetlb 0 0
|
||||
+binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,nosuid,nodev,noexec,relatime 0 0
|
||||
+freezer /some/random/location/freezer cgroup rw,nosuid,nodev,noexec,relatime,freezer 0 0
|
||||
diff --git a/tests/vircgroupdata/kubevirt.parsed b/tests/vircgroupdata/kubevirt.parsed
|
||||
new file mode 100644
|
||||
index 000000000..694870723
|
||||
--- /dev/null
|
||||
+++ b/tests/vircgroupdata/kubevirt.parsed
|
||||
@@ -0,0 +1,10 @@
|
||||
+cpu /sys/fs/cgroup/cpu
|
||||
+cpuacct /sys/fs/cgroup/cpuacct
|
||||
+cpuset /sys/fs/cgroup/cpuset
|
||||
+memory /sys/fs/cgroup/memory
|
||||
+devices /sys/fs/cgroup/devices
|
||||
+freezer /some/random/location/freezer
|
||||
+blkio /sys/fs/cgroup/blkio
|
||||
+net_cls <null>
|
||||
+perf_event /sys/fs/cgroup/perf_event
|
||||
+name=systemd <null>
|
||||
diff --git a/tests/vircgrouptest.c b/tests/vircgrouptest.c
|
||||
index f55ef74a1..cf0315f16 100644
|
||||
--- a/tests/vircgrouptest.c
|
||||
+++ b/tests/vircgrouptest.c
|
||||
@@ -885,6 +885,7 @@ mymain(void)
|
||||
DETECT_MOUNTS("cgroups3");
|
||||
DETECT_MOUNTS("all-in-one");
|
||||
DETECT_MOUNTS("no-cgroups");
|
||||
+ DETECT_MOUNTS("kubevirt");
|
||||
|
||||
if (virTestRun("New cgroup for self", testCgroupNewForSelf, NULL) < 0)
|
||||
ret = -1;
|
@ -0,0 +1,53 @@
|
||||
From: Jim Fehlig <jfehlig@suse.com>
|
||||
Date: Tue, 18 Jul 2017 10:20:35 -0600
|
||||
Subject: [PATCH] docs: schema: make disk driver name attribute optional
|
||||
|
||||
/domain/devices/disk/driver/@name is not a required or mandatory
|
||||
attribute according to formatdomain, and indeed it was agreed on
|
||||
IRC that the attribute is "optional for input, recommended (but
|
||||
not required) for output". Currently the schema requires the
|
||||
attribute, causing virt-xml-validate to fail on disk config where
|
||||
the driver name is not explicitly specified. E.g.
|
||||
|
||||
# cat test.xml | grep -A 5 cdrom
|
||||
<disk type='file' device='cdrom'>
|
||||
<driver type='raw'/>
|
||||
<target dev='hdb' bus='ide'/>
|
||||
<readonly/>
|
||||
<address type='drive' controller='0' bus='0' target='0' unit='1'/>
|
||||
</disk>
|
||||
|
||||
# virt-xml-validate test.xml
|
||||
Relax-NG validity error : Extra element devices in interleave
|
||||
test.xml:21: element devices: Relax-NG validity error : Element domain failed to validate content
|
||||
test.xml fails to validate
|
||||
|
||||
Relaxing the name attribute to be optional fixes the validation
|
||||
|
||||
# virt-xml-validate test.xml
|
||||
test.xml validates
|
||||
|
||||
(cherry picked from commit b494e09d058f09b48d0fd8855edd557101294671)
|
||||
---
|
||||
docs/schemas/domaincommon.rng | 8 +++++---
|
||||
1 file changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
|
||||
index 9a7d03ed9..38dda780e 100644
|
||||
--- a/docs/schemas/domaincommon.rng
|
||||
+++ b/docs/schemas/domaincommon.rng
|
||||
@@ -1670,9 +1670,11 @@
|
||||
</element>
|
||||
</define>
|
||||
<define name="driverFormat">
|
||||
- <attribute name="name">
|
||||
- <ref name="genericName"/>
|
||||
- </attribute>
|
||||
+ <optional>
|
||||
+ <attribute name="name">
|
||||
+ <ref name="genericName"/>
|
||||
+ </attribute>
|
||||
+ </optional>
|
||||
<optional>
|
||||
<attribute name='type'>
|
||||
<choice>
|
90
libvirt.spec
90
libvirt.spec
@ -70,6 +70,13 @@
|
||||
%define with_storage_gluster 0%{!?_without_storage_gluster:1}
|
||||
%define with_numactl 0%{!?_without_numactl:1}
|
||||
|
||||
# F25+ has zfs-fuse
|
||||
%if 0%{?fedora} >= 25
|
||||
%define with_storage_zfs 0%{!?_without_storage_zfs:1}
|
||||
%else
|
||||
%define with_storage_zfs 0
|
||||
%endif
|
||||
|
||||
# A few optional bits off by default, we enable later
|
||||
%define with_fuse 0%{!?_without_fuse:0}
|
||||
%define with_cgconfig 0%{!?_without_cgconfig:0}
|
||||
@ -113,6 +120,12 @@
|
||||
%endif
|
||||
%endif
|
||||
|
||||
# zfs-fuse is not available on some architectures
|
||||
%ifarch s390 s390x aarch64
|
||||
%define with_storage_zfs 0
|
||||
%endif
|
||||
|
||||
|
||||
# RHEL doesn't ship OpenVZ, VBox, UML, PowerHypervisor,
|
||||
# VMware, libxenserver (xenapi), libxenlight (Xen 4.1 and newer),
|
||||
# or HyperV.
|
||||
@ -219,18 +232,28 @@
|
||||
|
||||
Summary: Library providing a simple virtualization API
|
||||
Name: libvirt
|
||||
Version: 2.2.0
|
||||
Release: 1%{?dist}%{?extra_release}
|
||||
Version: 2.2.1
|
||||
Release: 3%{?dist}%{?extra_release}
|
||||
License: LGPLv2+
|
||||
Group: Development/Libraries
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
|
||||
URL: http://libvirt.org/
|
||||
|
||||
%if %(echo %{version} | grep -o \\. | wc -l) == 3
|
||||
%if %(echo %{version} | grep -q "\.0$"; echo $?) == 1
|
||||
%define mainturl stable_updates/
|
||||
%endif
|
||||
Source: http://libvirt.org/sources/%{?mainturl}libvirt-%{version}.tar.xz
|
||||
|
||||
# Fix padding of encrypted data (bz #1452622)
|
||||
Patch0001: 0001-Fix-padding-of-encrypted-data.patch
|
||||
# Enable ZFS storage driver (bz #1471912)
|
||||
Patch0002: 0002-spec-Add-support-for-building-the-zfs-storage-driver.patch
|
||||
# Don't use cgroup mount points from /proc/mounts that are hidden (bz
|
||||
# #1470593)
|
||||
Patch0003: 0003-Avoid-hidden-cgroup-mount-points.patch
|
||||
# disk driver name=... should be optional (bz #1473091)
|
||||
Patch0004: 0004-docs-schema-make-disk-driver-name-attribute-optional.patch
|
||||
|
||||
Requires: libvirt-daemon = %{version}-%{release}
|
||||
Requires: libvirt-daemon-config-network = %{version}-%{release}
|
||||
Requires: libvirt-daemon-config-nwfilter = %{version}-%{release}
|
||||
@ -364,6 +387,12 @@ BuildRequires: glusterfs-devel >= 3.4.1
|
||||
%if %{with_storage_sheepdog}
|
||||
BuildRequires: sheepdog
|
||||
%endif
|
||||
%if %{with_storage_zfs}
|
||||
# Support any conforming implementation of zfs. On stock Fedora
|
||||
# this is zfs-fuse, but could be zfsonlinux upstream RPMs
|
||||
BuildRequires: /sbin/zfs
|
||||
BuildRequires: /sbin/zpool
|
||||
%endif
|
||||
%if %{with_numactl}
|
||||
# For QEMU/LXC numa info
|
||||
BuildRequires: numactl-devel
|
||||
@ -597,6 +626,11 @@ Requires: device-mapper
|
||||
# For Sheepdog support
|
||||
Requires: sheepdog
|
||||
%endif
|
||||
%if %{with_storage_zfs}
|
||||
# Support any conforming implementation of zfs
|
||||
Requires: /sbin/zfs
|
||||
Requires: /sbin/zpool
|
||||
%endif
|
||||
%if %{with_qemu}
|
||||
# From QEMU RPMs
|
||||
Requires: /usr/bin/qemu-img
|
||||
@ -1063,6 +1097,12 @@ rm -rf .git
|
||||
%define arg_storage_gluster --without-storage-gluster
|
||||
%endif
|
||||
|
||||
%if %{with_storage_zfs}
|
||||
%define arg_storage_zfs --with-storage-zfs
|
||||
%else
|
||||
%define arg_storage_zfs --without-storage-zfs
|
||||
%endif
|
||||
|
||||
%if %{with_numactl}
|
||||
%define arg_numactl --with-numactl
|
||||
%else
|
||||
@ -1170,6 +1210,7 @@ rm -f po/stamp-po
|
||||
%{?arg_storage_rbd} \
|
||||
%{?arg_storage_sheepdog} \
|
||||
%{?arg_storage_gluster} \
|
||||
%{?arg_storage_zfs} \
|
||||
%{?arg_numactl} \
|
||||
%{?arg_numad} \
|
||||
--with-capng \
|
||||
@ -1238,6 +1279,13 @@ 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
|
||||
|
||||
# nwfilter files are installed in /usr/share/libvirt and copied to /etc in %post
|
||||
# to avoid verification errors on changed files in /etc
|
||||
install -d -m 0755 $RPM_BUILD_ROOT%{_datadir}/libvirt/nwfilter/
|
||||
cp -a $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/nwfilter/*.xml \
|
||||
$RPM_BUILD_ROOT%{_datadir}/libvirt/nwfilter/
|
||||
|
||||
# Strip auto-generated UUID - we need it generated per-install
|
||||
sed -i -e "/<uuid>/d" $RPM_BUILD_ROOT%{_datadir}/libvirt/networks/default.xml
|
||||
%if ! %{with_qemu}
|
||||
@ -1465,6 +1513,17 @@ if test $1 -eq 1 && test ! -f %{_sysconfdir}/libvirt/qemu/networks/default.xml ;
|
||||
|
||||
fi
|
||||
|
||||
|
||||
%post daemon-config-nwfilter
|
||||
cp %{_datadir}/libvirt/nwfilter/*.xml %{_sysconfdir}/libvirt/nwfilter/
|
||||
# Make sure libvirt picks up the new nwfilter defininitons
|
||||
%if %{with_systemd}
|
||||
/bin/systemctl try-restart libvirtd.service >/dev/null 2>&1 ||:
|
||||
%else
|
||||
/sbin/service libvirtd condrestart > /dev/null 2>&1 || :
|
||||
%endif
|
||||
|
||||
|
||||
%if %{with_systemd}
|
||||
%triggerun -- libvirt < 0.9.4
|
||||
%{_bindir}/systemd-sysv-convert --save libvirtd >/dev/null 2>&1 ||:
|
||||
@ -1645,7 +1704,9 @@ exit 0
|
||||
%{_datadir}/libvirt/networks/default.xml
|
||||
|
||||
%files daemon-config-nwfilter
|
||||
%{_sysconfdir}/libvirt/nwfilter/*.xml
|
||||
%dir %{_datadir}/libvirt/nwfilter/
|
||||
%{_datadir}/libvirt/nwfilter/*.xml
|
||||
%ghost %{_sysconfdir}/libvirt/nwfilter/*.xml
|
||||
|
||||
%files daemon-driver-interface
|
||||
%{_libdir}/%{name}/connection-driver/libvirt_driver_interface.so
|
||||
@ -1891,6 +1952,27 @@ exit 0
|
||||
|
||||
|
||||
%changelog
|
||||
* Fri Aug 04 2017 Cole Robinson <crobinso@redhat.com> - 2.2.1-3
|
||||
- Enable ZFS storage driver (bz #1471912)
|
||||
- Don't use cgroup mount points from /proc/mounts that are hidden (bz
|
||||
#1470593)
|
||||
- disk driver name=... should be optional (bz #1473091)
|
||||
|
||||
* Tue May 30 2017 Cole Robinson <crobinso@redhat.com> - 2.2.1-2
|
||||
- Fix padding of encrypted data (bz #1452622)
|
||||
|
||||
* Wed May 10 2017 Cole Robinson <crobinso@redhat.com> - 2.2.1-1
|
||||
- Rebased to version 2.2.1
|
||||
- Fix spice port allocation collisions (bz #1390413)
|
||||
- Fix rpm validation of nwfilter config files (bz #1431581)
|
||||
- Tie virtlogd lifecycle to libvirtd.service (bz #1435855)
|
||||
- Fix double free when undefining storage pool (bz #1436400)
|
||||
- Fix crash in qemuDomainSecretDiskPrepare (bz #1438070)
|
||||
|
||||
* Mon Nov 14 2016 Cole Robinson <crobinso@redhat.com> - 2.2.0-2
|
||||
- Fix libvirtd endless loop when starting network with multiple IPs (bz
|
||||
#1393975)
|
||||
|
||||
* Mon Sep 5 2016 Daniel P. Berrange <berrange@redhat.com> - 2.2.0-1
|
||||
- Rebase to version 2.2.0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user