diff --git a/ceph-nvmeof.conf b/ceph-nvmeof.conf index 760ce045..9aa4af7c 100644 --- a/ceph-nvmeof.conf +++ b/ceph-nvmeof.conf @@ -60,8 +60,7 @@ client_cert = ./client.crt [spdk] bdevs_per_cluster = 32 tgt_path = /usr/local/bin/nvmf_tgt -#rpc_socket_dir = /var/tmp/ -#rpc_socket_name = spdk.sock +#rpc_socket = /var/tmp/spdk.sock #tgt_cmd_extra_args = --env-context="--no-huge -m1024" --iova-mode=va timeout = 60.0 log_level = diff --git a/control/server.py b/control/server.py index 106087c6..ff7445cf 100644 --- a/control/server.py +++ b/control/server.py @@ -332,18 +332,6 @@ def _grpc_server(self, address): return server - def _get_spdk_rpc_socket_path(self, omap_state) -> str: - # For backward compatibility, try first to get the old attribute - spdk_rpc_socket = self.config.get_with_default("spdk", "rpc_socket", "") - if spdk_rpc_socket: - return spdk_rpc_socket - - (spdk_rpc_socket_dir, create_status) = GatewayUtils.get_directory_with_fsid( - self.logger, self.config, self.ceph_utils, "spdk", "rpc_socket_dir", - GatewayConfig.CEPH_RUN_DIRECTORY, "", True) - spdk_rpc_socket = spdk_rpc_socket_dir + self.config.get_with_default("spdk", "rpc_socket_name", "spdk.sock") - return spdk_rpc_socket - def _start_spdk(self, omap_state): """Starts SPDK process.""" @@ -351,7 +339,7 @@ def _start_spdk(self, omap_state): self.logger.debug(f"Configuring server {self.name}") spdk_tgt_path = self.config.get("spdk", "tgt_path") self.logger.info(f"SPDK Target Path: {spdk_tgt_path}") - self.spdk_rpc_socket_path = self._get_spdk_rpc_socket_path(omap_state) + self.spdk_rpc_socket_path = self.config.get_with_default("spdk", "rpc_socket", "/var/tmp/spdk.sock") self.logger.info(f"SPDK Socket: {self.spdk_rpc_socket_path}") spdk_tgt_cmd_extra_args = self.config.get_with_default( "spdk", "tgt_cmd_extra_args", "") diff --git a/control/utils.py b/control/utils.py index 83422fb2..00aadb78 100644 --- a/control/utils.py +++ b/control/utils.py @@ -176,43 +176,6 @@ def is_valid_nqn(nqn): return (0, os.strerror(0)) - def get_directory_with_fsid(logger, config, ceph_utils, conf_section, conf_field, def_value, suffix, should_create): - status = errno.ENOENT - dir_name = config.get_with_default(conf_section, conf_field, "") - if dir_name: - # If there is an explicit dir name in configuration file, do not change it - suffix = "" - else: - dir_name = def_value - if ceph_utils: - fsid = ceph_utils.fetch_ceph_fsid() - if fsid: - dir_name += fsid + "/" - if not dir_name.endswith("/"): - dir_name += "/" - if suffix: - dir_name += suffix - if not dir_name.endswith("/"): - dir_name += "/" - if should_create: - try: - os.makedirs(dir_name, 0o777, True) - status = 0 - except OSError as err: - logger.exception(f"makedirs({dir_name}, 0o777, True) failed") - status = err.errno - except Exception: - logger.exception(f"makedirs({dir_name}, 0o777, True) failed") - status = errno.ENOENT - else: - if os.path.isdir(dir_name): - status = 0 - else: - logger.error(f"Directory {dir_name} does not exist") - status = errno.ENOENT - - return (dir_name, status) - class GatewayLogger: CEPH_LOG_DIRECTORY = "/var/log/ceph/" MAX_LOG_FILE_SIZE_DEFAULT = 10