[lxc-devel] [lxc-ci/master] bin/test-lxd-cluster: Adds cluster fan networking tests

tomponline on Github lxc-bot at linuxcontainers.org
Fri Oct 30 17:53:39 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 363 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20201030/1cf2f8bd/attachment.bin>
-------------- next part --------------
From c202714c45dc8752775474c47b6001c6b53c2d90 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Fri, 30 Oct 2020 17:52:18 +0000
Subject: [PATCH] bin/test-lxd-cluster: Adds cluster fan networking tests

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

diff --git a/bin/test-lxd-cluster b/bin/test-lxd-cluster
index f1cc6a4..297a6d3 100755
--- a/bin/test-lxd-cluster
+++ b/bin/test-lxd-cluster
@@ -61,6 +61,11 @@ for i in $(seq "$1"); do
         lxc exec "${PREFIX}-$i" -- lxc config set cluster.https_address "${CLUSTER_IP}:8443"
         lxc exec "${PREFIX}-$i" -- lxc config set core.trust_password "cluster"
         lxc exec "${PREFIX}-$i" -- lxc cluster enable "${PREFIX}-$i"
+        lxc exec "${PREFIX}-$i" -- lxc network create lxdfan0 bridge.mode=fan
+        lxc exec "${PREFIX}-$i" -- lxc storage create default dir
+        lxc exec "${PREFIX}-$i" -- lxc profile device add default root disk path=/ pool=default
+        lxc exec "${PREFIX}-$i" -- lxc profile device add default eth0 nic name=eth0 network=lxdfan0
+        lxc exec "${PREFIX}-$i" -- lxc network show lxdfan0
         CLUSTER_CRT=$(lxc file pull "${PREFIX}-$i"/var/snap/lxd/common/lxd/cluster.crt - | sed ':a;N;$!ba;s/\n/\n\n/g')
     else
         MEMBER_IP=$(lxc exec "${PREFIX}-$i" -- ip -4 addr show dev eth0 scope global | grep inet | cut -d' ' -f6 | cut -d/ -f1)
@@ -85,6 +90,20 @@ echo "==> Validating the cluster"
 lxc exec "${PREFIX}-1" -- lxc info
 lxc exec "${PREFIX}-1" -- lxc cluster list
 
+# Test fan networking (intra fan from container and host, as well as external NAT comms)
+echo "==> Test fan networking"
+lxc exec "${PREFIX}-1" -- lxc launch images:ubuntu/focal u1
+lxc exec "${PREFIX}-1" -- lxc launch images:ubuntu/focal u2
+
+echo "==> Wait for addresses"
+sleep 10
+lxc exec "${PREFIX}-1" -- lxc list
+
+U2_IPV4="$(lxc exec ${PREFIX}-1 -- lxc list u2 -c4 --format=csv | cut -d' ' -f1)"
+lxc exec "${PREFIX}-1" -- lxc exec u1 -- ping -c1 -4 linuxcontainers.org
+lxc exec "${PREFIX}-1" -- lxc exec u1 -- ping -c1 "${U2_IPV4}"
+lxc exec "${PREFIX}-1" -- ping -c1 "${U2_IPV4}"
+
 # Upgrade the cluster
 echo "==> Upgrading the cluster"
 for i in $(seq "$1"); do


More information about the lxc-devel mailing list