diff --git a/control/grpc.py b/control/grpc.py index 05beb79d..929083f2 100644 --- a/control/grpc.py +++ b/control/grpc.py @@ -1170,7 +1170,8 @@ def create_namespace(self, subsystem_nqn, bdev_name, nsid, anagrpid, uuid, no_au self.logger.error(errmsg) return pb2.nsid_status(status=errno.EINVAL, error_message=errmsg) - if self.subsystem_nsid_bdev_and_uuid.get_namespace_count(subsystem_nqn, True, 0) >= self.max_namespaces_with_netmask: + if no_auto_visible and self.subsystem_nsid_bdev_and_uuid.get_namespace_count(subsystem_nqn, + True, 0) >= self.max_namespaces_with_netmask: errmsg = f"Failure adding namespace{nsid_msg} to {subsystem_nqn}, maximal number of namespaces which are not auto visible ({self.max_namespaces_with_netmask}) was already reached" self.logger.error(f"{errmsg}") return pb2.req_status(status=errno.E2BIG, error_message=errmsg) diff --git a/tests/test_cli.py b/tests/test_cli.py index a7fc976c..7222812e 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -494,6 +494,9 @@ def test_add_too_many_namespaces_with_hosts(self, caplog, gateway): caplog.clear() cli(["namespace", "add", "--subsystem", subsystem, "--rbd-pool", pool, "--rbd-image", image8, "--size", "16MB", "--rbd-create-image", "--no-auto-visible"]) assert f"Failure adding namespace to {subsystem}, maximal number of namespaces which are not auto visible (3) was already reached" in caplog.text + caplog.clear() + cli(["namespace", "add", "--subsystem", subsystem, "--rbd-pool", pool, "--rbd-image", image8, "--size", "16MB", "--rbd-create-image"]) + assert f"Adding namespace 11 to {subsystem}: Successful" in caplog.text def test_list_namespace_with_hosts(self, caplog, gateway): caplog.clear()