Skip to content

s3lvol: rename COS to S3, add MinIO support, portable ISA and py3.8 RPC client - #1524

Merged
fslongjin merged 1 commit into
TencentCloud:masterfrom
fslongjin:refactor/s3vol-cos-rename-to-s3-and-add-minio-intergration
Aug 26, 2026
Merged

s3lvol: rename COS to S3, add MinIO support, portable ISA and py3.8 RPC client#1524
fslongjin merged 1 commit into
TencentCloud:masterfrom
fslongjin:refactor/s3vol-cos-rename-to-s3-and-add-minio-intergration

Conversation

@fslongjin

Copy link
Copy Markdown
Member

Summary

Rename the s3lvol backend from Tencent COS to generic S3 and add first-class MinIO support, across the target, scripts, tests and deploy tooling.

Highlights

  • COS → S3 config: the per-node config moves from cos.cfg to s3.cfg with S3-style field names (access_key_id, secret_access_key, endpoint, buckets, path_style, no_tls). There is no fallback from the old file or the old keys. The rcow_add_cos_config RPC is renamed to rcow_add_s3_config.
  • MinIO support: path_style / no_tls flags are threaded through the startup scripts, the purge path and an address-flags helper, so a path-style plain-HTTP backend works out of the box.
  • Ensure-bucket tool: a stdlib SigV4 s3_bucket.py creates/confirms the dedicated s3lvol bucket (kept separate from the volume plugin's) before rcow_start.sh; no awscli or boto3 needed.
  • CPU-portable releases: SPDK is built with --target-arch=haswell (x86_64) / armv8.2-a+crypto (aarch64) instead of native; make_release.sh refuses to package a native tree, and the one-click preflight checks for AVX2.
  • Python 3.8 RPC client: a rpc.py launcher plus rpc_compat.py backfills argparse.BooleanOptionalAction so SPDK's unmodified client runs on Ubuntu 20.04; SPDK's own rpc.py ships as spdk_rpc.py.
  • One-click deploy: install.sh renders s3.cfg from CUBE_S3_*, installs nvme-cli when missing, validates the packaged RPC client, and the supervisor preserves rcow_start's exit status so systemd Restart=on-failure retries.

Tests

  • New offline suites: ISA baseline (test_isa_baseline.sh) and rpc.py py3.8 compat (test_rpc_py38_compat.sh), plus the s3_bucket.py self-test, all wired into run_all.sh.
  • Extended test_minio_s3_guard.sh (s3.cfg rendering, bucket separation, nvme-cli installer, RPC client validation, supervisor exit code) and test_package_layout.sh (packaged bucket tool and RPC launcher).

Comment thread CubeS3lvol/mk/s3lvol_isa_gate.sh
Comment thread Makefile
@cubesandboxbot

cubesandboxbot Bot commented Aug 26, 2026

Copy link
Copy Markdown

Review: s3lvol COS→S3 rename, MinIO support, portable ISA, py3.8 RPC client (PR #1524)

AI-generated review. Reviewed against the base branch (master) using the PR diff and the local base-branch workspace. No live test run was performed.

Verdict

Approve. This is a large PR (1398+/219−, 37 files) but internally consistent: the COS→S3 rename is complete, the new S3/MinIO wiring is correct, the Python 3.8 RPC launcher is a sound design, and the accompanying tests genuinely exercise the new code paths. I found no correctness bugs. Three low-severity observations follow.

What I verified

  • Rename completeness. Every cos.cfg / RCOW_COS_CFG / cos_endpoint / cos_bucket_name / secretid / secretkey / rcow_add_cos_config reference is converted in the diff; no stale additions remain. The module's rcow_add_s3_config RPC, struct, decoders, handler and SPDK_RPC_REGISTER are renamed coherently, and the scripts/tests that call it are updated in lockstep.
  • Supervisor exit-code fix is a real fix. The base if ! "${RCOW_START}"; then rc=$? captures the negated status (always 0), so systemd Restart=on-failure never retried. The new rc=0; "${RCOW_START}" || rc=$? is correct, and test_supervise_preserves_rcow_start_exit_code guards it.
  • rcow_s3_addr_flags eval is guarded. The identifier whitelist (''|*[!A-Za-z0-9_]*|[0-9]*) plus fixed eval strings make the eval safe for the intended callers; every call site passes a hardcoded identifier and pre-initializes the array (so set -u is satisfied). The three expansion sites in rcow_purge.sh match the grep -c assertion in the test.
  • Python 3.8 launcher works. argparse does not pass nargs/const to a custom Action class unless the caller supplied them explicitly (the store_true/store_const built-ins are proof), so rpc_compat.py's __init__ signature is sufficient. runpy.run_path(..., run_name='__main__') preserves sys.argv and stdin, so -s/-t arguments and batch-mode stdin both pass through. The launcher's search order mirrors rcow_common.sh's own SPDK_ROOT fallback chain, so the two stay consistent.
  • s3_bucket.py SigV4 is correct. Canonical request shape, header ordering (host < x-amz-content-sha256 < x-amz-date), path-style vs virtual-hosted addressing, the us-east-1 LocationConstraint omission, and default HTTPS certificate verification are all right. Treating HEAD 403 as "bucket exists" is a safe heuristic here because the caller treats failure as non-fatal.
  • ISA gate. The haswell/armv8.2-a+crypto pin and the native-refusal already existed in the base (setup_dep.sh / mk/s3lvol_isa_gate.sh / make_release.sh); the PR documents it and adds the AVX2 preflight plus tests. The hardcoded "14 passed" matches the 14 checks in test_isa_baseline.sh.
  • One-click s3.cfg generation. The sentinel check correctly preserves hand-written files; quote rejection, endpoint scheme-stripping, and the path_style/no_tls derivation all match rcow_cfg_get / rcow_s3_buckets parsing.

Findings (low severity)

  1. Repo-layout preflight no longer verifies the upstream SPDK rpc.py exists (CubeS3lvol/scripts/rcow_common.sh). Pointing RCOW_SPDK_RPC_PY at the always-present launcher means rcow_start.sh's [ -x "${RCOW_SPDK_RPC_PY}" ] passes even when SPDK_ROOT is wrong and no fallback exists; the failure then surfaces only on the first RPC call, i.e. up to ~60 s into rcow_wait_rpc (after the target has already been started and will be torn down). The new rcow_wait_rpc last-error capture does report the launcher's clear "cannot find SPDK rpc.py" message at that point, so this is a fail-fast regression with a much better late error. Consider a preflight that proves the launcher resolves its upstream (e.g. run the launcher with --help, like validate_s3lvol_rpc_client does for the package).
  2. Dataplane test scripts bypass the py3.8 launcher (CubeS3lvol/test/dataplane/*.sh). They still invoke ${SPDK_ROOT}/scripts/rpc.py directly, so on Python 3.8 — the exact platform this PR enables — they would hit the BooleanOptionalAction error the launcher fixes. Not currently breaking (the tests run on the dev/CI host, which is 3.9+), but the runtime scripts and the test scripts now use different RPC entry points.
  3. Nit: cos_config.err log filenames are retained in several dataplane tests after the rename. Cosmetic.

Notes

  • This is an intentional breaking change: the config file and every key are renamed with no fallback, and the rcow_add_cos_config RPC is renamed rcow_add_s3_config. The target binary, the scripts, and the config must upgrade together — an old target with new scripts (or vice versa) fails loudly. The README / env.example document this clearly.
  • The supervise bucket-ensure is correctly non-fatal and runs before rcow_start.sh, matching the "HEAD 403 = exists, MinIO still coming up" retry model.

@fslongjin
fslongjin force-pushed the refactor/s3vol-cos-rename-to-s3-and-add-minio-intergration branch from e51f53f to fd9e173 Compare August 26, 2026 08:18
Comment thread deploy/one-click/lib/common.sh
Comment thread CubeS3lvol/test/tools/s3_bucket.py
@fslongjin
fslongjin force-pushed the refactor/s3vol-cos-rename-to-s3-and-add-minio-intergration branch from fd9e173 to 4545202 Compare August 26, 2026 09:20
Comment thread deploy/one-click/tests/test_minio_s3_guard.sh
Comment thread CubeS3lvol/scripts/rcow_common.sh
@fslongjin
fslongjin force-pushed the refactor/s3vol-cos-rename-to-s3-and-add-minio-intergration branch from 4545202 to 0308b5b Compare August 26, 2026 09:55
Comment thread deploy/one-click/tests/test_minio_s3_guard.sh
Comment thread CubeS3lvol/scripts/rcow_common.sh
@fslongjin

Copy link
Copy Markdown
Member Author

On review finding 3 (ensure_nvme_cli / apt-get update -qq with no || die): install.sh is set -e, so a failed apt-get update already aborts the install — the gap is only a contextual die around apt's raw stderr. The same bare apt-get update -qq is used in install_docker(). Not changing that in this PR; follow-up.

…PC client

Rename the s3lvol backend from Tencent COS to generic S3 across the
target, scripts, tests and deploy tooling, and add first-class MinIO
support:

- Config moves from /data/cubelet/cos.cfg to s3.cfg with S3 field names
  (access_key_id / secret_access_key / endpoint / buckets / path_style /
  no_tls). There is no fallback from the old file or the old keys.
- rcow_add_cos_config becomes rcow_add_s3_config.
- path_style / no_tls flags are threaded through the startup scripts,
  the purge path and an address-flags helper so a path-style plain-HTTP
  backend (MinIO in CI) works.

Ship a stdlib SigV4 ensure-bucket tool (s3_bucket.py) and use it in the
one-click supervisor before rcow_start.sh; the bucket is dedicated to
s3lvol so it never shares prefixes with the volume plugin.

Make release binaries CPU-portable: SPDK builds with --target-arch=haswell
(x86_64) or armv8.2-a+crypto (aarch64) instead of native, and
make_release.sh refuses to package a native tree (mk/s3lvol_isa_gate.sh).
The one-click preflight now checks for avx2.

Ship an rpc.py launcher (scripts/rpc.py + rpc_compat.py) that backfills
argparse.BooleanOptionalAction so SPDK's unmodified client runs on Python
3.8 (Ubuntu 20.04); SPDK's rpc.py is packaged as scripts/spdk_rpc.py.

One-click: install.sh renders s3.cfg from CUBE_S3_*, installs nvme-cli
when missing, validates the packaged RPC client, and the supervisor
preserves rcow_start's exit status so systemd Restart=on-failure retries.

Tests: add offline ISA baseline and rpc.py py3.8 compat suites, extend
the MinIO S3 guard and package layout tests, and wire the offline tools
into run_all.sh.

Signed-off-by: jinlong <jinlong@tencent.com>
@fslongjin
fslongjin force-pushed the refactor/s3vol-cos-rename-to-s3-and-add-minio-intergration branch from 0308b5b to a297d0a Compare August 26, 2026 11:59
@fslongjin
fslongjin merged commit f323ee1 into TencentCloud:master Aug 26, 2026
5 checks passed
RCOW_SPDK_RPC_PY="${RCOW_SPDK_RPC_PY:-${SPDK_ROOT}/scripts/rpc.py}"
# Same launcher as the package: it applies the 3.8 argparse shim and
# then runs $SPDK_ROOT/scripts/rpc.py. Calling the SPDK file directly
# would blow up on Ubuntu 20.04 (no BooleanOptionalAction).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low-severity observation: pointing RCOW_SPDK_RPC_PY at the always-present launcher changes the failure behavior of rcow_start.sh's preflight [ -x "${RCOW_SPDK_RPC_PY}" ]. That check now passes even when SPDK_ROOT is wrong and no fallback exists, so the problem surfaces only on the first rcow_srpc call — i.e. after the target is already started and rcow_wait_rpc polls for up to 60 s before bail tears it down. The new rcow_wait_rpc last-error capture does surface the launcher's clear "cannot find SPDK rpc.py" message at that point (better than the old silent timeout), but the fail-fast preflight is gone. A preflight that proves the launcher resolves its upstream — e.g. run it with --help, as validate_s3lvol_rpc_client already does for the package — would close the gap.

TGT="${ROOT}/app/s3lvol_tgt/s3lvol_tgt"
COS_CFG="${RCOW_COS_CFG:-/data/cubelet/cos.cfg}"
S3_CFG="${RCOW_S3_CFG:-/data/cubelet/s3.cfg}"
ACTIVE_FILE=/data/cubelet/rcow/active_lvols

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low-severity consistency note: this file (like the other test/dataplane/*.sh scripts) still invokes ${SPDK_ROOT}/scripts/rpc.py directly, so it bypasses the new scripts/rpc.py launcher. On Python 3.8 — the exact platform this PR makes the deployment support — that direct call hits the argparse.BooleanOptionalAction error the launcher was added to fix, so the dataplane suite would break on a 20.04 host even though the runtime scripts are 3.8-safe. Not currently breaking (the tests run on the dev/CI host, which is 3.9+), but the runtime and test paths now use different RPC entry points. Consider having these scripts resolve SPDK_RPC_PY through rcow_common.sh (or RCOW_SPDK_RPC_PY) so both stay in sync.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant