[lxc-devel] [lxd/master] Bugfixes

stgraber on Github lxc-bot at linuxcontainers.org
Tue Jun 27 19:02:34 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170627/2e4072a4/attachment.bin>
-------------- next part --------------
From 93a2e101ef282c849030f6ca411f651b0cd00766 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Tue, 27 Jun 2017 13:59:46 -0400
Subject: [PATCH 1/2] tests: Don't attempt to finger public remotes
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 test/suites/remote.sh | 1 -
 1 file changed, 1 deletion(-)

diff --git a/test/suites/remote.sh b/test/suites/remote.sh
index fd9a92446..d53ee123e 100644
--- a/test/suites/remote.sh
+++ b/test/suites/remote.sh
@@ -17,7 +17,6 @@ test_remote_url() {
 
   for url in ${urls}; do
     lxc_remote remote add test "${url}"
-    lxc_remote finger test:
     lxc_remote remote remove test
   done
 }

From c469b049b269a49dccfe0b15c60b85dd64baf1bb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Tue, 27 Jun 2017 15:01:14 -0400
Subject: [PATCH 2/2] client: Fix non-interactive exec hangs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

When in a non-interactive exec case with an active stdin, we shouldn't
wait for stdin to be done before closing the rest of the connections as
stdin needs to be closed separately.

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 client/lxd_containers.go | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/client/lxd_containers.go b/client/lxd_containers.go
index af16cf51d..c3786914b 100644
--- a/client/lxd_containers.go
+++ b/client/lxd_containers.go
@@ -396,10 +396,14 @@ func (r *ProtocolLXD) ExecContainer(containerName string, exec api.ContainerExec
 						close(args.DataDone)
 					}
 				}()
+			} else {
+				if args.DataDone != nil {
+					close(args.DataDone)
+				}
 			}
 		} else {
 			// Handle non-interactive sessions
-			dones := []chan bool{}
+			dones := map[int]chan bool{}
 			conns := []*websocket.Conn{}
 
 			// Handle stdin
@@ -410,7 +414,7 @@ func (r *ProtocolLXD) ExecContainer(containerName string, exec api.ContainerExec
 				}
 
 				conns = append(conns, conn)
-				dones = append(dones, shared.WebsocketSendStream(conn, args.Stdin, -1))
+				dones[0] = shared.WebsocketSendStream(conn, args.Stdin, -1)
 			}
 
 			// Handle stdout
@@ -421,7 +425,7 @@ func (r *ProtocolLXD) ExecContainer(containerName string, exec api.ContainerExec
 				}
 
 				conns = append(conns, conn)
-				dones = append(dones, shared.WebsocketRecvStream(args.Stdout, conn))
+				dones[1] = shared.WebsocketRecvStream(args.Stdout, conn)
 			}
 
 			// Handle stderr
@@ -432,12 +436,17 @@ func (r *ProtocolLXD) ExecContainer(containerName string, exec api.ContainerExec
 				}
 
 				conns = append(conns, conn)
-				dones = append(dones, shared.WebsocketRecvStream(args.Stderr, conn))
+				dones[2] = shared.WebsocketRecvStream(args.Stderr, conn)
 			}
 
 			// Wait for everything to be done
 			go func() {
-				for _, chDone := range dones {
+				for i, chDone := range dones {
+					// Skip stdin, dealing with it separately below
+					if i == 0 {
+						continue
+					}
+
 					<-chDone
 				}
 


More information about the lxc-devel mailing list