[CRIU] [PATCH] test: use .pid.inprogress file for macvlan test
Andrei Vagin
avagin at virtuozzo.com
Wed Oct 26 11:20:14 PDT 2016
On Wed, Oct 26, 2016 at 04:23:48PM +0000, Tycho Andersen wrote:
> Note, this depends on Pavel's patch here:
> https://lists.openvz.org/pipermail/criu/2016-October/032499.html which is
> not yet applied.
>
> Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
> ---
> test/zdtm/static/macvlan.hook | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/test/zdtm/static/macvlan.hook b/test/zdtm/static/macvlan.hook
> index 0dea7d1..d0a06b6 100755
> --- a/test/zdtm/static/macvlan.hook
> +++ b/test/zdtm/static/macvlan.hook
> @@ -6,7 +6,8 @@ if [ "$1" == "--post-start" ]; then
> set -e
>
> i=0
> - while [ -z "$(pidof -s macvlan)" ]; do
> + PIDF="zdtm/static/macvlan.pid.inprogress"
> + while [ ! -f "$PIDF" ]; do
> i=$(($i+1))
> if [ "$i" -eq "10" ]; then
> echo "failed to create macvlan test"
> @@ -15,12 +16,14 @@ if [ "$1" == "--post-start" ]; then
> sleep 1
> done
>
> + TPID=$(cat $PIDF)
It is racy, because open() + write() is not atomic.
> +
> ip link add zdtmbr0 type bridge
> ip addr add 10.0.55.55/32 dev zdtmbr0
> ip link set zdtmbr0 up
> ip link add zdtmmvlan0 link zdtmbr0 type macvlan mode bridge
> ip addr add 10.0.55.56/32 dev zdtmmvlan0
> - ip link set zdtmmvlan0 netns $(pidof -s macvlan)
> + ip link set zdtmmvlan0 netns $TPID
> else
> ip link del zdtmmvlan0 || true
>
> --
> 2.9.3
>
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
More information about the CRIU
mailing list