← Back to Pull requests

Allow setting SPDK sock implementation options #2238

Merged
gbregman merged 4 files (131 lines) on Oct 25, 2026 18:21 UTC
View on GitHub
gbregman gbregman commented on Oct 25, 2026 12:21 UTC
Author

Fixes: #2237

Diff: 131 lines (+127 / -4) across 4 files Reviewer: leonidc Review duration: 360m
All Vouch review confidence checks passed
Residual risk 0.04 = Change Risk (0.37) × (1 − Review Confidence (0.90)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 131 lines diff across 4 files
0.37
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.88 · 5 substantive comment(s)
0.88
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
89%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.292
Empty Description empty_description
0.060
Real PR Conversation Timeline
29 items
Copilot Copilot commented on code on Oct 25, 2026 12:24 UTC
Code Review
.github/workflows/build-container.yml:1
@@ -137,7 +137,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        test: ["cli", "cli_change_lb", "cli_change_keys", "cli_change_ns_visibility", "cli_change_ns_location", "cli_list_ns_locations", "cli_trash_rbd", "state", "multi_gateway", "server", "grpc", "omap_lock", "log_files", "nsid", "psk", "dhchap", "dhchap_ctrlr", "subsys_grp_name_append", "max_subsystems", "omap_no_read_lock", "omap_read_lock", "omap_read_lock_ignore_errors", "big_omap", "ns_limit", "cli_force_tls", "erasure_pool", "cli_ns_resize", "auto_listeners", "update_error", "discovery_bind", "cli_ns_hosts", "io_stats", "rbd_encrypt", "rados_namespace", "dsa", "degraded_ns", "pool_app", "group_config_netmask_multi_gateway"]
+        test: ["cli", "cli_change_lb", "cli_change_keys", "cli_change_ns_visibility", "cli_change_ns_location", "cli_list_ns_locations", "cli_trash_rbd", "state", "multi_gateway", "server", "grpc", "omap_lock", "log_files", "nsid", "psk", "dhchap", "dhchap_ctrlr", "subsys_grp_name_append", "max_subsystems", "omap_no_read_lock", "omap_read_lock", "omap_read_lock_ignore_errors", "big_omap", "ns_limit", "cli_force_tls", "erasure_pool", "cli_ns_resize", "auto_listeners", "update_error", "discovery_bind", "cli_ns_hosts", "io_stats", "rbd_encrypt", "rados_namespace", "dsa", "degraded_ns", "pool_app", "group_config_netmask_multi_gateway", "sock_options"]

The new sock_options matrix entry makes the test step invoke tests/test_sock_options.py, but that file is not included in this PR or present in the checkout. This job will fail because pytest cannot find the requested file. Please commit the socket-options test module alongside this matrix entry.

Copilot Copilot commented on code on Oct 25, 2026 12:24 UTC
Code Review
ceph-nvmeof.conf:1
@@ -128,6 +128,9 @@ transport_tcp_options = {"in_capsule_data_size" : 8192, "max_io_qpairs_per_ctrlr
 # Example value: {"small_pool_count" : 8192, "large_pool_count" : 1024, "small_bufsize" : 8192, "large_bufsize" : 135168, "enable_numa" : false}
 # iobuf_options =
 
+# Example value: {"ssl": {"sock_impl_options": 2097152, "send_buf_size": 2097152}, "posix": {"enable_quickack": true}}

The SSL example uses sock_impl_options as a nested option name instead of recv_buf_size. Copying this example forwards the configuration key itself to SPDK rather than setting the intended receive-buffer size. Please use recv_buf_size, matching the default below and in _start_spdk.

copilot-pull-request-reviewer[bot] copilot-pull-request-reviewer[bot] commented on Oct 25, 2026 12:24 UTC
Reviewer

<!-- ccr-overview-v2 -->

🟡 Changes recommended

The new CI job targets a missing test module and will fail rather than validate socket options.

<details open>
<summary><strong>2 open issues</strong></summary>

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-light.png" alt="High severity" width="62" height="18" align="texttop"></picture> Add missing socket-options test module · New

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.png" alt="Low severity" width="62" height="18" align="texttop"></picture> Use recv_buf_size in SSL socket options example · New

  • </details>

    <details>
    <summary><strong>What changed in this PR</strong></summary>

    Adds configuration-file support for SPDK socket implementation options, addressing #2237 within gateway startup.

    Changes:

  • Reads per-implementation socket options and applies them through SPDK RPC, defaulting SSL receive and send buffers to 2 MiB.

  • Documents the configuration setting with examples.

  • Adds a sock_options CI matrix entry.
  • | File | Description |
    | ---- | ----------- |
    | control/​server.py | Loads and applies socket options during SPDK initialization. |
    | ceph-nvmeof.conf | Adds socket-option configuration examples. |
    | .github/​workflows/​build-container.yml | Adds the socket-options test job. |
    </details>

    <sub>Review effort: Balanced</sub>

    gbregman gbregman commented on code on Oct 25, 2026 12:27 UTC
    Code Review
    .github/workflows/build-container.yml:1
    @@ -137,7 +137,7 @@ jobs:
         strategy:
           fail-fast: false
           matrix:
    -        test: ["cli", "cli_change_lb", "cli_change_keys", "cli_change_ns_visibility", "cli_change_ns_location", "cli_list_ns_locations", "cli_trash_rbd", "state", "multi_gateway", "server", "grpc", "omap_lock", "log_files", "nsid", "psk", "dhchap", "dhchap_ctrlr", "subsys_grp_name_append", "max_subsystems", "omap_no_read_lock", "omap_read_lock", "omap_read_lock_ignore_errors", "big_omap", "ns_limit", "cli_force_tls", "erasure_pool", "cli_ns_resize", "auto_listeners", "update_error", "discovery_bind", "cli_ns_hosts", "io_stats", "rbd_encrypt", "rados_namespace", "dsa", "degraded_ns", "pool_app", "group_config_netmask_multi_gateway"]
    +        test: ["cli", "cli_change_lb", "cli_change_keys", "cli_change_ns_visibility", "cli_change_ns_location", "cli_list_ns_locations", "cli_trash_rbd", "state", "multi_gateway", "server", "grpc", "omap_lock", "log_files", "nsid", "psk", "dhchap", "dhchap_ctrlr", "subsys_grp_name_append", "max_subsystems", "omap_no_read_lock", "omap_read_lock", "omap_read_lock_ignore_errors", "big_omap", "ns_limit", "cli_force_tls", "erasure_pool", "cli_ns_resize", "auto_listeners", "update_error", "discovery_bind", "cli_ns_hosts", "io_stats", "rbd_encrypt", "rados_namespace", "dsa", "degraded_ns", "pool_app", "group_config_netmask_multi_gateway", "sock_options"]

    forgot to add it, fixed

    gbregman gbregman commented on code on Oct 25, 2026 12:28 UTC
    Code Review
    ceph-nvmeof.conf:1
    @@ -128,6 +128,9 @@ transport_tcp_options = {"in_capsule_data_size" : 8192, "max_io_qpairs_per_ctrlr
     # Example value: {"small_pool_count" : 8192, "large_pool_count" : 1024, "small_bufsize" : 8192, "large_bufsize" : 135168, "enable_numa" : false}
     # iobuf_options =
     
    +# Example value: {"ssl": {"sock_impl_options": 2097152, "send_buf_size": 2097152}, "posix": {"enable_quickack": true}}

    typo, fixed

    Copilot Copilot commented on code on Oct 25, 2026 12:32 UTC
    Code Review
    control/server.py:1
    @@ -685,6 +688,10 @@ def _start_spdk(self):
                 if iobuf_options:
                     self._initialize_iobuf_options(iobuf_options)
     
    +            # Initialize sock implementation options
    +            if sock_impl_options:
    +                self._initialize_sock_impl_options(sock_impl_options)
    +
                 # Set SSL tickets for ssl sock implemtation
                 self._set_num_ssl_tickets(0)

    An explicit configuration such as {"ssl": {"ssl_tickets_number": 2}} is applied here but immediately overwritten by _set_num_ssl_tickets(0) below, so the gateway silently ignores this socket option. Apply the default ticket count before the configured options so explicit values take precedence.

    copilot-pull-request-reviewer[bot] copilot-pull-request-reviewer[bot] commented on Oct 25, 2026 12:32 UTC
    Reviewer

    <!-- ccr-overview-v2 -->

    🟡 Changes recommended

    Startup overwrites explicitly configured SSL ticket counts with zero.

    <details open>
    <summary><strong>1 open issue</strong></summary>

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.png" alt="Medium severity" width="62" height="18" align="texttop"></picture> Apply default SSL ticket count before configured options · New

  • </details>

    <details>
    <summary><strong>2 resolved since last review</strong></summary>

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-light.png" alt="High severity" width="62" height="18" align="texttop"></picture> Add missing socket-options test module

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.png" alt="Low severity" width="62" height="18" align="texttop"></picture> Use recv_buf_size in SSL socket options example

  • </details>

    <sub>Review effort: Balanced</sub>

    gbregman gbregman commented on code on Oct 25, 2026 12:41 UTC
    Code Review
    control/server.py:1
    @@ -685,6 +688,10 @@ def _start_spdk(self):
                 if iobuf_options:
                     self._initialize_iobuf_options(iobuf_options)
     
    +            # Initialize sock implementation options
    +            if sock_impl_options:
    +                self._initialize_sock_impl_options(sock_impl_options)
    +
                 # Set SSL tickets for ssl sock implemtation
                 self._set_num_ssl_tickets(0)

    changed

    Copilot Copilot commented on code on Oct 25, 2026 12:47 UTC
    Code Review
    control/server.py:1
    @@ -685,6 +688,10 @@ def _start_spdk(self):
                 if iobuf_options:
                     self._initialize_iobuf_options(iobuf_options)
     
    +            # Initialize sock implementation options
    +            if sock_impl_options:
    +                self._initialize_sock_impl_options(sock_impl_options)
    +
                 # Set SSL tickets for ssl sock implemtation
                 self._set_num_ssl_tickets(0)

    Startup still calls _set_num_ssl_tickets(0) after applying the configured socket options, discarding any explicit ssl_tickets_number. The newly added assertion in tests/test_sock_options.py:55 expects 5, but this sequence leaves it at 0. Apply the zero-ticket default before the configured options so explicit values take precedence.

    copilot-pull-request-reviewer[bot] copilot-pull-request-reviewer[bot] commented on Oct 25, 2026 12:47 UTC
    Reviewer

    <!-- ccr-overview-v2 -->

    🟡 Changes recommended

    Startup still overwrites the configured SSL ticket count, contradicting the new test’s expected value.

    <details open>
    <summary><strong>1 open issue</strong></summary>

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-light.png" alt="High severity" width="62" height="18" align="texttop"></picture> Apply SSL ticket default before configured socket options · New

  • </details>

    <details>
    <summary><strong>1 resolved since last review</strong></summary>

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.png" alt="Medium severity" width="62" height="18" align="texttop"></picture> Apply default SSL ticket count before configured options

  • </details>

    <sub>Review effort: Balanced</sub>

    gbregman gbregman commented on code on Oct 25, 2026 12:52 UTC
    Code Review
    control/server.py:1
    @@ -685,6 +688,10 @@ def _start_spdk(self):
                 if iobuf_options:
                     self._initialize_iobuf_options(iobuf_options)
     
    +            # Initialize sock implementation options
    +            if sock_impl_options:
    +                self._initialize_sock_impl_options(sock_impl_options)
    +
                 # Set SSL tickets for ssl sock implemtation
                 self._set_num_ssl_tickets(0)

    changed

    copilot-pull-request-reviewer[bot] copilot-pull-request-reviewer[bot] commented on Oct 25, 2026 12:54 UTC
    Reviewer

    <!-- ccr-overview-v2 -->

    🟢 Approval recommended

    No blocking issues remain in the reviewed changes; integration coverage is included, but container-dependent tests were not run here.

    No open issues 🎉

    <details>
    <summary><strong>1 resolved since last review</strong></summary>

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-light.png" alt="High severity" width="62" height="18" align="texttop"></picture> Apply SSL ticket default before configured socket options

  • </details>

    <sub>Review effort: Balanced</sub>

    leonidc leonidc approved these changes on Oct 25, 2026 13:28 UTC
    Approved Reviewer

    Approved these changes.

    Copilot Copilot commented on code on Oct 25, 2026 14:17 UTC
    Code Review
    control/server.py:1
    @@ -874,17 +877,33 @@ def _initialize_iobuf_options(self, options):
                 self.spdk_rpc_client.iobuf_set_options(**args)
             except Exception:
                 self.logger.exception("IObuf set options returned with error")
    -            pass
     
    -    def _set_num_ssl_tickets(self, tickets_number=0):
    -        """Set SSL tickets number for ssl socket implementation."""
    +    def _initialize_sock_impl_options(self, options):
    +        """Initialize socket implmentation options."""
     
    -        try:
    -            self.spdk_rpc_client.sock_impl_set_options(impl_name="ssl",
    -                                                       ssl_tickets_number=tickets_number)
    -        except Exception:
    -            self.logger.exception("sock_impl_set_options returned with error")
    -            pass
    +        args = {}
    +        self.logger.debug(f"initialize_sock_impl_options: options: {options}")
    +
    +        if options:
    +            try:
    +                args.update(json.loads(options))
    +            except json.decoder.JSONDecodeError:
    +                self.logger.exception(f"Failed to parse spdk sock_impl_options ({options})")
    +                return

    Invalid sock_impl_options can abort startup: null raises TypeError in args.update(), and a nonempty SSL list raises AttributeError at ssl_arg.get(). Malformed JSON instead returns early, allowing startup to continue without applying the existing zero-ticket SSL default. Validate that the outer value and each implementation's options are objects, then log invalid input and continue with empty options so the SSL default is still applied.

    copilot-pull-request-reviewer[bot] copilot-pull-request-reviewer[bot] commented on Oct 25, 2026 14:17 UTC
    Reviewer

    <!-- ccr-overview-v2 -->

    🟡 Changes recommended

    Invalid socket-option configuration can abort startup or bypass the existing zero-ticket SSL initialization.

    <details open>
    <summary><strong>1 open issue</strong></summary>

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.png" alt="Medium severity" width="62" height="18" align="texttop"></picture> Validate sock_impl_options before applying SSL defaults · New

  • </details>

    <sub>Review effort: Balanced</sub>

    gbregman gbregman commented on code on Oct 25, 2026 14:34 UTC
    Code Review
    control/server.py:1
    @@ -874,17 +877,33 @@ def _initialize_iobuf_options(self, options):
                 self.spdk_rpc_client.iobuf_set_options(**args)
             except Exception:
                 self.logger.exception("IObuf set options returned with error")
    -            pass
     
    -    def _set_num_ssl_tickets(self, tickets_number=0):
    -        """Set SSL tickets number for ssl socket implementation."""
    +    def _initialize_sock_impl_options(self, options):
    +        """Initialize socket implmentation options."""
     
    -        try:
    -            self.spdk_rpc_client.sock_impl_set_options(impl_name="ssl",
    -                                                       ssl_tickets_number=tickets_number)
    -        except Exception:
    -            self.logger.exception("sock_impl_set_options returned with error")
    -            pass
    +        args = {}
    +        self.logger.debug(f"initialize_sock_impl_options: options: {options}")
    +
    +        if options:
    +            try:
    +                args.update(json.loads(options))
    +            except json.decoder.JSONDecodeError:
    +                self.logger.exception(f"Failed to parse spdk sock_impl_options ({options})")
    +                return

    changed

    Copilot Copilot commented on code on Oct 25, 2026 15:39 UTC
    Code Review
    tests/test_sock_options.py:1
    @@ -0,0 +1,93 @@
    +import pytest
    +from control.server import GatewayServer
    +from control.cephutils import CephUtils
    +import grpc
    +import copy
    +import os
    +
    +subsystem1 = "nqn.2016-06.io.spdk:cnode1"
    +config = "ceph-nvmeof.conf"
    +pool = "rbd"
    +group_name = "GROUPNAME"
    +
    +
    +@pytest.fixture(scope="module")
    +def tw_gateways(config):
    +    """Sets up and tears down two Gateways"""
    +
    +    nameA = "GatewayAA"
    +    nameB = "GatewayBB"
    +    sockA = f"spdk_{nameA}.sock"
    +    sockB = f"spdk_{nameB}.sock"
    +    config.config["gateway"]["group"] = group_name
    +    config.config["gateway-logs"]["log_level"] = "debug"
    +    addr = config.get("gateway", "addr")
    +    configA = copy.deepcopy(config)
    +    configB = copy.deepcopy(config)
    +    configA.config["spdk"]["sock_impl_options"] = '{"ssl": {"recv_buf_size": 1048576, ' \
    +                                                  '"send_buf_size": 1048576, ' \
    +                                                  '"ssl_tickets_number": 5}, "posix": ' \
    +                                                  '{"recv_buf_size": 1572864, ' \
    +                                                  '"send_buf_size": 1572864}}'
    +    configB.config["spdk"]["sock_impl_options"] = '{"ssl": "stam"}'
    +    configA.config["gateway"]["name"] = nameA
    +    configA.config["gateway"]["override_hostname"] = nameA
    +    configA.config["spdk"]["rpc_socket_name"] = sockA
    +    if os.cpu_count() >= 4:
    +        configA.config["spdk"]["tgt_cmd_extra_args"] = "--lcores (0-1)"
    +    else:
    +        configA.config["spdk"]["tgt_cmd_extra_args"] = "--disable-cpumask-locks"
    +    portA = configA.getint("gateway", "port")
    +    configB.config["gateway"]["name"] = nameB
    +    configB.config["gateway"]["override_hostname"] = nameB
    +    configB.config["spdk"]["rpc_socket_name"] = sockB
    +    portB = portA + 2
    +    discPortB = configB.getint("discovery", "port") + 1
    +    configB.config["gateway"]["port"] = str(portB)
    +    configB.config["discovery"]["port"] = str(discPortB)
    +    if os.cpu_count() >= 4:
    +        configB.config["spdk"]["tgt_cmd_extra_args"] = "--lcores (2-3)"
    +    else:
    +        configB.config["spdk"]["tgt_cmd_extra_args"] = "--disable-cpumask-locks"
    +    ceph_utils = CephUtils(config)
    +    gatewayA = GatewayServer(configA)
    +    gatewayB = GatewayServer(configB)
    +    ceph_utils.execute_ceph_monitor_command(
    +        "{" + f'"prefix":"nvme-gw create", "id": "{nameA}", "pool": "{pool}", '
    +        f'"group": "{group_name}"' + "}"
    +    )
    +    ceph_utils.execute_ceph_monitor_command(
    +        "{" + f'"prefix":"nvme-gw create", "id": "{nameB}", "pool": "{pool}", '
    +        f'"group": "{group_name}"' + "}"
    +    )
    +
    +    gatewayA.serve()
    +    gatewayB.serve()
    +
    +    channelA = grpc.insecure_channel(f"{addr}:{portA}")
    +    channelB = grpc.insecure_channel(f"{addr}:{portB}")

    [P1] Both channel variables are assigned but never read, so Flake8 reports F841. The build job runs make verify, which includes tests/*.py, before building the containers; these assignments therefore block the build and dependent test jobs. Remove the unused channel setup, along with the now-unneeded grpc import and addr lookup.

    Copilot Copilot commented on code on Oct 25, 2026 15:39 UTC
    Code Review
    tests/test_sock_options.py:1
    @@ -0,0 +1,93 @@
    +import pytest
    +from control.server import GatewayServer
    +from control.cephutils import CephUtils
    +import grpc
    +import copy
    +import os
    +
    +subsystem1 = "nqn.2016-06.io.spdk:cnode1"
    +config = "ceph-nvmeof.conf"
    +pool = "rbd"
    +group_name = "GROUPNAME"
    +
    +
    +@pytest.fixture(scope="module")
    +def tw_gateways(config):
    +    """Sets up and tears down two Gateways"""
    +
    +    nameA = "GatewayAA"
    +    nameB = "GatewayBB"
    +    sockA = f"spdk_{nameA}.sock"
    +    sockB = f"spdk_{nameB}.sock"
    +    config.config["gateway"]["group"] = group_name
    +    config.config["gateway-logs"]["log_level"] = "debug"
    +    addr = config.get("gateway", "addr")
    +    configA = copy.deepcopy(config)
    +    configB = copy.deepcopy(config)
    +    configA.config["spdk"]["sock_impl_options"] = '{"ssl": {"recv_buf_size": 1048576, ' \
    +                                                  '"send_buf_size": 1048576, ' \
    +                                                  '"ssl_tickets_number": 5}, "posix": ' \
    +                                                  '{"recv_buf_size": 1572864, ' \
    +                                                  '"send_buf_size": 1572864}}'
    +    configB.config["spdk"]["sock_impl_options"] = '{"ssl": "stam"}'
    +    configA.config["gateway"]["name"] = nameA
    +    configA.config["gateway"]["override_hostname"] = nameA
    +    configA.config["spdk"]["rpc_socket_name"] = sockA
    +    if os.cpu_count() >= 4:
    +        configA.config["spdk"]["tgt_cmd_extra_args"] = "--lcores (0-1)"
    +    else:
    +        configA.config["spdk"]["tgt_cmd_extra_args"] = "--disable-cpumask-locks"
    +    portA = configA.getint("gateway", "port")
    +    configB.config["gateway"]["name"] = nameB
    +    configB.config["gateway"]["override_hostname"] = nameB
    +    configB.config["spdk"]["rpc_socket_name"] = sockB
    +    portB = portA + 2
    +    discPortB = configB.getint("discovery", "port") + 1
    +    configB.config["gateway"]["port"] = str(portB)
    +    configB.config["discovery"]["port"] = str(discPortB)
    +    if os.cpu_count() >= 4:
    +        configB.config["spdk"]["tgt_cmd_extra_args"] = "--lcores (2-3)"
    +    else:
    +        configB.config["spdk"]["tgt_cmd_extra_args"] = "--disable-cpumask-locks"
    +    ceph_utils = CephUtils(config)
    +    gatewayA = GatewayServer(configA)
    +    gatewayB = GatewayServer(configB)
    +    ceph_utils.execute_ceph_monitor_command(
    +        "{" + f'"prefix":"nvme-gw create", "id": "{nameA}", "pool": "{pool}", '
    +        f'"group": "{group_name}"' + "}"
    +    )
    +    ceph_utils.execute_ceph_monitor_command(
    +        "{" + f'"prefix":"nvme-gw create", "id": "{nameB}", "pool": "{pool}", '
    +        f'"group": "{group_name}"' + "}"
    +    )
    +
    +    gatewayA.serve()
    +    gatewayB.serve()
    +
    +    channelA = grpc.insecure_channel(f"{addr}:{portA}")
    +    channelB = grpc.insecure_channel(f"{addr}:{portB}")
    +
    +    return gatewayA.gateway_rpc, gatewayB.gateway_rpc

    [P2] Returning here leaves both gateways running because the fixture never invokes GatewayServer.__exit__ to release their processes, listeners, and OMAP resources. Subsequent modules in the same pytest process can encounter occupied ports and sockets. Wrap both gateways in context managers and yield their RPC objects, as in tests/test_multi_gateway.py:47–67, so cleanup also runs when an assertion or startup fails.

    copilot-pull-request-reviewer[bot] copilot-pull-request-reviewer[bot] commented on Oct 25, 2026 15:39 UTC
    Reviewer

    <!-- ccr-overview-v2 -->

    🟡 Changes recommended

    The new test fixture introduces CI-blocking unused variables and leaves gateway resources running without teardown.

    <details open>
    <summary><strong>2 open issues</strong></summary>

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-light.png" alt="High severity" width="62" height="18" align="texttop"></picture> Remove unused channel setup causing Flake8 F841 failures · New

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.png" alt="Medium severity" width="62" height="18" align="texttop"></picture> Use gateway context managers to ensure fixture cleanup · New

  • </details>

    <details>
    <summary><strong>1 resolved since last review</strong></summary>

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.png" alt="Medium severity" width="62" height="18" align="texttop"></picture> Validate sock_impl_options before applying SSL defaults

  • </details>

    <sub>Review effort: Balanced</sub>

    gbregman gbregman commented on code on Oct 25, 2026 15:45 UTC
    Code Review
    tests/test_sock_options.py:1
    @@ -0,0 +1,93 @@
    +import pytest
    +from control.server import GatewayServer
    +from control.cephutils import CephUtils
    +import grpc
    +import copy
    +import os
    +
    +subsystem1 = "nqn.2016-06.io.spdk:cnode1"
    +config = "ceph-nvmeof.conf"
    +pool = "rbd"
    +group_name = "GROUPNAME"
    +
    +
    +@pytest.fixture(scope="module")
    +def tw_gateways(config):
    +    """Sets up and tears down two Gateways"""
    +
    +    nameA = "GatewayAA"
    +    nameB = "GatewayBB"
    +    sockA = f"spdk_{nameA}.sock"
    +    sockB = f"spdk_{nameB}.sock"
    +    config.config["gateway"]["group"] = group_name
    +    config.config["gateway-logs"]["log_level"] = "debug"
    +    addr = config.get("gateway", "addr")
    +    configA = copy.deepcopy(config)
    +    configB = copy.deepcopy(config)
    +    configA.config["spdk"]["sock_impl_options"] = '{"ssl": {"recv_buf_size": 1048576, ' \
    +                                                  '"send_buf_size": 1048576, ' \
    +                                                  '"ssl_tickets_number": 5}, "posix": ' \
    +                                                  '{"recv_buf_size": 1572864, ' \
    +                                                  '"send_buf_size": 1572864}}'
    +    configB.config["spdk"]["sock_impl_options"] = '{"ssl": "stam"}'
    +    configA.config["gateway"]["name"] = nameA
    +    configA.config["gateway"]["override_hostname"] = nameA
    +    configA.config["spdk"]["rpc_socket_name"] = sockA
    +    if os.cpu_count() >= 4:
    +        configA.config["spdk"]["tgt_cmd_extra_args"] = "--lcores (0-1)"
    +    else:
    +        configA.config["spdk"]["tgt_cmd_extra_args"] = "--disable-cpumask-locks"
    +    portA = configA.getint("gateway", "port")
    +    configB.config["gateway"]["name"] = nameB
    +    configB.config["gateway"]["override_hostname"] = nameB
    +    configB.config["spdk"]["rpc_socket_name"] = sockB
    +    portB = portA + 2
    +    discPortB = configB.getint("discovery", "port") + 1
    +    configB.config["gateway"]["port"] = str(portB)
    +    configB.config["discovery"]["port"] = str(discPortB)
    +    if os.cpu_count() >= 4:
    +        configB.config["spdk"]["tgt_cmd_extra_args"] = "--lcores (2-3)"
    +    else:
    +        configB.config["spdk"]["tgt_cmd_extra_args"] = "--disable-cpumask-locks"
    +    ceph_utils = CephUtils(config)
    +    gatewayA = GatewayServer(configA)
    +    gatewayB = GatewayServer(configB)
    +    ceph_utils.execute_ceph_monitor_command(
    +        "{" + f'"prefix":"nvme-gw create", "id": "{nameA}", "pool": "{pool}", '
    +        f'"group": "{group_name}"' + "}"
    +    )
    +    ceph_utils.execute_ceph_monitor_command(
    +        "{" + f'"prefix":"nvme-gw create", "id": "{nameB}", "pool": "{pool}", '
    +        f'"group": "{group_name}"' + "}"
    +    )
    +
    +    gatewayA.serve()
    +    gatewayB.serve()
    +
    +    channelA = grpc.insecure_channel(f"{addr}:{portA}")
    +    channelB = grpc.insecure_channel(f"{addr}:{portB}")

    changed

    gbregman gbregman commented on code on Oct 25, 2026 15:52 UTC
    Code Review
    tests/test_sock_options.py:1
    @@ -0,0 +1,93 @@
    +import pytest
    +from control.server import GatewayServer
    +from control.cephutils import CephUtils
    +import grpc
    +import copy
    +import os
    +
    +subsystem1 = "nqn.2016-06.io.spdk:cnode1"
    +config = "ceph-nvmeof.conf"
    +pool = "rbd"
    +group_name = "GROUPNAME"
    +
    +
    +@pytest.fixture(scope="module")
    +def tw_gateways(config):
    +    """Sets up and tears down two Gateways"""
    +
    +    nameA = "GatewayAA"
    +    nameB = "GatewayBB"
    +    sockA = f"spdk_{nameA}.sock"
    +    sockB = f"spdk_{nameB}.sock"
    +    config.config["gateway"]["group"] = group_name
    +    config.config["gateway-logs"]["log_level"] = "debug"
    +    addr = config.get("gateway", "addr")
    +    configA = copy.deepcopy(config)
    +    configB = copy.deepcopy(config)
    +    configA.config["spdk"]["sock_impl_options"] = '{"ssl": {"recv_buf_size": 1048576, ' \
    +                                                  '"send_buf_size": 1048576, ' \
    +                                                  '"ssl_tickets_number": 5}, "posix": ' \
    +                                                  '{"recv_buf_size": 1572864, ' \
    +                                                  '"send_buf_size": 1572864}}'
    +    configB.config["spdk"]["sock_impl_options"] = '{"ssl": "stam"}'
    +    configA.config["gateway"]["name"] = nameA
    +    configA.config["gateway"]["override_hostname"] = nameA
    +    configA.config["spdk"]["rpc_socket_name"] = sockA
    +    if os.cpu_count() >= 4:
    +        configA.config["spdk"]["tgt_cmd_extra_args"] = "--lcores (0-1)"
    +    else:
    +        configA.config["spdk"]["tgt_cmd_extra_args"] = "--disable-cpumask-locks"
    +    portA = configA.getint("gateway", "port")
    +    configB.config["gateway"]["name"] = nameB
    +    configB.config["gateway"]["override_hostname"] = nameB
    +    configB.config["spdk"]["rpc_socket_name"] = sockB
    +    portB = portA + 2
    +    discPortB = configB.getint("discovery", "port") + 1
    +    configB.config["gateway"]["port"] = str(portB)
    +    configB.config["discovery"]["port"] = str(discPortB)
    +    if os.cpu_count() >= 4:
    +        configB.config["spdk"]["tgt_cmd_extra_args"] = "--lcores (2-3)"
    +    else:
    +        configB.config["spdk"]["tgt_cmd_extra_args"] = "--disable-cpumask-locks"
    +    ceph_utils = CephUtils(config)
    +    gatewayA = GatewayServer(configA)
    +    gatewayB = GatewayServer(configB)
    +    ceph_utils.execute_ceph_monitor_command(
    +        "{" + f'"prefix":"nvme-gw create", "id": "{nameA}", "pool": "{pool}", '
    +        f'"group": "{group_name}"' + "}"
    +    )
    +    ceph_utils.execute_ceph_monitor_command(
    +        "{" + f'"prefix":"nvme-gw create", "id": "{nameB}", "pool": "{pool}", '
    +        f'"group": "{group_name}"' + "}"
    +    )
    +
    +    gatewayA.serve()
    +    gatewayB.serve()
    +
    +    channelA = grpc.insecure_channel(f"{addr}:{portA}")
    +    channelB = grpc.insecure_channel(f"{addr}:{portB}")
    +
    +    return gatewayA.gateway_rpc, gatewayB.gateway_rpc

    changed

    Copilot Copilot commented on code on Oct 25, 2026 15:53 UTC
    Code Review
    control/server.py:1
    @@ -874,17 +877,37 @@ def _initialize_iobuf_options(self, options):
                 self.spdk_rpc_client.iobuf_set_options(**args)
             except Exception:
                 self.logger.exception("IObuf set options returned with error")
    -            pass
     
    -    def _set_num_ssl_tickets(self, tickets_number=0):
    -        """Set SSL tickets number for ssl socket implementation."""
    +    def _initialize_sock_impl_options(self, options):
    +        """Initialize socket implmentation options."""

    The docstring misspells “implementation” as “implmentation”.

    copilot-pull-request-reviewer[bot] copilot-pull-request-reviewer[bot] commented on Oct 25, 2026 15:53 UTC
    Reviewer

    <!-- ccr-overview-v2 -->

    🟢 Approval recommended

    No blocking issues remain; the only retained feedback is a minor docstring typo.

    <details open>
    <summary><strong>1 open issue</strong></summary>

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.png" alt="Low severity" width="62" height="18" align="texttop"></picture> Fix implementation spelling in docstring · New

  • </details>

    <details>
    <summary><strong>2 resolved since last review</strong></summary>

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/high-v2-light.png" alt="High severity" width="62" height="18" align="texttop"></picture> Remove unused channel setup causing Flake8 F841 failures

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.png" alt="Medium severity" width="62" height="18" align="texttop"></picture> Use gateway context managers to ensure fixture cleanup

  • </details>

    <sub>Review effort: Balanced</sub>

    gbregman gbregman commented on code on Oct 25, 2026 16:08 UTC
    Code Review
    control/server.py:1
    @@ -874,17 +877,37 @@ def _initialize_iobuf_options(self, options):
                 self.spdk_rpc_client.iobuf_set_options(**args)
             except Exception:
                 self.logger.exception("IObuf set options returned with error")
    -            pass
     
    -    def _set_num_ssl_tickets(self, tickets_number=0):
    -        """Set SSL tickets number for ssl socket implementation."""
    +    def _initialize_sock_impl_options(self, options):
    +        """Initialize socket implmentation options."""

    changed

    Copilot Copilot commented on code on Oct 25, 2026 16:11 UTC
    Code Review
    control/server.py:1
    @@ -874,17 +877,37 @@ def _initialize_iobuf_options(self, options):
                 self.spdk_rpc_client.iobuf_set_options(**args)
             except Exception:
                 self.logger.exception("IObuf set options returned with error")
    -            pass
     
    -    def _set_num_ssl_tickets(self, tickets_number=0):
    -        """Set SSL tickets number for ssl socket implementation."""
    +    def _initialize_sock_impl_options(self, options):
    +        """Initialize socket implementation options."""
     
    -        try:
    -            self.spdk_rpc_client.sock_impl_set_options(impl_name="ssl",
    -                                                       ssl_tickets_number=tickets_number)
    -        except Exception:
    -            self.logger.exception("sock_impl_set_options returned with error")
    -            pass
    +        args = {}
    +        self.logger.debug(f"initialize_sock_impl_options: options: {options}")
    +
    +        if options:
    +            try:
    +                parsed_options = json.loads(options)
    +                if not isinstance(parsed_options, dict) or any(
    +                        not isinstance(vals, dict) for vals in parsed_options.values()):
    +                    raise ValueError("Socket implementation options must be JSON objects")
    +                args.update(parsed_options)
    +            except Exception:
    +                self.logger.exception(f"Failed to parse spdk sock_impl_options ({options})")
    +                args = {}
    +
    +        ssl_arg = args.get("ssl")
    +        if not ssl_arg:
    +            args["ssl"] = {"ssl_tickets_number": 0}
    +        elif not ssl_arg.get("ssl_tickets_number"):
    +            ssl_arg["ssl_tickets_number"] = 0

    [P2] A structurally valid configuration with an unsupported SSL option can fail at sock_impl_set_options, also preventing the bundled ssl_tickets_number=0 from being applied. Startup then continues without the previous zero-ticket initialization. Set the baseline ticket count separately before applying configured options so rejected options cannot bypass it and valid explicit ticket counts still take precedence.

    copilot-pull-request-reviewer[bot] copilot-pull-request-reviewer[bot] commented on Oct 25, 2026 16:11 UTC
    Reviewer

    <!-- ccr-overview-v2 -->

    🟡 Changes recommended

    Rejected SSL options can prevent the zero-ticket baseline from being applied while startup continues.

    <details open>
    <summary><strong>1 open issue</strong></summary>

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.png" alt="Medium severity" width="62" height="18" align="texttop"></picture> Apply baseline SSL ticket count before configured options · New

  • </details>

    <details>
    <summary><strong>1 resolved since last review</strong></summary>

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.png" alt="Low severity" width="62" height="18" align="texttop"></picture> Fix implementation spelling in docstring

  • </details>

    <sub>Review effort: Balanced</sub>

    gbregman gbregman commented on code on Oct 25, 2026 16:33 UTC
    Code Review
    control/server.py:1
    @@ -874,17 +877,37 @@ def _initialize_iobuf_options(self, options):
                 self.spdk_rpc_client.iobuf_set_options(**args)
             except Exception:
                 self.logger.exception("IObuf set options returned with error")
    -            pass
     
    -    def _set_num_ssl_tickets(self, tickets_number=0):
    -        """Set SSL tickets number for ssl socket implementation."""
    +    def _initialize_sock_impl_options(self, options):
    +        """Initialize socket implementation options."""
     
    -        try:
    -            self.spdk_rpc_client.sock_impl_set_options(impl_name="ssl",
    -                                                       ssl_tickets_number=tickets_number)
    -        except Exception:
    -            self.logger.exception("sock_impl_set_options returned with error")
    -            pass
    +        args = {}
    +        self.logger.debug(f"initialize_sock_impl_options: options: {options}")
    +
    +        if options:
    +            try:
    +                parsed_options = json.loads(options)
    +                if not isinstance(parsed_options, dict) or any(
    +                        not isinstance(vals, dict) for vals in parsed_options.values()):
    +                    raise ValueError("Socket implementation options must be JSON objects")
    +                args.update(parsed_options)
    +            except Exception:
    +                self.logger.exception(f"Failed to parse spdk sock_impl_options ({options})")
    +                args = {}
    +
    +        ssl_arg = args.get("ssl")
    +        if not ssl_arg:
    +            args["ssl"] = {"ssl_tickets_number": 0}
    +        elif not ssl_arg.get("ssl_tickets_number"):
    +            ssl_arg["ssl_tickets_number"] = 0

    changed

    copilot-pull-request-reviewer[bot] copilot-pull-request-reviewer[bot] commented on Oct 25, 2026 16:36 UTC
    Reviewer

    Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

    An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

    Reviewers
    Assignees
    gbregman gbregman
    Labels
    risk: low confidence: 89.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 36.6% (MEDIUM) · Higher = larger blast radius
    36.6%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 89.8% · Lower = rushed or shallow review
    89.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 3.7% · Safe to merge
    3.7%