Skip to content

Commit

Permalink
Add interfaces: rbd kernel module and support
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Sabaini <[email protected]>
  • Loading branch information
sabaini committed Aug 29, 2024
1 parent 2d07d2f commit 2aebefa
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -47,6 +54,7 @@ apps:
- mount-observe
- network
- network-bind
- microceph-support
slots:
- microceph
mds:
Expand Down Expand Up @@ -84,6 +92,7 @@ apps:
- hardware-observe
- network
- network-bind
- microceph-support

rgw:
command: commands/rgw.start
Expand Down Expand Up @@ -115,6 +124,9 @@ apps:
command: commands/rbd
plugs:
- network
- network-bind
- microceph-support
- dm-crypt
rados:
command: commands/rados
plugs:
Expand Down
38 changes: 34 additions & 4 deletions tests/scripts/actionutils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
Expand Down

0 comments on commit 2aebefa

Please sign in to comment.