From 2aebefa26f1aaf0dcaadc2b8052c9d4c46a3bfe3 Mon Sep 17 00:00:00 2001 From: Peter Sabaini Date: Wed, 28 Aug 2024 10:34:49 +0200 Subject: [PATCH] Add interfaces: rbd kernel module and support Signed-off-by: Peter Sabaini --- .github/workflows/tests.yml | 4 +++- snap/snapcraft.yaml | 12 ++++++++++++ tests/scripts/actionutils.sh | 38 ++++++++++++++++++++++++++++++++---- 3 files changed, 49 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d43dc6ec..7682bd61 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -122,7 +122,9 @@ jobs: if [[ $rc -eq 0 ]] ; then echo "Batch disk addition should fail with db device: $rc"; exit 1; fi - name: Add OSDs - run: ~/actionutils.sh add_encrypted_osds + run: | + ~/actionutils.sh add_encrypted_osds + ~/actionutils.sh add_lvm_vol - name: Enable RGW run: ~/actionutils.sh enable_rgw diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 6952fe55..dbf6371e 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -10,6 +10,13 @@ description: |- confinement: strict +plugs: + load-rbd: + interface: kernel-module-load + modules: + - name: rbd + load: on-boot + slots: ceph-conf: interface: content @@ -47,6 +54,7 @@ apps: - mount-observe - network - network-bind + - microceph-support slots: - microceph mds: @@ -84,6 +92,7 @@ apps: - hardware-observe - network - network-bind + - microceph-support rgw: command: commands/rgw.start @@ -115,6 +124,9 @@ apps: command: commands/rbd plugs: - network + - network-bind + - microceph-support + - dm-crypt rados: command: commands/rados plugs: diff --git a/tests/scripts/actionutils.sh b/tests/scripts/actionutils.sh index 9ab37f9e..8786c28c 100755 --- a/tests/scripts/actionutils.sh +++ b/tests/scripts/actionutils.sh @@ -22,6 +22,9 @@ function install_microceph() { sudo snap connect microceph:hardware-observe sudo snap connect microceph:mount-observe # defer dm-crypt enablement for later. + sudo snap connect microceph:load-rbd + sudo snap connect microceph:microceph-support + sudo snap connect microceph:network-bind sudo microceph cluster bootstrap sudo microceph.ceph version @@ -45,20 +48,47 @@ function create_loop_devices() { done } +function create_lvm_vol() { + local lv_name="${1?missing}" + [[ -e /dev/vgtst/$lv_name ]] && exit + loop_file="$(sudo mktemp -p /mnt XXXX.img)" + sudo truncate -s 4G "${loop_file}" + loop_dev="$(sudo losetup --show -f "${loop_file}")" + minor="${loop_dev##/dev/loop}" + + # Set up a lvm vol on loop file + sudo pvcreate $loop_dev + sudo vgcreate vgtst $loop_dev + sudo lvcreate -l100%FREE --name $lv_name vgtst +} + function add_encrypted_osds() { # Enable dm-crypt connection and restart microceph daemon sudo snap connect microceph:dm-crypt sudo snap restart microceph.daemon create_loop_devices - sudo microceph disk add /dev/sdia /dev/sdib /dev/sdic --wipe --encrypt + sudo microceph disk add /dev/sdia /dev/sdib --wipe --encrypt # Wait for OSDs to become up sleep 30 # verify disks using json output. - res=$(sudo microceph disk list --json | jq -r '.ConfiguredDisks[].path' | grep -e "/dev/sdia" -e "/dev/sdib" -e "/dev/sdic" -c) - if ($res -ne "3") ; then - echo "${res} is not equal to expected disk count (3)" + res=$(sudo microceph disk list --json | jq -r '.ConfiguredDisks[].path' | grep -e "/dev/sdia" -e "/dev/sdib" -c) + if [ $res -ne 2 ] ; then + echo "${res} is not equal to expected disk count (2)" + exit 1 + fi +} + +function add_lvm_vol() { + set -x + create_lvm_vol lvtest + sudo microceph disk add /dev/vgtst/lvtest --wipe + sleep 20 + sudo microceph.ceph -s + res=$(sudo microceph disk list --json | jq -r '.ConfiguredDisks[].path' | grep "/dev/vgtst/lvtest" -c) + if [ $res -ne 1 ] ; then + echo "Didnt find lvm vol" exit 1 fi }