Spdk/test/sma/plugins/plugin2/__init__.py
Konrad Sztyber 2bf4927236 test/sma: plugin test
The test verifies that it's possible to register device managers from
out-of-tree plugins.  The test defines two plugins, each defining two
device managers implementing the same two protocols and verifies that
it's possible to register different combinations.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I2144b40db603fea95bf8b571777e6662b4de9bc7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11729
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2022-05-20 09:16:54 +00:00

22 lines
641 B
Python

from spdk.sma import DeviceManager
from spdk.sma.proto import sma_pb2
class TestDeviceManager1(DeviceManager):
def __init__(self, client):
super().__init__('plugin2-device1', 'nvme', client)
def create_device(self, request):
return sma_pb2.CreateDeviceResponse(handle=f'{self.protocol}:{self.name}')
class TestDeviceManager2(DeviceManager):
def __init__(self, client):
super().__init__('plugin2-device2', 'nvmf_tcp', client)
def create_device(self, request):
return sma_pb2.CreateDeviceResponse(handle=f'{self.protocol}:{self.name}')
devices = [TestDeviceManager1, TestDeviceManager2]