libvirt-5.7.0-3.fc32

Fix VM startup when legacy cgroups are defined (bz #1612383)
This commit is contained in:
Cole Robinson 2019-09-26 15:47:05 -04:00
parent 749dc3d3cb
commit 511e2c5124
4 changed files with 135 additions and 6 deletions

View File

@ -1,4 +1,3 @@
From 522b3d2b24d0f7ac78dad442c990d4e34db0eaf2 Mon Sep 17 00:00:00 2001
From: Michael Chapman <mike@very.puzzling.org>
Date: Tue, 17 Sep 2019 17:03:57 +1000
Subject: [PATCH] remote: fix registration of TLS socket
@ -13,7 +12,7 @@ Signed-off-by: Michael Chapman <mike@very.puzzling.org>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c
index 966f3da2d0..7195ac9218 100644
index 546328b24d..8f85d09dd3 100644
--- a/src/remote/remote_daemon.c
+++ b/src/remote/remote_daemon.c
@@ -505,7 +505,7 @@ daemonSetupNetworking(virNetServerPtr srv,
@ -25,6 +24,3 @@ index 966f3da2d0..7195ac9218 100644
virNetTLSContextPtr ctxt = NULL;
if (config->ca_file ||
--
2.21.0

View File

@ -0,0 +1,55 @@
From: Cole Robinson <crobinso@redhat.com>
Date: Thu, 26 Sep 2019 15:00:55 -0400
Subject: [PATCH] vircgroupv2: Fix VM startup when legacy cgroups are defined
On Fedora 31, starting a 'mock' build alters /proc/$pid/cgroup,
probably due to usage of systemd-nspawn.
Before:
$ cat /proc/self/cgroup
0::/user.slice/user-1000.slice/...
After:
$ cat /proc/self/cgroup
1:name=systemd:/
0::/user.slice/user-1000.slice/...
The cgroupv2 code mishandles that first line in the second case, which
causes VM startup to fail with: Unable to read from
'/sys/fs/cgroup/machine/cgroup.controllers': No such file or directory
The kernel docs[1] say that the cgroupv2 path will always start with
'0::', which in the code here controllers="". Only set the v2 placement
path when we see that cgroup file entry.
[1] https://www.kernel.org/doc/html/v5.3/admin-guide/cgroup-v2.html#processes
https://bugzilla.redhat.com/show_bug.cgi?id=1751120
Signed-off-by: Cole Robinson <crobinso@redhat.com>
---
src/util/vircgroupv2.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
index 2aca4e5d62..ecf7d42076 100644
--- a/src/util/vircgroupv2.c
+++ b/src/util/vircgroupv2.c
@@ -194,12 +194,16 @@ virCgroupV2DetectMounts(virCgroupPtr group,
static int
virCgroupV2DetectPlacement(virCgroupPtr group,
const char *path,
- const char *controllers ATTRIBUTE_UNUSED,
+ const char *controllers,
const char *selfpath)
{
if (group->unified.placement)
return 0;
+ /* controllers="" indicates the cgroupv2 controller path */
+ if (STRNEQ_NULLABLE(controllers, ""))
+ return 0;
+
/*
* selfpath == "/" + path="" -> "/"
* selfpath == "/libvirt.service" + path == "" -> "/libvirt.service"

View File

@ -0,0 +1,72 @@
From: Cole Robinson <crobinso@redhat.com>
Date: Thu, 26 Sep 2019 15:25:52 -0400
Subject: [PATCH] vircgroup: Add some VIR_DEBUG statements
These helped with debugging
https://bugzilla.redhat.com/show_bug.cgi?id=1612383
Signed-off-by: Cole Robinson <crobinso@redhat.com>
---
src/util/vircgroup.c | 3 ++-
src/util/vircgroupv2.c | 9 +++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index 825f62a97b..4f9d80666d 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -1157,7 +1157,8 @@ virCgroupNewMachineSystemd(const char *name,
virCgroupFree(&init);
if (!path || STREQ(path, "/") || path[0] != '/') {
- VIR_DEBUG("Systemd didn't setup its controller");
+ VIR_DEBUG("Systemd didn't setup its controller, path=%s",
+ NULLSTR(path));
return -2;
}
diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
index ecf7d42076..ff079be718 100644
--- a/src/util/vircgroupv2.c
+++ b/src/util/vircgroupv2.c
@@ -155,10 +155,14 @@ virCgroupV2CopyPlacement(virCgroupPtr group,
const char *path,
virCgroupPtr parent)
{
+ VIR_DEBUG("group=%p path=%s parent=%p", group, path, parent);
+
if (path[0] == '/') {
if (VIR_STRDUP(group->unified.placement, path) < 0)
return -1;
} else {
+ VIR_DEBUG("parent->unified.placement=%s", parent->unified.placement);
+
/*
* parent == "/" + path="" => "/"
* parent == "/libvirt.service" + path == "" => "/libvirt.service"
@@ -172,6 +176,7 @@ virCgroupV2CopyPlacement(virCgroupPtr group,
return -1;
}
+ VIR_DEBUG("set group->unified.placement=%s", group->unified.placement);
return 0;
}
@@ -200,6 +205,9 @@ virCgroupV2DetectPlacement(virCgroupPtr group,
if (group->unified.placement)
return 0;
+ VIR_DEBUG("group=%p path=%s controllers=%s selfpath=%s",
+ group, path, controllers, selfpath);
+
/* controllers="" indicates the cgroupv2 controller path */
if (STRNEQ_NULLABLE(controllers, ""))
return 0;
@@ -216,6 +224,7 @@ virCgroupV2DetectPlacement(virCgroupPtr group,
path) < 0)
return -1;
+ VIR_DEBUG("set group->unified.placement=%s", group->unified.placement);
return 0;
}

View File

@ -216,7 +216,7 @@
Summary: Library providing a simple virtualization API
Name: libvirt
Version: 5.7.0
Release: 2%{?dist}
Release: 3%{?dist}
License: LGPLv2+
URL: https://libvirt.org/
@ -227,6 +227,9 @@ Source: https://libvirt.org/sources/%{?mainturl}libvirt-%{version}.tar.xz
# Fix systemd socket activation with TLS socket
Patch0001: 0001-remote-fix-registration-of-TLS-socket.patch
# Fix VM startup when legacy cgroups are defined (bz #1612383)
Patch0002: 0002-vircgroupv2-Fix-VM-startup-when-legacy-cgroups-are-d.patch
Patch0003: 0003-vircgroup-Add-some-VIR_DEBUG-statements.patch
Requires: libvirt-daemon = %{version}-%{release}
Requires: libvirt-daemon-config-network = %{version}-%{release}
@ -2003,6 +2006,9 @@ exit 0
%changelog
* Thu Sep 26 2019 Cole Robinson <crobinso@redhat.com> - 5.7.0-3
- Fix VM startup when legacy cgroups are defined (bz #1612383)
* Fri Sep 20 2019 Daniel P. Berrangé <berrange@redhat.com> - 5.7.0-2
- Fix systemd socket activation with TLS socket