Commit c802dbe9 authored by Konrad Sztyber's avatar Konrad Sztyber Committed by Tomasz Zawadzki
Browse files

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: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Ib4a6c323ba6a2a5d36ff958ddc40631fd9329cb1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11683


Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent d045916f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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):
+1 −1
Original line number Diff line number Diff line
@@ -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()
+1 −1
Original line number Diff line number Diff line
@@ -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()