fix: remove lvol subsystem from tertiary and secondary nodes first - #1050
Merged
Conversation
…ing in lvol deletion
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>
| 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix: remove lvol subsystem from tertiary and secondary nodes first thing in lvol deletion