]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/workunits/rbd: add encryption-aware resize test 48618/head
authorIlya Dryomov <idryomov@gmail.com>
Sat, 3 Dec 2022 14:37:14 +0000 (15:37 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Sun, 4 Dec 2022 17:24:10 +0000 (18:24 +0100)
Note that we are hitting https://tracker.ceph.com/issues/58160 here
because by the time we get to "rbd resize" RAW_DEV mapping owns the
lock (due to a write to /dev/mapper/cryptsetupdev being last).

While at it, resurrect the ability to easily run this script on
vstart clusters -- see commit f737c2855a19 ("qa/workunits/rbd: make
luks-encryption test work on vstart cluster").

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
qa/workunits/rbd/luks-encryption.sh

index b85bb0e546a3398647cc4c2e9d618a3a0f47b99f..5d3cc68cdf34b9bc69153bc4ec2f2bd06e7fe844 100755 (executable)
@@ -56,7 +56,18 @@ function test_encryption_format() {
   dd if=$LIBRBD_DEV of=/tmp/cmpdata iflag=direct bs=4M count=4
   cmp -n 16MB /tmp/cmpdata /tmp/testdata2
 
-  sudo rbd device unmap -t nbd $LIBRBD_DEV
+  # FIXME: encryption-aware flatten/resize misbehave if proxied to
+  # RAW_DEV mapping (i.e. if RAW_DEV mapping ows the lock)
+  # (acquire and) release the lock as a side effect
+  rbd bench --io-type read --io-size 1 --io-threads 1 --io-total 1 testimg
+
+  # check that encryption-aware resize compensates LUKS header overhead
+  (( $(sudo blockdev --getsize64 $LIBRBD_DEV) < (32 << 20) ))
+  expect_false rbd resize --size 32M testimg
+  rbd resize --size 32M --encryption-passphrase-file /tmp/passphrase testimg
+  (( $(sudo blockdev --getsize64 $LIBRBD_DEV) == (32 << 20) ))
+
+  _sudo rbd device unmap -t nbd $LIBRBD_DEV
 }
 
 function test_clone_encryption() {
@@ -77,7 +88,7 @@ function test_clone_encryption() {
   dd if=$LIBRBD_DEV of=/tmp/cmpdata iflag=direct bs=1M count=1
   cmp -n 1MB /tmp/cmpdata /tmp/testdata1
   dd if=/tmp/testdata1 of=$LIBRBD_DEV seek=1 skip=1 oflag=direct bs=1M count=1
-  sudo rbd device unmap -t nbd $LIBRBD_DEV
+  _sudo rbd device unmap -t nbd $LIBRBD_DEV
 
   # second clone (luks2)
   rbd snap create testimg1@snap
@@ -91,7 +102,7 @@ function test_clone_encryption() {
   dd if=$LIBRBD_DEV of=/tmp/cmpdata iflag=direct bs=1M count=2
   cmp -n 2MB /tmp/cmpdata /tmp/testdata1
   dd if=/tmp/testdata1 of=$LIBRBD_DEV seek=2 skip=2 oflag=direct bs=1M count=1
-  sudo rbd device unmap -t nbd $LIBRBD_DEV
+  _sudo rbd device unmap -t nbd $LIBRBD_DEV
 
   # flatten
   expect_false rbd flatten testimg2 --encryption-format luks1 --encryption-format luks2 --encryption-passphrase-file /tmp/passphrase2 --encryption-passphrase-file /tmp/passphrase
@@ -103,7 +114,7 @@ function test_clone_encryption() {
   sudo chmod 666 /dev/mapper/cryptsetupdev
   dd if=/dev/mapper/cryptsetupdev of=/tmp/cmpdata iflag=direct bs=1M count=3
   cmp -n 3MB /tmp/cmpdata /tmp/testdata1
-  sudo rbd device unmap -t nbd $RAW_FLAT_DEV
+  _sudo rbd device unmap -t nbd $RAW_FLAT_DEV
 }
 
 function test_clone_and_load_with_a_single_passphrase {