test/sma: vhost_blk create cntrl with crypto bdev

Signed-off-by: Sebastian Brzezinka <sebastian.brzezinka@intel.com>
Change-Id: I72c1340d927101d171509b1a42c4f14c0f7dc3e9
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13998
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Sebastian Brzezinka 2022-08-11 17:22:05 +02:00 committed by Ben Walker
parent 7cefe7f62d
commit 9f0d4f33c3

View File

@ -72,6 +72,10 @@ $rootdir/scripts/sma.py -c <(
count: 32
qmp_addr: 127.0.0.1
qmp_port: 9090
crypto:
name: 'bdev_crypto'
params:
driver: 'crypto_aesni_mb'
EOF
) &
smapid=$!
@ -154,5 +158,42 @@ done
# And back to none
[[ $(vm_exec $vm_no "lsblk | grep -E \"^vd.\" | wc -l") -eq 0 ]]
key0=1234567890abcdef1234567890abcdef
rpc_cmd bdev_malloc_create -b malloc0 32 4096
uuidc=$(rpc_cmd bdev_get_bdevs -b malloc0 | jq -r '.[].uuid')
#Try to create controller with bdev crypto
devid0=$(
"$rootdir/scripts/sma-client.py" <<- CREATE | jq -r '.handle'
{
"method": "CreateDevice",
"params": {
"virtio_blk": {
"physical_id": "0",
"virtual_id": "0"
},
"volume": {
"volume_id": "$(uuid2base64 $uuidc)",
"crypto": {
"cipher": "$(get_cipher AES_CBC)",
"key": "$(format_key $key0)"
}
}
}
}
CREATE
)
[[ $(rpc_cmd vhost_get_controllers | jq -r '. | length') -eq 1 ]]
bdev=$(rpc_cmd vhost_get_controllers | jq -r '.[].backend_specific.block.bdev')
crypto_bdev=$(rpc_cmd bdev_get_bdevs | jq -r '.[] | select(.product_name == "crypto")')
[[ $(jq -r '.driver_specific.crypto.key' <<< "$crypto_bdev") == "$key0" ]]
[[ $(jq -r '.driver_specific.crypto.name' <<< "$crypto_bdev") == "$bdev" ]]
# Delete crypto device and check if it's gone
delete_device $devid0
[[ $(rpc_cmd bdev_get_bdevs | jq -r '.[] | select(.product_name == "crypto")' | jq -r length) -eq 0 ]]
cleanup
trap - SIGINT SIGTERM EXIT