From 4dc4328ff853f7ec57defaff0a20a8f6b98ec018 Mon Sep 17 00:00:00 2001 From: Gil Bregman Date: Thu, 5 Sep 2024 14:37:11 +0300 Subject: [PATCH] Append group name to subsystem NQN Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2308983 Signed-off-by: Gil Bregman --- .env | 2 +- control/cli.py | 4 ++- control/grpc.py | 11 +++++-- control/proto/gateway.proto | 1 + mk/demo.mk | 2 +- mk/demosecure.mk | 2 +- tests/ha/namespaces.sh | 4 +-- tests/ha/setup.sh | 2 +- tests/ha/setup_4gws.sh | 2 +- tests/ha/setup_mtls.sh | 2 +- tests/ha/start_up.sh | 5 +-- tests/test_cli.py | 64 +++++++++++++++++++++++++++---------- tests/test_cli_change_lb.py | 1 + tests/test_grpc.py | 1 + tests/test_multi_gateway.py | 2 +- tests/test_nsid.py | 4 +-- tests/test_omap_lock.py | 6 ++-- tests/test_psk.py | 1 + 18 files changed, 81 insertions(+), 35 deletions(-) diff --git a/.env b/.env index 0af1313a..4cb053e1 100644 --- a/.env +++ b/.env @@ -71,7 +71,7 @@ CEPH_SHA=b59673c44bd569f9f3db37f87bced695dec5fcbf CEPH_DEVEL_MGR_PATH=../ceph # Atom -ATOM_SHA=ea4461ac526d6b66ccf0f93d693aa31d929932ad +ATOM_SHA=be72d1c50eb7d0c5ad9274795c1b38b3ee261878 # Demo settings RBD_POOL=rbd diff --git a/control/cli.py b/control/cli.py index 8707fb15..18c47847 100644 --- a/control/cli.py +++ b/control/cli.py @@ -673,7 +673,8 @@ def subsystem_add(self, args): req = pb2.create_subsystem_req(subsystem_nqn=args.subsystem, serial_number=args.serial_number, max_namespaces=args.max_namespaces, - enable_ha=True) + enable_ha=True, + no_group_append=args.no_group_append) try: ret = self.stub.create_subsystem(req) except Exception as ex: @@ -809,6 +810,7 @@ def subsystem_list(self, args): argument("--subsystem", "-n", help="Subsystem NQN", required=True), argument("--serial-number", "-s", help="Serial number", required=False), argument("--max-namespaces", "-m", help="Maximum number of namespaces", type=int, required=False), + argument("--no-group-append", help="Do not append gateway group name to the NQN", action='store_true', required=False), ] subsys_del_args = [ argument("--subsystem", "-n", help="Subsystem NQN", required=True), diff --git a/control/grpc.py b/control/grpc.py index 7ef76b66..632bcf46 100644 --- a/control/grpc.py +++ b/control/grpc.py @@ -217,7 +217,6 @@ def __init__(self, config: GatewayConfig, gateway_state: GatewayStateHandler, rp self.gateway_name = self.config.get("gateway", "name") if not self.gateway_name: self.gateway_name = socket.gethostname() - self.gateway_group = self.config.get("gateway", "group") override_hostname = self.config.get_with_default("gateway", "override_hostname", "") if override_hostname: self.host_name = override_hostname @@ -637,7 +636,7 @@ def create_subsystem_safe(self, request, context): peer_msg = self.get_peer_message(context) self.logger.info( - f"Received request to create subsystem {request.subsystem_nqn}, enable_ha: {request.enable_ha}, max_namespaces: {request.max_namespaces}, context: {context}{peer_msg}") + f"Received request to create subsystem {request.subsystem_nqn}, enable_ha: {request.enable_ha}, max_namespaces: {request.max_namespaces}, no group append: {request.no_group_append}, context: {context}{peer_msg}") if not request.enable_ha: errmsg = f"{create_subsystem_error_prefix}: HA must be enabled for subsystems" @@ -667,6 +666,14 @@ def create_subsystem_safe(self, request, context): self.logger.error(f"{errmsg}") return pb2.req_status(status = errno.EINVAL, error_message = errmsg) + if context: + if request.no_group_append or not self.gateway_group: + self.logger.info(f"Subsystem NQN will not be changed") + else: + group_name_to_use = self.gateway_group.replace(GatewayState.OMAP_KEY_DELIMITER, "-") + request.subsystem_nqn += f".{group_name_to_use}" + self.logger.info(f"Subsystem NQN was changed to {request.subsystem_nqn}, adding the group name") + # Set client ID range according to group id assigned by the monitor offset = self.group_id * CNTLID_RANGE_SIZE min_cntlid = offset + 1 diff --git a/control/proto/gateway.proto b/control/proto/gateway.proto index da3f4c0f..7a2f7749 100644 --- a/control/proto/gateway.proto +++ b/control/proto/gateway.proto @@ -165,6 +165,7 @@ message create_subsystem_req { string serial_number = 2; optional uint32 max_namespaces = 3; bool enable_ha = 4; + optional bool no_group_append = 5; } message delete_subsystem_req { diff --git a/mk/demo.mk b/mk/demo.mk index 7cf3aba9..640cd1ef 100644 --- a/mk/demo.mk +++ b/mk/demo.mk @@ -2,7 +2,7 @@ # demo demo: - $(NVMEOF_CLI) subsystem add --subsystem $(NQN) + $(NVMEOF_CLI) subsystem add --subsystem $(NQN) --no-group-append $(NVMEOF_CLI) namespace add --subsystem $(NQN) --rbd-pool $(RBD_POOL) --rbd-image $(RBD_IMAGE_NAME) --size $(RBD_IMAGE_SIZE) --rbd-create-image $(NVMEOF_CLI) listener add --subsystem $(NQN) --host-name `docker ps -q -f name=$(NVMEOF_CONTAINER_NAME)` --traddr $(NVMEOF_IP_ADDRESS) --trsvcid $(NVMEOF_IO_PORT) $(NVMEOF_CLI_IPV6) listener add --subsystem $(NQN) --host-name `docker ps -q -f name=$(NVMEOF_CONTAINER_NAME)` --traddr $(NVMEOF_IPV6_ADDRESS) --trsvcid $(NVMEOF_IO_PORT) --adrfam IPV6 diff --git a/mk/demosecure.mk b/mk/demosecure.mk index 96588bd0..9c01f052 100644 --- a/mk/demosecure.mk +++ b/mk/demosecure.mk @@ -5,7 +5,7 @@ HOSTNQN2=`cat /etc/nvme/hostnqn | sed 's/......$$/ffffff/'` NVMEOF_IO_PORT2=`expr $(NVMEOF_IO_PORT) + 1` # demosecure demosecure: - $(NVMEOF_CLI) subsystem add --subsystem $(NQN) + $(NVMEOF_CLI) subsystem add --subsystem $(NQN) --no-group-append $(NVMEOF_CLI) namespace add --subsystem $(NQN) --rbd-pool $(RBD_POOL) --rbd-image $(RBD_IMAGE_NAME) --size $(RBD_IMAGE_SIZE) --rbd-create-image $(NVMEOF_CLI) listener add --subsystem $(NQN) --host-name `docker ps -q -f name=$(NVMEOF_CONTAINER_NAME)` --traddr $(NVMEOF_IP_ADDRESS) --trsvcid $(NVMEOF_IO_PORT) --secure $(NVMEOF_CLI) listener add --subsystem $(NQN) --host-name `docker ps -q -f name=$(NVMEOF_CONTAINER_NAME)` --traddr $(NVMEOF_IP_ADDRESS) --trsvcid $(NVMEOF_IO_PORT2) diff --git a/tests/ha/namespaces.sh b/tests/ha/namespaces.sh index 9eb66ff6..a82f3761 100755 --- a/tests/ha/namespaces.sh +++ b/tests/ha/namespaces.sh @@ -77,7 +77,7 @@ GW2_ANA=2 GW_INC=2 echo "ℹ️ Step 1: create subsystem $NQN" -docker compose run --rm nvmeof-cli --server-address $GW1_IP --server-port 5500 subsystem add --subsystem $NQN +docker compose run --rm nvmeof-cli --server-address $GW1_IP --server-port 5500 subsystem add --subsystem $NQN --no-group-append verify_num_namespaces $GW1_IP $NO_NAMESPACE verify_num_namespaces $GW2_IP $NO_NAMESPACE @@ -103,4 +103,4 @@ verify_num_namespaces $GW1_IP $NO_NAMESPACE verify_num_namespaces $GW2_IP $NO_NAMESPACE echo "ℹ️ Step 5: delete subsystem $NQN" -docker compose run --rm nvmeof-cli --server-address $GW1_IP --server-port 5500 subsystem del --subsystem $NQN +docker compose run --rm nvmeof-cli --server-address $GW1_IP --server-port 5500 subsystem del --subsystem $NQN diff --git a/tests/ha/setup.sh b/tests/ha/setup.sh index d6525860..d419c458 100755 --- a/tests/ha/setup.sh +++ b/tests/ha/setup.sh @@ -6,7 +6,7 @@ GW1_IP="$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{ GW2_IP="$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "$GW2_NAME")" NQN="nqn.2016-06.io.spdk:cnode1" -docker compose run --rm nvmeof-cli --server-address $GW1_IP --server-port 5500 subsystem add --subsystem $NQN +docker compose run --rm nvmeof-cli --server-address $GW1_IP --server-port 5500 subsystem add --subsystem $NQN --no-group-append docker compose run --rm nvmeof-cli --server-address $GW1_IP --server-port 5500 namespace add --subsystem $NQN --rbd-pool rbd --rbd-image demo_image1 --size 10M --rbd-create-image -l 1 docker compose run --rm nvmeof-cli --server-address $GW1_IP --server-port 5500 namespace add --subsystem $NQN --rbd-pool rbd --rbd-image demo_image2 --size 10M --rbd-create-image -l 2 docker compose run --rm nvmeof-cli --server-address $GW1_IP --server-port 5500 listener add --subsystem $NQN --host-name $GW1_NAME --traddr $GW1_IP --trsvcid 4420 diff --git a/tests/ha/setup_4gws.sh b/tests/ha/setup_4gws.sh index ba562969..3dbc5388 100755 --- a/tests/ha/setup_4gws.sh +++ b/tests/ha/setup_4gws.sh @@ -33,7 +33,7 @@ NUM_NAMESPACES=32 # Setup for i in $(seq $NUM_SUBSYSTEMS); do NQN="nqn.2016-06.io.spdk:cnode$i" - docker compose run --rm nvmeof-cli --server-address $(gw_ip 1) --server-port 5500 subsystem add --subsystem $NQN --max-namespaces $NUM_NAMESPACES + docker compose run --rm nvmeof-cli --server-address $(gw_ip 1) --server-port 5500 subsystem add --subsystem $NQN --max-namespaces $NUM_NAMESPACES --no-group-append for n in $(seq $NUM_NAMESPACES); do IMAGE="image_${i}_${n}" L=$(expr $n % $NUM_GATEWAYS + 1) diff --git a/tests/ha/setup_mtls.sh b/tests/ha/setup_mtls.sh index 4144bc49..25d344fc 100755 --- a/tests/ha/setup_mtls.sh +++ b/tests/ha/setup_mtls.sh @@ -4,7 +4,7 @@ GW1_NAME=$(docker ps --format '{{.ID}}\t{{.Names}}' | awk '$2 ~ /nvmeof/ && $2 ~ GW1_IP="$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "$GW1_NAME")" NQN="nqn.2016-06.io.spdk:cnode1" -docker compose run --rm nvmeof-cli --server-address $GW1_IP --server-port 5500 --server-cert /etc/ceph/server.crt --client-key /etc/ceph/client.key --client-cert /etc/ceph/client.crt subsystem add --subsystem $NQN +docker compose run --rm nvmeof-cli --server-address $GW1_IP --server-port 5500 --server-cert /etc/ceph/server.crt --client-key /etc/ceph/client.key --client-cert /etc/ceph/client.crt subsystem add --subsystem $NQN --no-group-append docker compose run --rm nvmeof-cli --server-address $GW1_IP --server-port 5500 --server-cert /etc/ceph/server.crt --client-key /etc/ceph/client.key --client-cert /etc/ceph/client.crt namespace add --subsystem $NQN --rbd-pool rbd --rbd-image demo_image1 --size 10M --rbd-create-image -l 1 #docker compose run --rm nvmeof-cli --server-address $GW1_IP --server-port 5500 --server-cert /etc/ceph/server.crt --client-key /etc/ceph/client.key --client-cert /etc/ceph/client.crt namespace add --subsystem $NQN --rbd-pool rbd --rbd-image demo_image2 --size 10M --rbd-create-image -l 2 docker compose run --rm nvmeof-cli --server-address $GW1_IP --server-port 5500 --server-cert /etc/ceph/server.crt --client-key /etc/ceph/client.key --client-cert /etc/ceph/client.crt listener add --subsystem $NQN --host-name $GW1_NAME --traddr $GW1_IP --trsvcid 4420 diff --git a/tests/ha/start_up.sh b/tests/ha/start_up.sh index 74b41a7f..241a2e96 100755 --- a/tests/ha/start_up.sh +++ b/tests/ha/start_up.sh @@ -32,8 +32,9 @@ echo ℹ️ Running processes of services docker compose top echo ℹ️ Send nvme-gw create for all gateways +GW_GROUP=$(grep group ceph-nvmeof.conf | sed 's/^[^=]*=//' | sed 's/^ *//' | sed 's/ *$//') for i in $(seq $SCALE); do GW_NAME=$(docker ps --format '{{.ID}}\t{{.Names}}' | grep -v discovery | awk '$2 ~ /nvmeof/ && $2 ~ /'$i'/ {print $1}') - echo 📫 nvme-gw create gateway: \'$GW_NAME\' pool: \'$POOL\', group: \'\' \(empty string\) - docker compose exec -T ceph ceph nvme-gw create $GW_NAME $POOL '' + echo 📫 nvme-gw create gateway: \'$GW_NAME\' pool: \'$POOL\', group: \'$GW_GROUP\' + docker compose exec -T ceph ceph nvme-gw create $GW_NAME $POOL "$GW_GROUP" done diff --git a/tests/test_cli.py b/tests/test_cli.py index 05ba8f8e..142482e6 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -18,6 +18,8 @@ pool = "rbd" subsystem = "nqn.2016-06.io.spdk:cnode1" subsystem2 = "nqn.2016-06.io.spdk:cnode2" +subsystem3 = "nqn.2016-06.io.spdk:cnode3" +subsystem4 = "nqn.2016-06.io.spdk:cnode4" discovery_nqn = "nqn.2014-08.org.nvmexpress.discovery" serial = "Ceph00000000000001" uuid = "948878ee-c3b2-4d58-a29b-2cff713fc02d" @@ -39,6 +41,7 @@ listener_list_big_port = [["-t", host_name, "-a", addr, "-s", "70000"]] listener_list_wrong_host = [["-t", "WRONG", "-a", addr, "-s", "5015", "-f", "ipv4"]] config = "ceph-nvmeof.conf" +group_name = "GROUPNAME" @pytest.fixture(scope="module") def gateway(config): @@ -46,6 +49,7 @@ def gateway(config): addr = config.get("gateway", "addr") port = config.getint("gateway", "port") + config.config["gateway"]["group"] = group_name config.config["gateway-logs"]["log_level"] = "debug" ceph_utils = CephUtils(config) @@ -53,7 +57,7 @@ def gateway(config): # Start gateway gateway.gw_logger_object.set_log_level("debug") - ceph_utils.execute_ceph_monitor_command("{" + f'"prefix":"nvme-gw create", "id": "{gateway.name}", "pool": "{pool}", "group": ""' + "}") + ceph_utils.execute_ceph_monitor_command("{" + f'"prefix":"nvme-gw create", "id": "{gateway.name}", "pool": "{pool}", "group": "{group_name}"' + "}") gateway.serve() # Bind the client and Gateway @@ -134,52 +138,52 @@ def test_get_gateway_info(self, caplog, gateway): class TestCreate: def test_create_subsystem(self, caplog, gateway): caplog.clear() - cli(["subsystem", "add", "--subsystem", "nqn.2016"]) + cli(["subsystem", "add", "--subsystem", "nqn.2016", "--no-group-append"]) assert f'NQN "nqn.2016" is too short, minimal length is 11' in caplog.text caplog.clear() cli(["subsystem", "add", "--subsystem", -"nqn.2016-06XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"]) +"nqn.2016-06XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "--no-group-append"]) assert f"is too long, maximal length is 223" in caplog.text caplog.clear() - cli(["subsystem", "add", "--subsystem", "nqn.2014-08.org.nvmexpress:uuid:0"]) + cli(["subsystem", "add", "--subsystem", "nqn.2014-08.org.nvmexpress:uuid:0", "--no-group-append"]) assert f"UUID is not the correct length" in caplog.text caplog.clear() - cli(["subsystem", "add", "--subsystem", "nqn.2014-08.org.nvmexpress:uuid:9e9134-3cb431-4f3e-91eb-a13cefaabebf"]) + cli(["subsystem", "add", "--subsystem", "nqn.2014-08.org.nvmexpress:uuid:9e9134-3cb431-4f3e-91eb-a13cefaabebf", "--no-group-append"]) assert f"UUID is not formatted correctly" in caplog.text caplog.clear() - cli(["subsystem", "add", "--subsystem", "qqn.2016-06.io.spdk:cnode1"]) + cli(["subsystem", "add", "--subsystem", "qqn.2016-06.io.spdk:cnode1", "--no-group-append"]) assert f"doesn't start with" in caplog.text caplog.clear() - cli(["subsystem", "add", "--subsystem", "nqn.016-206.io.spdk:cnode1"]) + cli(["subsystem", "add", "--subsystem", "nqn.016-206.io.spdk:cnode1", "--no-group-append"]) assert f"invalid date code" in caplog.text caplog.clear() - cli(["subsystem", "add", "--subsystem", "nqn.2X16-06.io.spdk:cnode1"]) + cli(["subsystem", "add", "--subsystem", "nqn.2X16-06.io.spdk:cnode1", "--no-group-append"]) assert f"invalid date code" in caplog.text caplog.clear() - cli(["subsystem", "add", "--subsystem", "nqn.2016-06.io.spdk:"]) + cli(["subsystem", "add", "--subsystem", "nqn.2016-06.io.spdk:", "--no-group-append"]) assert f"must contain a user specified name starting with" in caplog.text caplog.clear() - cli(["subsystem", "add", "--subsystem", "nqn.2016-06.io..spdk:cnode1"]) + cli(["subsystem", "add", "--subsystem", "nqn.2016-06.io..spdk:cnode1", "--no-group-append"]) assert f"reverse domain is not formatted correctly" in caplog.text caplog.clear() - cli(["subsystem", "add", "--subsystem", "nqn.2016-06.io.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.spdk:cnode1"]) + cli(["subsystem", "add", "--subsystem", "nqn.2016-06.io.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.spdk:cnode1", "--no-group-append"]) assert f"reverse domain is not formatted correctly" in caplog.text caplog.clear() - cli(["subsystem", "add", "--subsystem", "nqn.2016-06.io.-spdk:cnode1"]) + cli(["subsystem", "add", "--subsystem", "nqn.2016-06.io.-spdk:cnode1", "--no-group-append"]) assert f"reverse domain is not formatted correctly" in caplog.text caplog.clear() - cli(["subsystem", "add", "--subsystem", f"{subsystem}_X"]) + cli(["subsystem", "add", "--subsystem", f"{subsystem}_X", "--no-group-append"]) assert f"Invalid NQN" in caplog.text assert f"contains invalid characters" in caplog.text caplog.clear() - cli(["subsystem", "add", "--subsystem", subsystem, "--max-namespaces", "2049"]) + cli(["subsystem", "add", "--subsystem", subsystem, "--max-namespaces", "2049", "--no-group-append"]) assert f"create_subsystem {subsystem}: True" in caplog.text cli(["--format", "json", "subsystem", "list"]) assert f'"serial_number": "{serial}"' not in caplog.text assert f'"nqn": "{subsystem}"' in caplog.text assert f'"max_namespaces": 2049' in caplog.text caplog.clear() - cli(["subsystem", "add", "--subsystem", subsystem2, "--serial-number", serial]) + cli(["subsystem", "add", "--subsystem", subsystem2, "--serial-number", serial, "--no-group-append"]) assert f"create_subsystem {subsystem2}: True" in caplog.text caplog.clear() cli(["--format", "json", "subsystem", "list"]) @@ -234,6 +238,15 @@ def test_create_subsystem_with_discovery_nqn(self, caplog, gateway): pass assert "Can't add a discovery subsystem" in caplog.text assert rc == 2 + caplog.clear() + rc = 0 + try: + cli(["subsystem", "add", "--subsystem", discovery_nqn, "--no-group-append"]) + except SystemExit as sysex: + rc = int(str(sysex)) + pass + assert "Can't add a discovery subsystem" in caplog.text + assert rc == 2 def test_add_namespace_wrong_balancing_group(self, caplog, gateway): caplog.clear() @@ -911,7 +924,7 @@ def test_create_subsystem_ana(self, caplog, gateway): cli(["subsystem", "list"]) assert "No subsystems" in caplog.text caplog.clear() - cli(["subsystem", "add", "--subsystem", subsystem]) + cli(["subsystem", "add", "--subsystem", subsystem, "--no-group-append"]) assert f"Adding subsystem {subsystem}: Successful" in caplog.text caplog.clear() cli(["subsystem", "list"]) @@ -955,6 +968,25 @@ def test_delete_subsystem_ana(self, caplog, gateway): cli(["subsystem", "list"]) assert "No subsystems" in caplog.text +class TestSubsysWithGroupName: + def test_create_subsys_group_name(self, caplog, gateway): + caplog.clear() + cli(["subsystem", "add", "--subsystem", subsystem3]) + assert f"Subsystem NQN was changed to {subsystem3}.{group_name}, adding the group name" in caplog.text + assert f"create_subsystem {subsystem3}.{group_name}: True" in caplog.text + assert f"create_subsystem {subsystem3}: True" not in caplog.text + cli(["--format", "json", "subsystem", "list"]) + assert f'"nqn": "{subsystem3}.{group_name}"' in caplog.text + assert f'"nqn": "{subsystem3}"' not in caplog.text + caplog.clear() + cli(["subsystem", "add", "--subsystem", subsystem4, "--no-group-append"]) + assert f"Subsystem NQN will not be changed" in caplog.text + assert f"create_subsystem {subsystem4}.{group_name}: True" not in caplog.text + assert f"create_subsystem {subsystem4}: True" in caplog.text + cli(["--format", "json", "subsystem", "list"]) + assert f'"nqn": "{subsystem4}.{group_name}"' not in caplog.text + assert f'"nqn": "{subsystem4}"' in caplog.text + class TestGwLogLevel: def test_gw_log_level(self, caplog, gateway): caplog.clear() diff --git a/tests/test_cli_change_lb.py b/tests/test_cli_change_lb.py index db234ac0..13b0fbd5 100644 --- a/tests/test_cli_change_lb.py +++ b/tests/test_cli_change_lb.py @@ -28,6 +28,7 @@ def two_gateways(config): sockA = f"spdk_{nameA}.sock" sockB = f"spdk_{nameB}.sock" config.config["gateway-logs"]["log_level"] = "debug" + config.config["gateway"]["group"] = "" addr = config.get("gateway", "addr") configA = copy.deepcopy(config) configB = copy.deepcopy(config) diff --git a/tests/test_grpc.py b/tests/test_grpc.py index 1b3bacc2..b80264ad 100644 --- a/tests/test_grpc.py +++ b/tests/test_grpc.py @@ -39,6 +39,7 @@ def check_resource_by_index(i, caplog): # for pytest. In order for the test to fail in such a case we need to ask pytest to regard this as an error @pytest.mark.filterwarnings("error::pytest.PytestUnhandledThreadExceptionWarning") def test_create_get_subsys(caplog, config): + config.config["gateway"]["group"] = "" ceph_utils = CephUtils(config) with GatewayServer(config) as gateway: ceph_utils.execute_ceph_monitor_command("{" + f'"prefix":"nvme-gw create", "id": "{gateway.name}", "pool": "{pool}", "group": ""' + "}") diff --git a/tests/test_multi_gateway.py b/tests/test_multi_gateway.py index 9f470110..8cec96fa 100644 --- a/tests/test_multi_gateway.py +++ b/tests/test_multi_gateway.py @@ -76,7 +76,7 @@ def test_multi_gateway_coordination(config, image, conn): # Send requests to create a subsystem with one namespace to GatewayA subsystem_req = pb2.create_subsystem_req(subsystem_nqn=nqn, max_namespaces=256, - serial_number=serial, enable_ha=True) + serial_number=serial, enable_ha=True, no_group_append=True) namespace_req = pb2.namespace_add_req(subsystem_nqn=nqn, rbd_pool_name=pool, rbd_image_name=image, diff --git a/tests/test_nsid.py b/tests/test_nsid.py index 6b5896dc..5e64369e 100644 --- a/tests/test_nsid.py +++ b/tests/test_nsid.py @@ -77,13 +77,13 @@ def test_multi_gateway_namespace_ids(config, image, caplog): # Send requests to create a subsystem on GatewayA caplog.clear() subsystem = f"{subsystem_prefix}PPP" - subsystem_add_req = pb2.create_subsystem_req(subsystem_nqn=subsystem, max_namespaces=256) + subsystem_add_req = pb2.create_subsystem_req(subsystem_nqn=subsystem, max_namespaces=256, no_group_append=True) ret_subsystem = stubA.create_subsystem(subsystem_add_req) assert ret_subsystem.status != 0 assert "HA must be enabled for subsystems" in caplog.text caplog.clear() subsystem = f"{subsystem_prefix}WWW" - subsystem_add_req = pb2.create_subsystem_req(subsystem_nqn=subsystem, max_namespaces=256, enable_ha=True) + subsystem_add_req = pb2.create_subsystem_req(subsystem_nqn=subsystem, max_namespaces=256, enable_ha=True, no_group_append=True) ret_subsystem = stubA.create_subsystem(subsystem_add_req) assert ret_subsystem.status == 0 assert f"create_subsystem {subsystem}: True" in caplog.text diff --git a/tests/test_omap_lock.py b/tests/test_omap_lock.py index 826d4593..28afb10a 100644 --- a/tests/test_omap_lock.py +++ b/tests/test_omap_lock.py @@ -139,7 +139,7 @@ def build_host_nqn(i): def create_resource_by_index(stub, i, caplog): subsystem = f"{subsystem_prefix}{i}" - subsystem_req = pb2.create_subsystem_req(subsystem_nqn=subsystem, max_namespaces=256, enable_ha=True) + subsystem_req = pb2.create_subsystem_req(subsystem_nqn=subsystem, max_namespaces=256, enable_ha=True, no_group_append=True) ret_subsystem = stub.create_subsystem(subsystem_req) assert ret_subsystem.status == 0 if caplog != None: @@ -191,7 +191,7 @@ def test_multi_gateway_omap_reread(config, conn_omap_reread, caplog): num_subsystems = 2 # Send requests to create a subsystem with one namespace to GatewayA - subsystem_req = pb2.create_subsystem_req(subsystem_nqn=nqn, serial_number=serial, max_namespaces=256, enable_ha=True) + subsystem_req = pb2.create_subsystem_req(subsystem_nqn=nqn, serial_number=serial, max_namespaces=256, enable_ha=True, no_group_append=True) namespace_req = pb2.namespace_add_req(subsystem_nqn=nqn, nsid=nsid, rbd_pool_name=pool, rbd_image_name=image, block_size=4096, create_image=True, size=16*1024*1024, force=True) @@ -319,7 +319,7 @@ def test_multi_gateway_listener_update(config, image, conn_concurrent, caplog): caplog.clear() subsystem = f"{subsystem_prefix}QQQ" - subsystem_add_req = pb2.create_subsystem_req(subsystem_nqn=subsystem, max_namespaces=256, enable_ha=True) + subsystem_add_req = pb2.create_subsystem_req(subsystem_nqn=subsystem, max_namespaces=256, enable_ha=True, no_group_append=True) ret_subsystem = stubA.create_subsystem(subsystem_add_req) assert ret_subsystem.status == 0 assert f"create_subsystem {subsystem}: True" in caplog.text diff --git a/tests/test_psk.py b/tests/test_psk.py index 679c736b..f5ed5306 100644 --- a/tests/test_psk.py +++ b/tests/test_psk.py @@ -49,6 +49,7 @@ def gateway(config): addr = config.get("gateway", "addr") port = config.getint("gateway", "port") config.config["gateway-logs"]["log_level"] = "debug" + config.config["gateway"]["group"] = "" ceph_utils = CephUtils(config) with GatewayServer(config) as gateway: