Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
libvirt
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Libvirt Packaging Team
libvirt
Commits
9ae5f141
Commit
9ae5f141
authored
3 years ago
by
Joachim Falk
Browse files
Options
Downloads
Patches
Plain Diff
Fix reboot command for LXC containers (Closes: #991773)
parent
81cf0444
No related branches found
No related tags found
1 merge request
!124
Fix reboot and shutdown command for LXC containers (Closes: #991773)
Pipeline
#330437
failed
3 years ago
Stage: provisioning
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
debian/patches/backport/Fix-reboot-command-for-LXC-containers.patch
+92
-0
92 additions, 0 deletions
...ches/backport/Fix-reboot-command-for-LXC-containers.patch
debian/patches/series
+1
-0
1 addition, 0 deletions
debian/patches/series
with
93 additions
and
0 deletions
debian/patches/backport/Fix-reboot-command-for-LXC-containers.patch
0 → 100644
+
92
−
0
View file @
9ae5f141
From: Joachim Falk <joachim.falk@gmx.de>
Date: Thu, 2 Dec 2021 19:56:07 +0100
Subject: Fix reboot command for LXC containers (Closes: #991773)
The virNetDaemonQuit(dmn) command in virLXCControllerSignalChildIO triggers an
early close of all clients of lxc_controller. Here, libvirtd itself is a client
of this controller, and the client connection is used to notify libvirtd if a
reboot of the container is required. However, the client connection was closed
before such a status could be sent to libvirtd. To fix this bug, we will
immediately send the reboot or shutdown status of the container to libvirtd, and
only after client disconnect will we trigger virNetDaemonQuit (Closes: #991773).
Fixes: https://gitlab.com/libvirt/libvirt/-/issues/237
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=991773
Signed-off-by: Joachim Falk <joachim.falk@gmx.de>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 93c47e2c39521aba760486f0238458ef1a37490c)
---
src/lxc/lxc_controller.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 444f728af4..039efcd7c7 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -894,8 +894,10 @@
static void virLXCControllerClientCloseHook(virNetServerClient *client)
virLXCController *ctrl = virNetServerClientGetPrivateData(client);
VIR_DEBUG("Client %p has closed", client);
- if (ctrl->client == client)
+ if (ctrl->client == client) {
ctrl->client = NULL;
+ VIR_DEBUG("Client has gone away");
+ }
if (ctrl->inShutdown) {
VIR_DEBUG("Arm timer to quit event loop");
virEventUpdateTimeout(ctrl->timerShutdown, 0);
@@ -1006,8 +1008,11 @@
static int lxcControllerClearCapabilities(void)
static bool wantReboot;
static virMutex lock = VIR_MUTEX_INITIALIZER;
+static int
+virLXCControllerEventSendExit(virLXCController *ctrl,
+ int exitstatus);
-static void virLXCControllerSignalChildIO(virNetDaemon *dmn,
+static void virLXCControllerSignalChildIO(virNetDaemon *dmn G_GNUC_UNUSED,
siginfo_t *info G_GNUC_UNUSED,
void *opaque)
{
@@ -1018,7 +1023,6 @@
static void virLXCControllerSignalChildIO(virNetDaemon *dmn,
ret = waitpid(-1, &status, WNOHANG);
VIR_DEBUG("Got sig child %d vs %lld", ret, (long long)ctrl->initpid);
if (ret == ctrl->initpid) {
- virNetDaemonQuit(dmn);
virMutexLock(&lock);
if (WIFSIGNALED(status) &&
WTERMSIG(status) == SIGHUP) {
@@ -1026,6 +1030,7 @@
static void virLXCControllerSignalChildIO(virNetDaemon *dmn,
wantReboot = true;
}
virMutexUnlock(&lock);
+ virLXCControllerEventSendExit(ctrl, wantReboot ? 1 : 0);
}
}
@@ -2276,9 +2281,10 @@
virLXCControllerEventSendExit(virLXCController *ctrl,
VIR_DEBUG("Waiting for client to complete dispatch");
ctrl->inShutdown = true;
virNetServerClientDelayedClose(ctrl->client);
- virNetDaemonRun(ctrl->daemon);
+ } else {
+ VIR_DEBUG("Arm timer to quit event loop");
+ virEventUpdateTimeout(ctrl->timerShutdown, 0);
}
- VIR_DEBUG("Client has gone away");
return 0;
}
@@ -2430,8 +2436,6 @@
virLXCControllerRun(virLXCController *ctrl)
rc = virLXCControllerMain(ctrl);
- virLXCControllerEventSendExit(ctrl, rc);
-
cleanup:
VIR_FORCE_CLOSE(control[0]);
VIR_FORCE_CLOSE(control[1]);
--
2.30.2
This diff is collapsed.
Click to expand it.
debian/patches/series
+
1
−
0
View file @
9ae5f141
backport/Fix-reboot-command-for-LXC-containers.patch
forward/Skip-vircgrouptest.patch
forward/Reduce-udevadm-settle-timeout-to-10-seconds.patch
forward/Pass-GPG_TTY-env-var-to-the-ssh-binary.patch
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment