Skip to content

Commit dac2899

Browse files
committed
test: Add clustered NFS tests
Signed-off-by: Benjamin Somers <benjamin.somers@imt-atlantique.fr>
1 parent e280acd commit dac2899

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

test/includes/clustering.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,12 @@ EOF
197197
config:
198198
source: incustest-$(basename "${TEST_DIR}" | sed 's/\./__/g')
199199
linstor.resource_group.place_count: 1
200+
EOF
201+
fi
202+
if [ "${driver}" = "nfs" ]; then
203+
cat >> "${INCUS_DIR}/preseed.yaml" << EOF
204+
config:
205+
source: $INCUS_NFS_SHARE/$(basename "${TEST_DIR}")
200206
EOF
201207
fi
202208
cat >> "${INCUS_DIR}/preseed.yaml" << EOF
@@ -276,10 +282,10 @@ cluster:
276282
cluster_token: ${token}
277283
member_config:
278284
EOF
279-
# Declare the pool only if the driver is not ceph or linstor, because
285+
# Declare the pool only if the driver doesn't manage remote storage, because
280286
# the pool doesn't need to be created on the joining
281287
# node (it's shared with the bootstrap one).
282-
if [ "${driver}" != "ceph" ] && [ "${driver}" != "linstor" ]; then
288+
if [ "${driver}" != "ceph" ] && [ "${driver}" != "linstor" ] && [ "${driver}" != "nfs" ]; then
283289
cat >> "${INCUS_DIR}/preseed.yaml" << EOF
284290
- entity: storage-pool
285291
name: data

test/suites/clustering.sh

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,8 @@ test_clustering_storage() {
684684
driver_config="source=incustest-$(basename "${TEST_DIR}")-pool1"
685685
elif [ "${poolDriver}" = "linstor" ]; then
686686
driver_config="source=incustest-$(basename "${TEST_DIR}" | sed 's/\./__/g')-pool1"
687+
elif [ "${poolDriver}" = "nfs" ]; then
688+
driver_config="source=$INCUS_NFS_SHARE/$(basename "${TEST_DIR}")"
687689
fi
688690

689691
# Define storage pools on the two nodes
@@ -749,11 +751,14 @@ test_clustering_storage() {
749751
# For ceph volume the source field is the name of the underlying ceph pool
750752
source1="incustest-$(basename "${TEST_DIR}")"
751753
source2="${source1}"
752-
fi
753-
if [ "${poolDriver}" = "linstor" ]; then
754+
elif [ "${poolDriver}" = "linstor" ]; then
754755
# For linstor the source field is the name of the underlying linstor resource group
755756
source1="incustest-$(basename "${TEST_DIR}" | sed 's/\./__/g')"
756757
source2="${source1}"
758+
elif [ "${poolDriver}" = "nfs" ]; then
759+
# For nfs the source field is the name of the underlying nfs share
760+
source1="$INCUS_NFS_SHARE/$(basename "${TEST_DIR}")"
761+
source2="${source1}"
757762
fi
758763
INCUS_DIR="${INCUS_ONE_DIR}" incus storage show pool1 --target node1 | grep source | grep -q "${source1}"
759764
INCUS_DIR="${INCUS_ONE_DIR}" incus storage show pool1 --target node2 | grep source | grep -q "${source2}"
@@ -766,8 +771,8 @@ test_clustering_storage() {
766771
! INCUS_DIR="${INCUS_ONE_DIR}" incus storage show pool1 | grep -q rsync.bwlimit || false
767772
fi
768773

769-
if [ "${poolDriver}" = "ceph" ] || [ "${poolDriver}" = "linstor" ]; then
770-
# Test migration of ceph- and linstor-based containers
774+
if [ "${poolDriver}" = "ceph" ] || [ "${poolDriver}" = "linstor" ] || [ "${poolDriver}" = "nfs" ]; then
775+
# Test migration of ceph-, linstor-, and nfs-based containers
771776
INCUS_DIR="${INCUS_TWO_DIR}" ensure_import_testimage
772777
INCUS_DIR="${INCUS_ONE_DIR}" incus launch --target node2 -s pool1 testimage foo
773778

@@ -796,7 +801,7 @@ test_clustering_storage() {
796801

797802
# If the driver has the same per-node storage pool config (e.g. size), make sure it's included in the
798803
# member_config, and actually added to a joining node so we can validate it.
799-
if [ "${poolDriver}" = "zfs" ] || [ "${poolDriver}" = "btrfs" ] || [ "${poolDriver}" = "ceph" ] || [ "${poolDriver}" = "lvm" ] || [ "${poolDriver}" = "linstor" ]; then
804+
if [ "${poolDriver}" = "zfs" ] || [ "${poolDriver}" = "btrfs" ] || [ "${poolDriver}" = "ceph" ] || [ "${poolDriver}" = "lvm" ] || [ "${poolDriver}" = "linstor" ] || [ "${poolDriver}" = "nfs" ]; then
800805
# Spawn a third node
801806
setup_clustering_netns 3
802807
INCUS_THREE_DIR=$(mktemp -d -p "${TEST_DIR}" XXX)
@@ -830,12 +835,12 @@ test_clustering_storage() {
830835
done
831836

832837
# Other storage backends will be finished with the third node, so we can remove it.
833-
if [ "${poolDriver}" != "ceph" ] && [ "${poolDriver}" != "linstor" ]; then
838+
if [ "${poolDriver}" != "ceph" ] && [ "${poolDriver}" != "linstor" ] && [ "${poolDriver}" != "nfs" ]; then
834839
INCUS_DIR="${INCUS_ONE_DIR}" incus cluster remove node3 --yes
835840
fi
836841
fi
837842

838-
if [ "${poolDriver}" = "ceph" ] || [ "${poolDriver}" = "linstor" ]; then
843+
if [ "${poolDriver}" = "ceph" ] || [ "${poolDriver}" = "linstor" ] || [ "${poolDriver}" = "nfs" ]; then
839844
# Move the container to node3, renaming it
840845
INCUS_DIR="${INCUS_TWO_DIR}" incus move foo bar --target node3
841846
INCUS_DIR="${INCUS_TWO_DIR}" incus info bar | grep -q "Location: node3"
@@ -925,7 +930,7 @@ test_clustering_storage() {
925930
INCUS_DIR="${INCUS_ONE_DIR}" incus storage delete pool1
926931
! INCUS_DIR="${INCUS_ONE_DIR}" incus storage list | grep -q pool1 || false
927932

928-
if [ "${poolDriver}" != "ceph" ] && [ "${poolDriver}" != "linstor" ]; then
933+
if [ "${poolDriver}" != "ceph" ] && [ "${poolDriver}" != "linstor" ] && [ "${poolDriver}" != "nfs" ]; then
929934
# Create a volume on node1
930935
INCUS_DIR="${INCUS_ONE_DIR}" incus storage volume create data web
931936
INCUS_DIR="${INCUS_ONE_DIR}" incus storage volume list data | grep web | grep -q node1

0 commit comments

Comments
 (0)