Skip to content

Commit

Permalink
[dvs] Fix issue where concurrent netns operations cause test setup to…
Browse files Browse the repository at this point in the history
… fail (sonic-net#1535)

Signed-off-by: Danny Allen <daall@microsoft.com>
  • Loading branch information
daall committed Dec 10, 2020
1 parent 599ed41 commit 1c8b953
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,11 @@ def __init__(self, ctn_name: str, pid: int, i: int):
ensure_system(f"ip netns add {self.nsname}")

# create vpeer link
ensure_system(f"ip link add {self.nsname[0:12]} type veth peer name {self.pifname}")
ensure_system(f"ip link set {self.nsname[0:12]} netns {self.nsname}")
ensure_system(f"ip link set {self.pifname} netns {pid}")
ensure_system(
f"ip netns exec {self.nsname} ip link add {self.nsname[0:12]}"
f" type veth peer name {self.pifname}"
)
ensure_system(f"ip netns exec {self.nsname} ip link set {self.pifname} netns {pid}")

# bring up link in the virtual server
ensure_system(f"ip netns exec {self.nsname} ip link set dev {self.nsname[0:12]} name eth0")
Expand Down

0 comments on commit 1c8b953

Please sign in to comment.