Skip to content

[linstor] Preserve TCP ports during toggle-disk operations#2292

Draft
kvaps wants to merge 1 commit intocozystack:mainfrom
kvaps:fix/linstor-tcp-port-preservation
Draft

[linstor] Preserve TCP ports during toggle-disk operations#2292
kvaps wants to merge 1 commit intocozystack:mainfrom
kvaps:fix/linstor-tcp-port-preservation

Conversation

@kvaps
Copy link
Copy Markdown
Member

@kvaps kvaps commented Mar 28, 2026

What this PR does

Updates the fix-duplicate-tcp-ports patch to preserve existing TCP ports when DrbdRscData is recreated during toggle-disk operations.

Without this fix, removeLayerData() frees TCP ports from the number pool, and ensureStackDataExists() may allocate different ports. If the satellite misses the update (e.g. due to controller restart), it keeps the old ports while peers receive the new ones, causing DRBD connections to fail with StandAlone state.

The fix adds copyDrbdTcpPortsIfExists() which saves existing TCP ports into the LayerPayload before removeLayerData() deletes them.

Also adds dh_strip_nondeterminism override in Dockerfile to fix build failures on some JAR files.

Upstream: LINBIT/linstor-server#476 (comment)

Release note

```release-note
[linstor] Fix TCP port mismatches after toggle-disk operations that could cause DRBD resources to enter StandAlone state
```

Update fix-duplicate-tcp-ports patch to preserve existing TCP ports when
DrbdRscData is recreated during toggle-disk operations. Without this,
removeLayerData() frees ports and ensureStackDataExists() may allocate
different ones, causing port mismatches between controller and satellites
if the satellite misses the update.

Also add dh_strip_nondeterminism override in Dockerfile to fix build
failures on some JAR files.

Upstream: LINBIT/linstor-server#476 (comment)

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 28, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 77dd5abe-fe2f-483c-a9c1-66d41b5a6f5a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the piraeus-server Dockerfile to skip dh_strip_nondeterminism for JAR files and expands the fix-duplicate-tcp-ports.diff patch to preserve TCP ports during toggle-disk operations. The patch now includes logic to save existing ports to the layer payload before they are recreated, preventing potential connection failures. A review comment suggests using the Java Stream API to simplify the port conversion loop in the patch for better readability.

Comment on lines +112 to +117
+ Set<Integer> portInts = new TreeSet<>();
+ for (TcpPortNumber port : tcpPorts)
+ {
+ portInts.add(port.value);
+ }
+ payload.drbdRsc.tcpPorts = portInts;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This loop to convert the collection of TcpPortNumber to a Set<Integer> can be simplified by using the Java Stream API for a more concise and expressive implementation. This improves readability and maintainability.

                payload.drbdRsc.tcpPorts = tcpPorts.stream()
                    .map(port -> port.value)
                    .collect(java.util.stream.Collectors.toCollection(TreeSet::new));

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