[libvirt] [PATCH] lxc: Fix reboot via initctl

Lubomir Rintel lkundrak at v3.sk
Thu Jul 4 09:04:15 UTC 2019


virInitctlSetRunLevel() returns 0 only if ended up doing nothing, 1 if it
actually succeeded. Let's check for the error condition.

Without this, a successful reboot would be treated as a failure and the
LXC driver will proceed sending a TERM signal instead, effectively
cancelling the shutdown.

Signed-off-by: Lubomir Rintel <lkundrak at v3.sk>
---
 src/lxc/lxc_domain.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/lxc/lxc_domain.c b/src/lxc/lxc_domain.c
index 51a9fd36eb..1dc2d0d4cf 100644
--- a/src/lxc/lxc_domain.c
+++ b/src/lxc/lxc_domain.c
@@ -457,7 +457,9 @@ lxcDomainInitctlCallback(pid_t pid ATTRIBUTE_UNUSED,
             data->st[i].st_ino == cont_sb.st_ino)
             continue;
 
-        return virInitctlSetRunLevel(fifo, data->runlevel);
+        if (virInitctlSetRunLevel(fifo, data->runlevel) == -1)
+            return -1;
+        return 0;
     }
 
     /* If no usable fifo was found then declare success. Caller
-- 
2.21.0




More information about the libvir-list mailing list