[lxc-devel] [lxd/master] Delete the namespaced veth before killing the process

freeekanayaka on Github lxc-bot at linuxcontainers.org
Fri Mar 2 13:29:00 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 629 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180302/30be1d55/attachment.bin>
-------------- next part --------------
From 5f5dbb9c73c18280e68ff9232cb6e9b04ddd2cae Mon Sep 17 00:00:00 2001
From: Free Ekanayaka <free.ekanayaka at canonical.com>
Date: Fri, 2 Mar 2018 13:25:40 +0000
Subject: [PATCH] Delete the namespaced veth before killing the process

It seems that on single-CPU machines the 'ip link del "${veth1}"' call
fails pretty much always. I assume because one side of the veth pair
is attached to the net namespace of the process being killed and the
kernel wipes it immediately, or something like that.

Signed-off-by: Free Ekanayaka <free.ekanayaka at canonical.com>
---
 test/includes/clustering.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/includes/clustering.sh b/test/includes/clustering.sh
index dc57012644..1afeac8b59 100644
--- a/test/includes/clustering.sh
+++ b/test/includes/clustering.sh
@@ -102,12 +102,12 @@ teardown_clustering_netns() {
   for ns in $(ls -1 "${TEST_DIR}/ns/"); do
       echo "==> Teardown clustering netns ${ns}"
 
-      pid="$(cat "${TEST_DIR}/ns/${ns}/PID")"
-      kill -9 "${pid}"
-
       veth1="v${ns}1"
       ip link del "${veth1}"
 
+      pid="$(cat "${TEST_DIR}/ns/${ns}/PID")"
+      kill -9 "${pid}"
+
       umount -l "${TEST_DIR}/ns/${ns}/net" >/dev/null 2>&1 || true
       rm -Rf "${TEST_DIR}/ns/${ns}"
   done


More information about the lxc-devel mailing list