From 3e9effb8f64cb30792c438eeba17a0a36395968e Mon Sep 17 00:00:00 2001 From: Yin Congmin Date: Wed, 10 May 2023 17:35:40 +0800 Subject: [PATCH] control/cli: add ip requirement for listener discovert controller need a specific ip/port. fixes: https://github.com/ceph/ceph-nvmeof/issues/87 Signed-off-by: Yin Congmin --- control/cli.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/control/cli.py b/control/cli.py index 4b6bedc57..2c002bef5 100644 --- a/control/cli.py +++ b/control/cli.py @@ -11,6 +11,7 @@ import grpc import json import logging +import socket from .generated import gateway_pb2_grpc as pb2_grpc from .generated import gateway_pb2 as pb2 from .config import GatewayConfig @@ -268,10 +269,10 @@ def remove_host(self, args): @cli.cmd([ argument("-n", "--subnqn", help="Subsystem NQN", required=True), - argument("-g", "--gateway-name", help="Gateway name", default=""), + argument("-g", "--gateway-name", help="Gateway name", default=socket.gethostname()), argument("-t", "--trtype", help="Transport type", default="TCP"), argument("-f", "--adrfam", help="Address family", default="ipv4"), - argument("-a", "--traddr", help="NVMe host IP", default=""), + argument("-a", "--traddr", help="NVMe host IP", required=True), argument("-s", "--trsvcid", help="Port number", required=True), ]) def create_listener(self, args): @@ -293,10 +294,10 @@ def create_listener(self, args): @cli.cmd([ argument("-n", "--subnqn", help="Subsystem NQN", required=True), - argument("-g", "--gateway-name", help="Gateway name", default=""), + argument("-g", "--gateway-name", help="Gateway name", default=socket.gethostname()), argument("-t", "--trtype", help="Transport type", default="TCP"), argument("-f", "--adrfam", help="Address family", default="ipv4"), - argument("-a", "--traddr", help="NVMe host IP", default=""), + argument("-a", "--traddr", help="NVMe host IP", required=True), argument("-s", "--trsvcid", help="Port number", required=True), ]) def delete_listener(self, args):