[lxc-devel] [lxd/master] Ignore io.EOF errors when performing PUT /internal/shutdown
freeekanayaka on Github
lxc-bot at linuxcontainers.org
Tue Mar 6 13:06:45 UTC 2018
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 361 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180306/f762103c/attachment.bin>
-------------- next part --------------
From 3e143742198fecb447fbc10a8bd0372ac14a0da2 Mon Sep 17 00:00:00 2001
From: Free Ekanayaka <free.ekanayaka at canonical.com>
Date: Tue, 6 Mar 2018 13:05:58 +0000
Subject: [PATCH] Ignore io.EOF errors when performing PUT /internal/shutdown
Signed-off-by: Free Ekanayaka <free.ekanayaka at canonical.com>
---
lxd/main_shutdown.go | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/lxd/main_shutdown.go b/lxd/main_shutdown.go
index 675ad647cf..db1f05bb69 100644
--- a/lxd/main_shutdown.go
+++ b/lxd/main_shutdown.go
@@ -2,6 +2,7 @@ package main
import (
"fmt"
+ "io"
"time"
"github.com/lxc/lxd/client"
@@ -12,6 +13,13 @@ func cmdShutdown(args *Args) error {
SkipGetServer: true,
}
c, err := lxd.ConnectLXDUnix("", connArgs)
+ if err == io.EOF {
+ // If we got an EOF error here it means that the daemon has
+ // shutdown so quickly that it already closed the unix
+ // socket. We consider this good enough to consider the process
+ // dead.
+ return nil
+ }
if err != nil {
return err
}
More information about the lxc-devel
mailing list