[lxc-devel] [lxc-ci/master] OVN Projects

tomponline on Github lxc-bot at linuxcontainers.org
Tue Sep 15 10:18:34 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 502 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200915/dc24a110/attachment.bin>
-------------- next part --------------
From ad7a7c0e0c0a12b8ea139244e74542ba93ae0193 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Tue, 15 Sep 2020 11:16:28 +0100
Subject: [PATCH 1/2] bin/test-lxd-ovn: Fix typo in comments

Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
 bin/test-lxd-ovn | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bin/test-lxd-ovn b/bin/test-lxd-ovn
index 0385c6b..36b225b 100755
--- a/bin/test-lxd-ovn
+++ b/bin/test-lxd-ovn
@@ -64,12 +64,12 @@ lxc init images:ubuntu/20.04 u1
 lxc config device add u1 eth0 nic network=lxdbr0 name=eth0
 lxc start u1
 
-echo "==> Launching a first test container on lxdbr0"
+echo "==> Launching a first test container on ovn-virtual-network"
 lxc init images:ubuntu/20.04 u2
 lxc config device add u2 eth0 nic network=ovn-virtual-network name=eth0
 lxc start u2
 
-echo "==> Launching a second test container on lxdbr0"
+echo "==> Launching a second test container on ovn-virtual-network"
 lxc init images:ubuntu/20.04 u3
 lxc config device add u3 eth0 nic network=ovn-virtual-network name=eth0
 lxc start u3

From cd590dabe8643a00cd557cdc218ce11c6fe3a197 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Tue, 15 Sep 2020 11:16:44 +0100
Subject: [PATCH 2/2] bin/test-lxd-ovn: Adds OVN project tests

 - Tests creating OVN network of same name and subnet in default and test project.
 - Tests in-use deletion protection of OVN networks and referenced parent networks.
 - Tests OVN network deletion.

Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
 bin/test-lxd-ovn | 75 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 75 insertions(+)

diff --git a/bin/test-lxd-ovn b/bin/test-lxd-ovn
index 36b225b..612a50e 100755
--- a/bin/test-lxd-ovn
+++ b/bin/test-lxd-ovn
@@ -110,4 +110,79 @@ echo "==> DNS resolution on OVN"
 lxc exec u3 -- ping -c1 -4 u2.lxd
 lxc exec u3 -- ping -c1 -6 u2.lxd
 
+echo "===> Testing projects"
+lxc project create testovn -c features.networks=true -c limits.networks=1
+lxc project switch testovn
+lxc profile device add default root disk path=/ pool=default
+
+# Create network inside project with same name and subnet as network in default project.
+lxc network create ovn-virtual-network network=lxdbr0 --type=ovn ipv4.address="$(lxc network get ovn-virtual-network ipv4.address --project default)" ipv6.address="$(lxc network get ovn-virtual-network ipv6.address --project default)"
+
+# Test we cannot exceed specified project limits for networks.
+! lxc network create ovn-virtual-network-toomany network=lxdbr0 --type=ovn
+
+echo "==> Launching a first test container on testovn project ovn-virtual-network"
+lxc init images:ubuntu/20.04 u2
+lxc config device add u2 eth0 nic network=ovn-virtual-network name=eth0
+lxc start u2
+
+echo "==> Launching a second test container on testovn project ovn-virtual-network"
+lxc init images:ubuntu/20.04 u3
+lxc config device add u3 eth0 nic network=ovn-virtual-network name=eth0
+lxc start u3
+
+echo "==> Wait for addresses"
+sleep 10
+lxc list
+
+echo "==> Testing connectivity"
+
+U2_IPV4="$(lxc list u2 -c4 --format=csv | cut -d' ' -f1)"
+U2_IPV6="$(lxc list u2 -c6 --format=csv | cut -d' ' -f1)"
+U3_IPV4="$(lxc list u3 -c4 --format=csv | cut -d' ' -f1)"
+U3_IPV6="$(lxc list u3 -c6 --format=csv | cut -d' ' -f1)"
+
+echo "==> lxdbr0 to OVN gateway in project testovn"
+lxc exec u1 --project default -- ping -c1 -4 10.10.10.201
+lxc exec u1 --project default -- ping -c1 -6 fd42:4242:4242:1010::201
+
+echo "==> OVN to internet in project testovn"
+lxc exec u2 -- ping -c1 -4 linuxcontainers.org
+lxc exec u2 -- ping -c1 -6 linuxcontainers.org
+
+echo "==> OVN to OVN in project testovn"
+lxc exec u2 -- ping -c1 -4 "${U3_IPV4}"
+lxc exec u2 -- ping -c1 -6 "${U3_IPV6}"
+
+echo "==> OVN to lxdbr0 in project testovn"
+lxc exec u3 -- ping -c1 -4 "${U1_IPV4}"
+lxc exec u3 -- ping -c1 -6 "${U1_IPV6}"
+
+echo "==> DNS resolution on OVN in project testovn"
+lxc exec u3 -- ping -c1 -4 u2.lxd
+lxc exec u3 -- ping -c1 -6 u2.lxd
+
+echo "===> Check network in use protection from deletion"
+# Delete instances in default project first.
+lxc delete -f u1 u2 u3 --project default
+
+# Check we cannot delete lxdbr0 (as it is parent of OVN networks).
+! lxc network delete lxdbr0 --project default
+
+# Delete OVN network in default project.
+lxc network delete ovn-virtual-network --project default
+
+# Check we cannot delete lxdbr0 (as it is still parent of OVN network in project).
+! lxc network delete lxdbr0 --project default
+
+# Check we cannot delete OVN network in project due to instances using it.
+! lxc network delete ovn-virtual-network
+
+# Remove instances using OVN network in project.
+lxc delete -f u2 u3
+
+# Delete OVN network in project and parent in default project.
+lxc network delete ovn-virtual-network
+lxc network delete lxdbr0 --project default
+
 FAIL=0


More information about the lxc-devel mailing list