From 20e3fb368767f1c1a54ca982659359ea1f8df2bf Mon Sep 17 00:00:00 2001 From: Konrad Sztyber Date: Tue, 17 May 2022 14:40:19 +0200 Subject: [PATCH] sma: pass config to StorageManagementAgent's __init__ This will make it easier to control various options through config file. Signed-off-by: Konrad Sztyber Change-Id: I19ab9c020d536521f5985227bc43965bd04d2707 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12724 Community-CI: Broadcom CI Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Tomasz Zawadzki --- python/spdk/sma/sma.py | 3 ++- scripts/sma.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/python/spdk/sma/sma.py b/python/spdk/sma/sma.py index 6bce442c0..5865fc5d4 100644 --- a/python/spdk/sma/sma.py +++ b/python/spdk/sma/sma.py @@ -9,7 +9,8 @@ from .proto import sma_pb2_grpc as pb2_grpc class StorageManagementAgent(pb2_grpc.StorageManagementAgentServicer): - def __init__(self, addr, port): + def __init__(self, config): + addr, port = config['address'], config['port'] self._devices = {} self._server = grpc.server(futures.ThreadPoolExecutor(max_workers=1)) self._server.add_insecure_port(f'{addr}:{port}') diff --git a/scripts/sma.py b/scripts/sma.py index 9e3c73529..1978abcfc 100755 --- a/scripts/sma.py +++ b/scripts/sma.py @@ -116,7 +116,7 @@ if __name__ == '__main__': # Wait until the SPDK process starts responding to RPCs wait_for_listen(client, timeout=60.0) - agent = sma.StorageManagementAgent(config['address'], config['port']) + agent = sma.StorageManagementAgent(config) devices = [sma.NvmfTcpDeviceManager(client)] devices += load_plugins(config.get('plugins') or [], client)