Skip to content

fix: remove lvol subsystem from tertiary and secondary nodes first - #1050

Merged
schmidt-scaled merged 4 commits into
mainfrom
main-subsys-del
May 21, 2026
Merged

fix: remove lvol subsystem from tertiary and secondary nodes first #1050
schmidt-scaled merged 4 commits into
mainfrom
main-subsys-del

Conversation

@Hamdy-khader

Copy link
Copy Markdown
Collaborator

fix: remove lvol subsystem from tertiary and secondary nodes first thing in lvol deletion

schmidt-scaled and others added 2 commits May 21, 2026 15:48
Per PR review, the HA-lvol pre-leader subsystem-delete phase now walks
the fixed role order tertiary -> secondary -> primary, skipping any role
whose node status is not STATUS_ONLINE (down / in_restart / unreachable
/ etc). Exactly one time.sleep(2) lands after the primary's subsystem
delete and before execute_on_leader_with_failover, giving multipath
clients a drain window before the leader's bdev stack is removed. The
sleep is suppressed when the primary subsystem delete is skipped, since
there is nothing to drain.

Refactoring:
- _remove_lvol_subsys_from_node now takes an rpc_client (caller-owned)
  and returns bool, so callers can choose their own timeout/retry policy
  and react to RPC failures. The pre-leader phase uses (timeout=5,
  retry=2) and logs failures without aborting; delete_lvol_from_node
  reuses its existing rpc_client.
- delete_lvol_from_node's inline subsystem block is replaced by a call
  to the helper, removing the duplicate logic.
- Dropped the _is_node_rpc_responsive import; status-based skip is the
  spec'd predicate and avoids a TOCTOU between probe and call.
- Restored PEP-8 parenthesized import style for storage_node_ops.

Tests:
- New tests/test_delete_lvol_subsystem_order.py pins the call order
  across the three peers, the status-based skip for tertiary/secondary
  /primary, the single sleep(2) between primary teardown and leader op,
  the no-sleep-when-primary-skipped case, and the (timeout=5, retry=2)
  rpc_client kwargs.

Motivation: the 2026-05-17 dual-outage soak incident (analysis in
logs-incident-20260517-2110/ANALYSIS.md) showed leader-side bdev
removal racing client traffic, contributing to the cascade.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
These three failures were already present on main-subsys-del before the
HA delete_lvol refactor; CI just surfaced them on the same run. Bundling
the fixes here so the PR can go green.

1. tests/test_subsystem_add_ns_idempotent.py: drop unused MagicMock
   import (ruff F401).
2. simplyblock_core/storage_node_ops.py:304: annotate `attached` as
   `set[str]` so mypy can infer its element type.
3. simplyblock_cli/cli-reference.yaml + cli.py: bring the YAML source of
   truth in line with the deprecation wording for `sn suspend` / `sn
   resume` (added to cli.py by hand in commit aa8c9b2 on main without
   updating the YAML). Regenerated cli.py now matches the YAML — the
   "ensure cli.py is up to date" check will pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment thread simplyblock_cli/cli.py
subcommand = self.add_sub_command(subparser, 'suspend', 'DEPRECATED: the suspension phase was removed from graceful shutdown (it caused writer conflicts on sec/tert lvstores). This command is now a no-op returning success. Use `sn shutdown`.')
subcommand.add_argument('node_id', help='Storage node id', type=str).completer = self._completer_get_sn_list
argument = subcommand.add_argument('--force', help='Force node suspend.', dest='force', action='store_true')
argument = subcommand.add_argument('--force', help='Ignored (kept for backwards compatibility).', dest='force', action='store_true')
Conflict in simplyblock_cli/cli.py: both sides added the deprecation
wording for `sn suspend` / `sn resume`, but main hand-edited cli.py in
multi-line form (aa8c9b2) while this branch updates the YAML source of
truth and regenerates in single-line form. Took the regenerated form
(matches cli-reference.yaml).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@schmidt-scaled
schmidt-scaled merged commit f74cbd5 into main May 21, 2026
8 of 9 checks passed
@schmidt-scaled
schmidt-scaled deleted the main-subsys-del branch May 21, 2026 14:06
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.

2 participants