From c802dbe9fec3ce14c96acab9d14a978bc1898ee4 Mon Sep 17 00:00:00 2001 From: Konrad Sztyber Date: Fri, 18 Feb 2022 08:35:20 +0100 Subject: [PATCH] sma: add device protocol name A device can now be identified by a protocol and a name. This allows to have multiple types of devices providing the same protocol. The selection of which device manager to use for specific protocol will be added in following patches. Signed-off-by: Konrad Sztyber Change-Id: Ib4a6c323ba6a2a5d36ff958ddc40631fd9329cb1 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11683 Community-CI: Broadcom CI Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- python/spdk/sma/device/device.py | 3 ++- python/spdk/sma/device/nvmf_tcp.py | 2 +- python/spdk/sma/sma.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/python/spdk/sma/device/device.py b/python/spdk/sma/device/device.py index bc18e74d7..47fb06d28 100644 --- a/python/spdk/sma/device/device.py +++ b/python/spdk/sma/device/device.py @@ -8,8 +8,9 @@ class DeviceException(Exception): class DeviceManager: - def __init__(self, name, client): + def __init__(self, name, protocol, client): self._client = client + self.protocol = protocol self.name = name def init(self, config): diff --git a/python/spdk/sma/device/nvmf_tcp.py b/python/spdk/sma/device/nvmf_tcp.py index 86313a560..4e869c5e2 100644 --- a/python/spdk/sma/device/nvmf_tcp.py +++ b/python/spdk/sma/device/nvmf_tcp.py @@ -10,7 +10,7 @@ from ..proto import nvmf_tcp_pb2 class NvmfTcpDeviceManager(DeviceManager): def __init__(self, client): - super().__init__('nvmf_tcp', client) + super().__init__('nvmf_tcp', 'nvmf_tcp', client) def init(self, config): self._has_transport = self._create_transport() diff --git a/python/spdk/sma/sma.py b/python/spdk/sma/sma.py index 9fa921fe1..a268bb0a4 100644 --- a/python/spdk/sma/sma.py +++ b/python/spdk/sma/sma.py @@ -22,7 +22,7 @@ class StorageManagementAgent(pb2_grpc.StorageManagementAgentServicer): return wrapper def register_device(self, device_manager): - self._devices[device_manager.name] = device_manager + self._devices[device_manager.protocol] = device_manager def run(self): self._server.start()