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 <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: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
d045916f65
commit
c802dbe9fe
@ -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):
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user