]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
qa/workunits/rbd: reduce randomized sleeps in live import tests
authorIlya Dryomov <idryomov@gmail.com>
Thu, 29 Jan 2026 20:41:03 +0000 (21:41 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Sun, 1 Feb 2026 22:05:51 +0000 (23:05 +0100)
These tests were tuned for slower hardware than what we have now.
Currently "rbd migration execute" always finishes (successfully) before
the NBD server is killed.

Fixes: https://tracker.ceph.com/issues/74669
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
(cherry picked from commit 592e3a9846b130c7321481f8b2bf9dba2fb05195)

Conflicts:
qa/workunits/rbd/cli_migration.sh [ commit afc89fdde80f
  ("qa/workunits/rbd: add test_import_nbd_stream_disconnected()")
  was originally skipped due to NBD stream not being in squid at
  the time ]

qa/suites/rbd/cli/workloads/rbd_cli_migration.yaml
qa/workunits/rbd/cli_migration.sh

index b04ac08f7b4e7099ed69b2def41031212fdd8702..96845dce4367dc0eec133f9f52a98e7e370b860e 100644 (file)
@@ -1,3 +1,11 @@
+overrides:
+  install:
+    extra_system_packages:
+      rpm:
+      - qemu-kvm-block-rbd
+      deb:
+      - qemu-block-extra
+      - qemu-utils
 tasks:
 - workunit:
     clients:
index b543bd383b639455560a129aca33ad9c6f8f90b2..dd6e6b70e26773b288994ffe826488350074bd7b 100755 (executable)
@@ -571,6 +571,68 @@ EOF
     kill_nbd_server
 }
 
+test_import_nbd_stream_disconnected() {
+    local dest_image=$1
+    local migration_execute_pid
+
+    dd if=/dev/urandom of=${TEMPDIR}/large.raw bs=1M count=20480
+    qemu-nbd -f raw --read-only --shared 10 --persistent --fork \
+        ${TEMPDIR}/large.raw
+
+    cat > ${TEMPDIR}/spec.json <<EOF
+{
+  "type": "raw",
+  "stream": {
+    "type": "nbd",
+    "uri": "nbd://localhost"
+  }
+}
+EOF
+    cat ${TEMPDIR}/spec.json
+
+    # server disappears while importing - abort
+    rbd migration prepare --import-only \
+        --source-spec-path ${TEMPDIR}/spec.json ${dest_image}
+    rbd status ${dest_image} | grep 'state: prepared'
+    qemu-img compare ${TEMPDIR}/large.raw rbd:rbd/${dest_image}
+    rbd migration execute ${dest_image} &
+    migration_execute_pid=$!
+    sleep $((5 + RANDOM % 5))
+    kill_nbd_server
+    expect_false wait $migration_execute_pid
+    expect_false rbd status ${dest_image}
+    rbd migration abort ${dest_image}
+
+    qemu-nbd -f raw --read-only --shared 10 --persistent --fork \
+        ${TEMPDIR}/large.raw
+
+    # server disappears while importing - resume
+    rbd migration prepare --import-only \
+        --source-spec-path ${TEMPDIR}/spec.json ${dest_image}
+    rbd status ${dest_image} | grep 'state: prepared'
+    qemu-img compare ${TEMPDIR}/large.raw rbd:rbd/${dest_image}
+    rbd migration execute ${dest_image} &
+    migration_execute_pid=$!
+    sleep $((5 + RANDOM % 5))
+    kill_nbd_server
+    expect_false wait $migration_execute_pid
+    expect_false rbd status ${dest_image}
+    qemu-nbd -f raw --read-only --shared 10 --persistent --fork \
+        ${TEMPDIR}/large.raw
+    rbd status ${dest_image} | grep 'state: executing'
+    qemu-img compare ${TEMPDIR}/large.raw rbd:rbd/${dest_image}
+    rbd migration execute ${dest_image}
+    rbd status ${dest_image} | grep 'state: executed'
+    qemu-img compare ${TEMPDIR}/large.raw rbd:rbd/${dest_image}
+    rbd migration commit ${dest_image}
+    rbd status ${dest_image} | expect_false grep 'Migration:'
+    qemu-img compare ${TEMPDIR}/large.raw rbd:rbd/${dest_image}
+
+    remove_image "${dest_image}"
+
+    kill_nbd_server
+}
+
 # make sure rbd pool is EMPTY.. this is a test script!!
 rbd ls 2>&1 | wc -l | grep -v '^0$' && echo "nonempty rbd pool, aborting!  run this script on an empty test cluster only." && exit 1
 
@@ -589,4 +651,6 @@ test_import_nbd_stream_qcow2 ${IMAGE2} ${IMAGE3}
 test_import_raw_format ${IMAGE1} ${IMAGE2}
 test_import_nbd_stream_raw ${IMAGE1} ${IMAGE2}
 
+test_import_nbd_stream_disconnected ${IMAGE2}
+
 echo OK