]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: krbd rxbounce test
authorIlya Dryomov <idryomov@gmail.com>
Thu, 27 Jan 2022 16:15:01 +0000 (17:15 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Fri, 4 Feb 2022 18:04:37 +0000 (19:04 +0100)
Lives in its own directory since ms_mode doesn't need to be permuted
here.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
qa/suites/krbd/rxbounce/% [new file with mode: 0644]
qa/suites/krbd/rxbounce/.qa [new symlink]
qa/suites/krbd/rxbounce/bluestore-bitmap.yaml [new symlink]
qa/suites/krbd/rxbounce/ceph/.qa [new symlink]
qa/suites/krbd/rxbounce/ceph/ceph.yaml [new file with mode: 0644]
qa/suites/krbd/rxbounce/clusters/.qa [new symlink]
qa/suites/krbd/rxbounce/clusters/fixed-3.yaml [new symlink]
qa/suites/krbd/rxbounce/conf.yaml [new file with mode: 0644]
qa/suites/krbd/rxbounce/tasks/.qa [new symlink]
qa/suites/krbd/rxbounce/tasks/krbd_rxbounce.yaml [new file with mode: 0644]
qa/workunits/rbd/krbd_rxbounce.sh [new file with mode: 0755]

diff --git a/qa/suites/krbd/rxbounce/% b/qa/suites/krbd/rxbounce/%
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/qa/suites/krbd/rxbounce/.qa b/qa/suites/krbd/rxbounce/.qa
new file mode 120000 (symlink)
index 0000000..a602a03
--- /dev/null
@@ -0,0 +1 @@
+../.qa/
\ No newline at end of file
diff --git a/qa/suites/krbd/rxbounce/bluestore-bitmap.yaml b/qa/suites/krbd/rxbounce/bluestore-bitmap.yaml
new file mode 120000 (symlink)
index 0000000..a59cf51
--- /dev/null
@@ -0,0 +1 @@
+.qa/objectstore/bluestore-bitmap.yaml
\ No newline at end of file
diff --git a/qa/suites/krbd/rxbounce/ceph/.qa b/qa/suites/krbd/rxbounce/ceph/.qa
new file mode 120000 (symlink)
index 0000000..a602a03
--- /dev/null
@@ -0,0 +1 @@
+../.qa/
\ No newline at end of file
diff --git a/qa/suites/krbd/rxbounce/ceph/ceph.yaml b/qa/suites/krbd/rxbounce/ceph/ceph.yaml
new file mode 100644 (file)
index 0000000..2030acb
--- /dev/null
@@ -0,0 +1,3 @@
+tasks:
+- install:
+- ceph:
diff --git a/qa/suites/krbd/rxbounce/clusters/.qa b/qa/suites/krbd/rxbounce/clusters/.qa
new file mode 120000 (symlink)
index 0000000..a602a03
--- /dev/null
@@ -0,0 +1 @@
+../.qa/
\ No newline at end of file
diff --git a/qa/suites/krbd/rxbounce/clusters/fixed-3.yaml b/qa/suites/krbd/rxbounce/clusters/fixed-3.yaml
new file mode 120000 (symlink)
index 0000000..f75a848
--- /dev/null
@@ -0,0 +1 @@
+.qa/clusters/fixed-3.yaml
\ No newline at end of file
diff --git a/qa/suites/krbd/rxbounce/conf.yaml b/qa/suites/krbd/rxbounce/conf.yaml
new file mode 100644 (file)
index 0000000..30da870
--- /dev/null
@@ -0,0 +1,5 @@
+overrides:
+  ceph:
+    conf:
+      global:
+        ms die on skipped message: false
diff --git a/qa/suites/krbd/rxbounce/tasks/.qa b/qa/suites/krbd/rxbounce/tasks/.qa
new file mode 120000 (symlink)
index 0000000..a602a03
--- /dev/null
@@ -0,0 +1 @@
+../.qa/
\ No newline at end of file
diff --git a/qa/suites/krbd/rxbounce/tasks/krbd_rxbounce.yaml b/qa/suites/krbd/rxbounce/tasks/krbd_rxbounce.yaml
new file mode 100644 (file)
index 0000000..4ecd0e8
--- /dev/null
@@ -0,0 +1,5 @@
+tasks:
+- workunit:
+    clients:
+      all:
+        - rbd/krbd_rxbounce.sh
diff --git a/qa/workunits/rbd/krbd_rxbounce.sh b/qa/workunits/rbd/krbd_rxbounce.sh
new file mode 100755 (executable)
index 0000000..ad00e3f
--- /dev/null
@@ -0,0 +1,103 @@
+#!/usr/bin/env bash
+
+set -ex
+
+rbd create --size 256 img
+
+IMAGE_SIZE=$(rbd info --format=json img | python3 -c 'import sys, json; print(json.load(sys.stdin)["size"])')
+OBJECT_SIZE=$(rbd info --format=json img | python3 -c 'import sys, json; print(json.load(sys.stdin)["object_size"])')
+NUM_OBJECTS=$((IMAGE_SIZE / OBJECT_SIZE))
+[[ $((IMAGE_SIZE % OBJECT_SIZE)) -eq 0 ]]
+OP_SIZE=16384
+
+DEV=$(sudo rbd map img)
+{
+    for ((i = 0; i < $NUM_OBJECTS; i++)); do
+        echo pwrite -b $OP_SIZE -S $i $((i * OBJECT_SIZE)) $OP_SIZE
+    done
+    echo fsync
+    echo quit
+} | xfs_io $DEV
+sudo rbd unmap $DEV
+
+g++ -xc++ -o racereads - -lpthread <<EOF
+#include <assert.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include <thread>
+#include <vector>
+
+const int object_size = $OBJECT_SIZE;
+const int num_objects = $NUM_OBJECTS;
+const int read_len = $OP_SIZE;
+const int num_reads = 1024;
+
+int main() {
+  int fd = open("$DEV", O_DIRECT | O_RDONLY);
+  assert(fd >= 0);
+
+  void *buf;
+  int r = posix_memalign(&buf, 512, read_len);
+  assert(r == 0);
+
+  std::vector<std::thread> threads;
+  for (int i = 0; i < num_objects; i++) {
+    threads.emplace_back(
+        [fd, buf, read_off = static_cast<off_t>(i) * object_size]() {
+          for (int i = 0; i < num_reads; i++) {
+            auto len = pread(fd, buf, read_len, read_off);
+            assert(len == read_len);
+          }
+        });
+  }
+
+  for (auto &t : threads) {
+    t.join();
+  }
+}
+EOF
+
+DEV=$(sudo rbd map -o ms_mode=legacy img)
+sudo dmesg -C
+./racereads
+[[ $(dmesg | grep -c 'libceph: osd.* bad crc/signature') -gt 100 ]]
+sudo rbd unmap $DEV
+
+DEV=$(sudo rbd map -o ms_mode=legacy,rxbounce img)
+sudo dmesg -C
+./racereads
+[[ $(dmesg | grep -c 'libceph: osd.* bad crc/signature') -eq 0 ]]
+sudo rbd unmap $DEV
+
+DEV=$(sudo rbd map -o ms_mode=crc img)
+sudo dmesg -C
+./racereads
+[[ $(dmesg | grep -c 'libceph: osd.* integrity error') -gt 100 ]]
+sudo rbd unmap $DEV
+
+DEV=$(sudo rbd map -o ms_mode=crc,rxbounce img)
+sudo dmesg -C
+./racereads
+[[ $(dmesg | grep -c 'libceph: osd.* integrity error') -eq 0 ]]
+sudo rbd unmap $DEV
+
+# rxbounce is a no-op for secure mode
+DEV=$(sudo rbd map -o ms_mode=secure img)
+sudo dmesg -C
+./racereads
+[[ $(dmesg | grep -c 'libceph: osd.* integrity error') -eq 0 ]]
+sudo rbd unmap $DEV
+
+DEV=$(sudo rbd map -o ms_mode=secure,rxbounce img)
+sudo dmesg -C
+./racereads
+[[ $(dmesg | grep -c 'libceph: osd.* integrity error') -eq 0 ]]
+sudo rbd unmap $DEV
+
+rbd rm img
+
+echo OK