Spdk/python/spdk/sma/common.py
Konrad Sztyber c16dab7e37 sma: crypto support for nvmf/tcp devices
The nvmf/tcp devices will now support attaching volumes with encryption
enabled.  This basically boils down to getting the crypto bdev name
through the CryptoEngine.get_crypto_bdev() interface (instead of just
using volume_id) and specyfing UUID/NGUID when attaching namespaces
to a subsystem.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Iefddbf07675152aa2e042564eb87c457b6995b9b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13871
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: <sebastian.brzezinka@intel.com>
2022-09-19 19:43:35 +00:00

22 lines
500 B
Python

import uuid
def format_volume_id(volume_id):
"""Verifies volume_id and returns it as a str
Args:
volume_id: either a str (in which case it's only validated) or bytes object
"""
try:
if type(volume_id) is bytes:
return str(uuid.UUID(bytes=volume_id))
elif type(volume_id) is str:
return str(uuid.UUID(hex=volume_id))
except ValueError:
pass
return None
def volume_id_to_nguid(uuid):
return uuid.replace('-', '')