]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: Add interop testing between fscrypt fuse and kclient
authorChristopher Hoffman <choffman@redhat.com>
Thu, 19 Jun 2025 13:01:46 +0000 (13:01 +0000)
committerChristopher Hoffman <choffman@redhat.com>
Wed, 5 Nov 2025 13:59:36 +0000 (13:59 +0000)
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
qa/suites/fs/mixed-clients/tasks/fscrypt-kbuild.yaml [new file with mode: 0644]
qa/workunits/fs/fscrypt_cli_setup.sh
qa/workunits/fs/fscrypt_kclient_fuse.sh [new file with mode: 0755]

diff --git a/qa/suites/fs/mixed-clients/tasks/fscrypt-kbuild.yaml b/qa/suites/fs/mixed-clients/tasks/fscrypt-kbuild.yaml
new file mode 100644 (file)
index 0000000..045ada0
--- /dev/null
@@ -0,0 +1,24 @@
+tasks:
+- parallel:
+   - user-workload
+   - kclient-workload
+user-workload:
+  sequential:
+  - ceph-fuse: [client.0]
+  - workunit:
+      subdir: fscrypt-fuse
+      clients:
+        client.0:
+          - fs/fscrypt_cli_setup.sh
+          - fs/fscrypt_kclient_fuse.sh fuse
+      timeout: 4h
+kclient-workload:
+  sequential:
+  - kclient: [client.1]
+  - workunit:
+      subdir: fscrypt-kclient
+      clients:
+        client.1:
+          - fs/fscrypt_cli_setup.sh
+          - fs/fscrypt_kclient_fuse.sh kclient
+      timeout: 4h
index a6f366b4b553bf6fe4556866eed5a3e0a2181e1e..5541c676ee5f751e0de9a27995ca324f51d79b78 100755 (executable)
@@ -59,7 +59,10 @@ elif command -v yum &>/dev/null; then
 fi
 
 # Clone the custom fscrypt repository, build, and install
-git clone https://git.ceph.com/fscrypt.git -b wip-ceph-fuse "$WORK_DIR/fscrypt"
+if [ ! -d "$WORK_DIR/fscrypt" ]
+then
+       git clone https://git.ceph.com/fscrypt.git -b wip-ceph-fuse "$WORK_DIR/fscrypt"
+fi
 cd "$WORK_DIR/fscrypt"
 make
 sudo make install PREFIX=/usr/local
diff --git a/qa/workunits/fs/fscrypt_kclient_fuse.sh b/qa/workunits/fs/fscrypt_kclient_fuse.sh
new file mode 100755 (executable)
index 0000000..e5ab107
--- /dev/null
@@ -0,0 +1,96 @@
+#!/usr/bin/env bash
+set -xe
+
+client_type=$1
+TOP=`pwd`
+TOP=$(dirname "$(pwd)")
+KDIR=${TOP}/kclient
+FDIR=${TOP}/fuse
+
+setup_fscrypt_env() {
+       DIR=$1
+       if [ ! -f /etc/fscrypt.conf ]
+       then
+               sudo fscrypt setup --force --verbose
+       fi
+
+       if [ ! -d $TOP/.fscrypt ]
+       then
+               sudo fscrypt setup ${DIR} --force --verbose --all-users
+               sudo fscrypt status --verbose
+       fi
+}
+
+encrypt_dir() {
+       DIR=$1
+       KEY=${DIR}/../key
+       mkdir -p ${DIR}
+
+       if [ ! -f ${KEY} ]
+       then
+               sudo dd if=/dev/urandom of=${KEY} bs=32 count=1
+       fi
+       sudo fscrypt encrypt --verbose --source=raw_key --name=protector-${client_type} --no-recovery --skip-unlock --key=${KEY} ${DIR}
+       #sudo fscrypt encrypt --verbose --source=raw_key --name=randprotector1 --no-recovery --skip-unlock --key=${KEY} ${DIR}
+}
+
+unlock_dir() {
+       DIR=$1
+       KEY=${DIR}/../key
+
+       sudo fscrypt unlock --verbose --key=${KEY} ${DIR}
+}
+
+generate_tree() {
+       DIR=$1
+       cd $DIR
+       wget -O linux.tar.xz http://download.ceph.com/qa/linux-6.5.11.tar.xz
+       mkdir linux
+       cd linux
+       tar xJf ../linux.tar.xz
+}
+
+build_kernel() {
+       DIR=$1
+       cd ${DIR}
+       cd linux*
+       make defconfig
+       make -j`grep -c processor /proc/cpuinfo`
+}
+
+setup_fscrypt_env ${TOP}
+K_LINUX_ROOT=${KDIR}/linux
+F_LINUX_ROOT=${FDIR}/linux
+case ${client_type} in
+       "kclient")
+               mkdir -p ${KDIR}
+                encrypt_dir ${KDIR}
+               unlock_dir ${KDIR}
+               generate_tree ${KDIR}
+               K_LINUX_ROOT=${KDIR}/linux
+               touch ${TOP}/k_ready
+               while [ ! -f ${TOP}/f_ready ]
+               do
+                       sleep 1s
+               done
+               unlock_dir ${FDIR}
+               build_kernel ${F_LINUX_ROOT}
+               ;;
+       "fuse")
+               mkdir -p ${FDIR}
+                encrypt_dir ${FDIR}
+               unlock_dir ${FDIR}
+               generate_tree ${FDIR}
+               F_LINUX_ROOT=${FDIR}/linux
+               touch ${TOP}/f_ready
+               while [ ! -f ${TOP}/k_ready ]
+               do
+                       sleep 1s
+               done
+               unlock_dir ${KDIR}
+               build_kernel ${K_LINUX_ROOT}
+               ;;
+       *)
+               echo not found
+               exit 1
+esac