[CRIU] [PATCH 4/4] test: don't use nsenter in tests
Andrei Vagin
avagin at openvz.org
Fri May 5 22:56:51 PDT 2017
From: Andrei Vagin <avagin at virtuozzo.com>
Ubuntu 14.04 (Travis) doesn't have it.
Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
---
test/empty-netns-prep.sh | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/test/empty-netns-prep.sh b/test/empty-netns-prep.sh
index 212eb39..07e7e8f 100755
--- a/test/empty-netns-prep.sh
+++ b/test/empty-netns-prep.sh
@@ -1,8 +1,16 @@
-#!/bin/sh
+#!/bin/bash
+
+set -ex
if [ "$CRTOOLS_SCRIPT_ACTION" == "setup-namespaces" ]; then
echo "Will up lo at $CRTOOLS_INIT_PID netns"
- nsenter -t "$CRTOOLS_INIT_PID" --net ip link set up dev lo || exit 1
+ mkdir -p /var/run/netns
+ mount -t tmpfs xxx /var/run/netns
+ touch /var/run/netns/emptyns
+ mount --bind /proc/$CRTOOLS_INIT_PID/ns/net /var/run/netns/emptyns
+ ip netns exec emptyns ip link set up dev lo || exit 1
+ ip netns exec emptyns ip a
+ umount -l /var/run/netns
fi
exit 0
--
2.9.3
More information about the CRIU
mailing list