Skip to content

docs(operations): expand LINSTOR DB troubleshooting#552

Open
IvanHunters wants to merge 2 commits into
mainfrom
docs/linstor-database-tcp-port-conflicts
Open

docs(operations): expand LINSTOR DB troubleshooting#552
IvanHunters wants to merge 2 commits into
mainfrom
docs/linstor-database-tcp-port-conflicts

Conversation

@IvanHunters
Copy link
Copy Markdown
Contributor

@IvanHunters IvanHunters commented May 27, 2026

Summary

Extends the LINSTOR CrashLoopBackOff recovery guide (operations/troubleshooting/linstor-database) with diagnosis and recovery procedures for two failure modes that were not previously covered:

  • ValueInUseException: <node>'s TCP port N is already in use — duplicate tcp_port_list records on the same node, often a leftover of a botched toggle-disk operation on LINSTOR ≥ v1.31.2 (tracked upstream in LINBIT/linstor-server#476)
  • did not have tcpPorts stored!LayerDrbdResources records missing the tcp_port_list field, typically a side effect of restoring from a backup taken via an older served apiVersion

Adds a new "CRD API versions and field visibility" section explaining why tcp_port_list and other newer fields are invisible to kubectl get through the default served apiVersion, and adds warning callouts to the existing Backup and analyze and Restore to the original state sections so users take backups via the storage apiVersion.

Includes a DrbdRscFlags bitmask reference table to help interpret spec.flags values during diagnosis.

Applied to both next/ and v1.4/.

Test plan

  • Render docs locally with `make serve` and verify new anchors resolve
  • Verify cross-references between sections (Example 3 ↔ Example 4 ↔ "CRD API versions and field visibility")
  • Check `next/` and `v1.4/` render identically

Summary by CodeRabbit

  • Documentation
    • Added troubleshooting guidance for LINSTOR database inconsistencies and CrashLoopBackOff scenarios.
    • Documented how API-version visibility can hide fields and added warnings to take backups via the storage API version.
    • Added step-by-step examples for diagnosing and resolving TCP port allocation conflicts and missing port fields.
    • Included restore-time warnings and a suggested sanity-check to validate backups before restore.

Review Change Stack

…flicts

Adds diagnosis and recovery procedures for failure modes that were not
previously covered:

- ValueInUseException for duplicate TCP ports on a node (LINBIT/linstor-server#476)
- 'did not have tcpPorts stored!' from records missing tcp_port_list

Adds a 'CRD API versions and field visibility' section explaining why
tcp_port_list and other newer fields are invisible to kubectl through
the default served apiVersion, plus warning callouts on the Backup and
Restore sections so users take backups via the storage apiVersion.

Includes a DrbdRscFlags bitmask reference table for interpreting
spec.flags values during diagnosis.

Applied to both next/ and v1.4/.

Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 33498642-173f-4f94-ab56-aa33c7711515

📥 Commits

Reviewing files that changed from the base of the PR and between 3ff934e and 9751b0e.

📒 Files selected for processing (2)
  • content/en/docs/next/operations/troubleshooting/linstor-database.md
  • content/en/docs/v1.4/operations/troubleshooting/linstor-database.md

📝 Walkthrough

Walkthrough

This PR extends the LINSTOR troubleshooting documentation in both next and v1.4 versions with guidance on CRD API field visibility, storage-version-aware backup procedures, and new diagnostic procedures for DRBD TCP port conflicts and missing fields caused by older backups.

Changes

LINSTOR Database Troubleshooting Guide Updates

Layer / File(s) Summary
CRD API versions and field visibility
content/en/docs/next/operations/troubleshooting/linstor-database.md, content/en/docs/v1.4/operations/troubleshooting/linstor-database.md
New section explains how served CRD API versions hide newer fields during Kubernetes conversion; provides commands to query via storage API version to see actual tcp_port_list and other fields that linstor-controller reads.
Backup procedures with storage API guidance
content/en/docs/next/operations/troubleshooting/linstor-database.md, content/en/docs/v1.4/operations/troubleshooting/linstor-database.md
Backup instructions updated with warnings that plain kubectl get may drop newer fields; instructs users to explicitly fetch CRs via storage apiVersion when backups are intended for restore.
Database troubleshooting examples
content/en/docs/next/operations/troubleshooting/linstor-database.md, content/en/docs/v1.4/operations/troubleshooting/linstor-database.md
Two new examples added: Example 3 diagnoses duplicate TCP port allocations per node with verification steps for PV existence and replica consistency; Example 4 addresses missing tcp_port_list on LayerDrbdResources caused by older-version backups, with logic to patch salvageable records or clean up broken ones.
Restore-time verification and sanity checks
content/en/docs/next/operations/troubleshooting/linstor-database.md, content/en/docs/v1.4/operations/troubleshooting/linstor-database.md
Restore-time warnings emphasize storage apiVersion requirement and describe crash symptoms when tcp_port_list is missing; includes jq sanity-check expressions to validate backup completeness before restore.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A database needs proper care and grace,
With storage API versions finding their place,
Backups now warn of fields that may hide,
While TCP ports get sorted with troubleshooting pride,
Restores verified before data resides.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'docs(operations): expand LINSTOR DB troubleshooting' clearly and accurately summarizes the main change: expanding documentation for LINSTOR database troubleshooting with new sections on CRD API versions, field visibility, and recovery procedures for TCP port conflicts.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/linstor-database-tcp-port-conflicts

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.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 27, 2026

Deploy Preview for cozystack ready!

Name Link
🔨 Latest commit 9751b0e
🔍 Latest deploy log https://app.netlify.com/projects/cozystack/deploys/6a17372abac4190007946914
😎 Deploy Preview https://deploy-preview-552--cozystack.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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 adds documentation about LINSTOR CRD API versions, field visibility, and troubleshooting database issues (such as duplicate TCP ports or missing tcp_port_list on LayerDrbdResources). The reviewer provided valuable feedback with code suggestions to dynamically fetch the storage version instead of hardcoding v1-31-1 in multiple kubectl commands, making the instructions fully copy-pasteable and less error-prone across different environments.

Comment on lines +65 to +73
```bash
# Find the storage version
kubectl get crd layerdrbdresources.internal.linstor.linbit.com -o json \
| jq -r '.spec.versions[] | select(.storage==true) | .name'

# Query via storage version (substitute the version returned above)
kubectl get --raw "/apis/internal.linstor.linbit.com/v1-31-1/layerdrbdresources" \
| jq '.items[0].spec'
```
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

Instead of hardcoding v1-31-1 and requiring the user to manually substitute the version, we can dynamically fetch the storage version and use it in the query. This makes the command fully copy-pasteable and less error-prone.

Suggested change
```bash
# Find the storage version
kubectl get crd layerdrbdresources.internal.linstor.linbit.com -o json \
| jq -r '.spec.versions[] | select(.storage==true) | .name'
# Query via storage version (substitute the version returned above)
kubectl get --raw "/apis/internal.linstor.linbit.com/v1-31-1/layerdrbdresources" \
| jq '.items[0].spec'
```
# Find the storage version and query via it directly
VERSION=$(kubectl get crd layerdrbdresources.internal.linstor.linbit.com -o json \
| jq -r '.spec.versions[] | select(.storage==true) | .name')
kubectl get --raw "/apis/internal.linstor.linbit.com/$VERSION/layerdrbdresources" \
| jq '.items[0].spec'

Comment on lines +425 to +435
```bash
PORT=7012 # from the error message
NODE=COZY01 # from the error message, uppercase

kubectl get --raw "/apis/internal.linstor.linbit.com/v1-31-1/layerdrbdresources" \
| jq -r --arg p "[$PORT]" '.items[] | select(.spec.tcp_port_list == $p) | .spec.layer_resource_id' \
| while read lri; do
kubectl get --raw "/apis/internal.linstor.linbit.com/v1-31-1/layerresourceids" \
| jq -r --argjson l "$lri" '.items[] | select(.spec.layer_resource_id == $l and .spec.layer_resource_kind == "DRBD") | [.spec.layer_resource_id, .spec.node_name, .spec.resource_name] | @tsv'
done
```
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

Dynamically query the storage version instead of hardcoding v1-31-1 to ensure the command works seamlessly on any cluster regardless of the installed LINSTOR version.

Suggested change
```bash
PORT=7012 # from the error message
NODE=COZY01 # from the error message, uppercase
kubectl get --raw "/apis/internal.linstor.linbit.com/v1-31-1/layerdrbdresources" \
| jq -r --arg p "[$PORT]" '.items[] | select(.spec.tcp_port_list == $p) | .spec.layer_resource_id' \
| while read lri; do
kubectl get --raw "/apis/internal.linstor.linbit.com/v1-31-1/layerresourceids" \
| jq -r --argjson l "$lri" '.items[] | select(.spec.layer_resource_id == $l and .spec.layer_resource_kind == "DRBD") | [.spec.layer_resource_id, .spec.node_name, .spec.resource_name] | @tsv'
done
```
PORT=7012 # from the error message
NODE=COZY01 # from the error message, uppercase
VERSION=$(kubectl get crd layerdrbdresources.internal.linstor.linbit.com -o json | jq -r '.spec.versions[] | select(.storage==true) | .name')
kubectl get --raw "/apis/internal.linstor.linbit.com/$VERSION/layerdrbdresources" \
| jq -r --arg p "[$PORT]" '.items[] | select(.spec.tcp_port_list == $p) | .spec.layer_resource_id' \
| while read lri; do
kubectl get --raw "/apis/internal.linstor.linbit.com/$VERSION/layerresourceids" \
| jq -r --argjson l "$lri" '.items[] | select(.spec.layer_resource_id == $l and .spec.layer_resource_kind == "DRBD") | [.spec.layer_resource_id, .spec.node_name, .spec.resource_name] | @tsv'
done

Comment on lines +463 to +471
```bash
RSC=PVC-31690526-8027-412F-9F13-2766E8D26341
kubectl get --raw "/apis/internal.linstor.linbit.com/v1-31-1/layerresourceids" \
| jq -r --arg r "$RSC" '.items[] | select(.spec.resource_name == $r and .spec.layer_resource_kind == "DRBD") | .spec.layer_resource_id' \
| while read l; do
kubectl get --raw "/apis/internal.linstor.linbit.com/v1-31-1/layerdrbdresources" \
| jq -r --argjson l "$l" '.items[] | select(.spec.layer_resource_id == $l) | [.spec.layer_resource_id, .spec.tcp_port_list, .spec.flags] | @tsv'
done
```
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

Dynamically query the storage version instead of hardcoding v1-31-1 to ensure the command works seamlessly on any cluster regardless of the installed LINSTOR version.

Suggested change
```bash
RSC=PVC-31690526-8027-412F-9F13-2766E8D26341
kubectl get --raw "/apis/internal.linstor.linbit.com/v1-31-1/layerresourceids" \
| jq -r --arg r "$RSC" '.items[] | select(.spec.resource_name == $r and .spec.layer_resource_kind == "DRBD") | .spec.layer_resource_id' \
| while read l; do
kubectl get --raw "/apis/internal.linstor.linbit.com/v1-31-1/layerdrbdresources" \
| jq -r --argjson l "$l" '.items[] | select(.spec.layer_resource_id == $l) | [.spec.layer_resource_id, .spec.tcp_port_list, .spec.flags] | @tsv'
done
```
RSC=PVC-31690526-8027-412F-9F13-2766E8D26341
VERSION=$(kubectl get crd layerdrbdresources.internal.linstor.linbit.com -o json | jq -r '.spec.versions[] | select(.storage==true) | .name')
kubectl get --raw "/apis/internal.linstor.linbit.com/$VERSION/layerresourceids" \
| jq -r --arg r "$RSC" '.items[] | select(.spec.resource_name == $r and .spec.layer_resource_kind == "DRBD") | .spec.layer_resource_id' \
| while read l; do
kubectl get --raw "/apis/internal.linstor.linbit.com/$VERSION/layerdrbdresources" \
| jq -r --argjson l "$l" '.items[] | select(.spec.layer_resource_id == $l) | [.spec.layer_resource_id, .spec.tcp_port_list, .spec.flags] | @tsv'
done

Comment on lines +499 to +505
```bash
RSC=PVC-31690526-8027-412F-9F13-2766E8D26341
for kind in resourcedefinitions layerdrbdresourcedefinitions volumedefinitions layerdrbdvolumedefinitions; do
kubectl get --raw "/apis/internal.linstor.linbit.com/v1-31-1/$kind" \
| jq -r --arg r "$RSC" '.items[] | select(.spec.resource_name == $r) | "\(.kind).internal.linstor.linbit.com/\(.metadata.name)"'
done
```
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

Dynamically query the storage version instead of hardcoding v1-31-1 to ensure the command works seamlessly on any cluster regardless of the installed LINSTOR version.

Suggested change
```bash
RSC=PVC-31690526-8027-412F-9F13-2766E8D26341
for kind in resourcedefinitions layerdrbdresourcedefinitions volumedefinitions layerdrbdvolumedefinitions; do
kubectl get --raw "/apis/internal.linstor.linbit.com/v1-31-1/$kind" \
| jq -r --arg r "$RSC" '.items[] | select(.spec.resource_name == $r) | "\(.kind).internal.linstor.linbit.com/\(.metadata.name)"'
done
```
RSC=PVC-31690526-8027-412F-9F13-2766E8D26341
VERSION=$(kubectl get crd layerdrbdresources.internal.linstor.linbit.com -o json | jq -r '.spec.versions[] | select(.storage==true) | .name')
for kind in resourcedefinitions layerdrbdresourcedefinitions volumedefinitions layerdrbdvolumedefinitions; do
kubectl get --raw "/apis/internal.linstor.linbit.com/$VERSION/$kind" \
| jq -r --arg r "$RSC" '.items[] | select(.spec.resource_name == $r) | "\(.kind).internal.linstor.linbit.com/\(.metadata.name)"'
done

Comment on lines +523 to +530
```bash
kubectl get --raw "/apis/internal.linstor.linbit.com/v1-31-1/layerdrbdresources" \
| jq -r '.items[] | select(.spec.tcp_port_list == null or .spec.tcp_port_list == "") | .spec.layer_resource_id' \
| while read lri; do
kubectl get --raw "/apis/internal.linstor.linbit.com/v1-31-1/layerresourceids" \
| jq -r --argjson l "$lri" '.items[] | select(.spec.layer_resource_id == $l and .spec.layer_resource_kind == "DRBD") | [.spec.layer_resource_id, .spec.node_name, .spec.resource_name] | @tsv'
done
```
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

Dynamically query the storage version instead of hardcoding v1-31-1 to ensure the command works seamlessly on any cluster regardless of the installed LINSTOR version.

Suggested change
```bash
kubectl get --raw "/apis/internal.linstor.linbit.com/v1-31-1/layerdrbdresources" \
| jq -r '.items[] | select(.spec.tcp_port_list == null or .spec.tcp_port_list == "") | .spec.layer_resource_id' \
| while read lri; do
kubectl get --raw "/apis/internal.linstor.linbit.com/v1-31-1/layerresourceids" \
| jq -r --argjson l "$lri" '.items[] | select(.spec.layer_resource_id == $l and .spec.layer_resource_kind == "DRBD") | [.spec.layer_resource_id, .spec.node_name, .spec.resource_name] | @tsv'
done
```
VERSION=$(kubectl get crd layerdrbdresources.internal.linstor.linbit.com -o json | jq -r '.spec.versions[] | select(.storage==true) | .name')
kubectl get --raw "/apis/internal.linstor.linbit.com/$VERSION/layerdrbdresources" \
| jq -r '.items[] | select(.spec.tcp_port_list == null or .spec.tcp_port_list == "") | .spec.layer_resource_id' \
| while read lri; do
kubectl get --raw "/apis/internal.linstor.linbit.com/$VERSION/layerresourceids" \
| jq -r --argjson l "$lri" '.items[] | select(.spec.layer_resource_id == $l and .spec.layer_resource_kind == "DRBD") | [.spec.layer_resource_id, .spec.node_name, .spec.resource_name] | @tsv'
done

Comment on lines +65 to +73
```bash
# Find the storage version
kubectl get crd layerdrbdresources.internal.linstor.linbit.com -o json \
| jq -r '.spec.versions[] | select(.storage==true) | .name'

# Query via storage version (substitute the version returned above)
kubectl get --raw "/apis/internal.linstor.linbit.com/v1-31-1/layerdrbdresources" \
| jq '.items[0].spec'
```
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

Instead of hardcoding v1-31-1 and requiring the user to manually substitute the version, we can dynamically fetch the storage version and use it in the query. This makes the command fully copy-pasteable and less error-prone.

Suggested change
```bash
# Find the storage version
kubectl get crd layerdrbdresources.internal.linstor.linbit.com -o json \
| jq -r '.spec.versions[] | select(.storage==true) | .name'
# Query via storage version (substitute the version returned above)
kubectl get --raw "/apis/internal.linstor.linbit.com/v1-31-1/layerdrbdresources" \
| jq '.items[0].spec'
```
# Find the storage version and query via it directly
VERSION=$(kubectl get crd layerdrbdresources.internal.linstor.linbit.com -o json \
| jq -r '.spec.versions[] | select(.storage==true) | .name')
kubectl get --raw "/apis/internal.linstor.linbit.com/$VERSION/layerdrbdresources" \
| jq '.items[0].spec'

Comment on lines +425 to +435
```bash
PORT=7012 # from the error message
NODE=COZY01 # from the error message, uppercase

kubectl get --raw "/apis/internal.linstor.linbit.com/v1-31-1/layerdrbdresources" \
| jq -r --arg p "[$PORT]" '.items[] | select(.spec.tcp_port_list == $p) | .spec.layer_resource_id' \
| while read lri; do
kubectl get --raw "/apis/internal.linstor.linbit.com/v1-31-1/layerresourceids" \
| jq -r --argjson l "$lri" '.items[] | select(.spec.layer_resource_id == $l and .spec.layer_resource_kind == "DRBD") | [.spec.layer_resource_id, .spec.node_name, .spec.resource_name] | @tsv'
done
```
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

Dynamically query the storage version instead of hardcoding v1-31-1 to ensure the command works seamlessly on any cluster regardless of the installed LINSTOR version.

Suggested change
```bash
PORT=7012 # from the error message
NODE=COZY01 # from the error message, uppercase
kubectl get --raw "/apis/internal.linstor.linbit.com/v1-31-1/layerdrbdresources" \
| jq -r --arg p "[$PORT]" '.items[] | select(.spec.tcp_port_list == $p) | .spec.layer_resource_id' \
| while read lri; do
kubectl get --raw "/apis/internal.linstor.linbit.com/v1-31-1/layerresourceids" \
| jq -r --argjson l "$lri" '.items[] | select(.spec.layer_resource_id == $l and .spec.layer_resource_kind == "DRBD") | [.spec.layer_resource_id, .spec.node_name, .spec.resource_name] | @tsv'
done
```
PORT=7012 # from the error message
NODE=COZY01 # from the error message, uppercase
VERSION=$(kubectl get crd layerdrbdresources.internal.linstor.linbit.com -o json | jq -r '.spec.versions[] | select(.storage==true) | .name')
kubectl get --raw "/apis/internal.linstor.linbit.com/$VERSION/layerdrbdresources" \
| jq -r --arg p "[$PORT]" '.items[] | select(.spec.tcp_port_list == $p) | .spec.layer_resource_id' \
| while read lri; do
kubectl get --raw "/apis/internal.linstor.linbit.com/$VERSION/layerresourceids" \
| jq -r --argjson l "$lri" '.items[] | select(.spec.layer_resource_id == $l and .spec.layer_resource_kind == "DRBD") | [.spec.layer_resource_id, .spec.node_name, .spec.resource_name] | @tsv'
done

Comment on lines +463 to +471
```bash
RSC=PVC-31690526-8027-412F-9F13-2766E8D26341
kubectl get --raw "/apis/internal.linstor.linbit.com/v1-31-1/layerresourceids" \
| jq -r --arg r "$RSC" '.items[] | select(.spec.resource_name == $r and .spec.layer_resource_kind == "DRBD") | .spec.layer_resource_id' \
| while read l; do
kubectl get --raw "/apis/internal.linstor.linbit.com/v1-31-1/layerdrbdresources" \
| jq -r --argjson l "$l" '.items[] | select(.spec.layer_resource_id == $l) | [.spec.layer_resource_id, .spec.tcp_port_list, .spec.flags] | @tsv'
done
```
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

Dynamically query the storage version instead of hardcoding v1-31-1 to ensure the command works seamlessly on any cluster regardless of the installed LINSTOR version.

Suggested change
```bash
RSC=PVC-31690526-8027-412F-9F13-2766E8D26341
kubectl get --raw "/apis/internal.linstor.linbit.com/v1-31-1/layerresourceids" \
| jq -r --arg r "$RSC" '.items[] | select(.spec.resource_name == $r and .spec.layer_resource_kind == "DRBD") | .spec.layer_resource_id' \
| while read l; do
kubectl get --raw "/apis/internal.linstor.linbit.com/v1-31-1/layerdrbdresources" \
| jq -r --argjson l "$l" '.items[] | select(.spec.layer_resource_id == $l) | [.spec.layer_resource_id, .spec.tcp_port_list, .spec.flags] | @tsv'
done
```
RSC=PVC-31690526-8027-412F-9F13-2766E8D26341
VERSION=$(kubectl get crd layerdrbdresources.internal.linstor.linbit.com -o json | jq -r '.spec.versions[] | select(.storage==true) | .name')
kubectl get --raw "/apis/internal.linstor.linbit.com/$VERSION/layerresourceids" \
| jq -r --arg r "$RSC" '.items[] | select(.spec.resource_name == $r and .spec.layer_resource_kind == "DRBD") | .spec.layer_resource_id' \
| while read l; do
kubectl get --raw "/apis/internal.linstor.linbit.com/$VERSION/layerdrbdresources" \
| jq -r --argjson l "$l" '.items[] | select(.spec.layer_resource_id == $l) | [.spec.layer_resource_id, .spec.tcp_port_list, .spec.flags] | @tsv'
done

Comment on lines +499 to +505
```bash
RSC=PVC-31690526-8027-412F-9F13-2766E8D26341
for kind in resourcedefinitions layerdrbdresourcedefinitions volumedefinitions layerdrbdvolumedefinitions; do
kubectl get --raw "/apis/internal.linstor.linbit.com/v1-31-1/$kind" \
| jq -r --arg r "$RSC" '.items[] | select(.spec.resource_name == $r) | "\(.kind).internal.linstor.linbit.com/\(.metadata.name)"'
done
```
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

Dynamically query the storage version instead of hardcoding v1-31-1 to ensure the command works seamlessly on any cluster regardless of the installed LINSTOR version.

Suggested change
```bash
RSC=PVC-31690526-8027-412F-9F13-2766E8D26341
for kind in resourcedefinitions layerdrbdresourcedefinitions volumedefinitions layerdrbdvolumedefinitions; do
kubectl get --raw "/apis/internal.linstor.linbit.com/v1-31-1/$kind" \
| jq -r --arg r "$RSC" '.items[] | select(.spec.resource_name == $r) | "\(.kind).internal.linstor.linbit.com/\(.metadata.name)"'
done
```
RSC=PVC-31690526-8027-412F-9F13-2766E8D26341
VERSION=$(kubectl get crd layerdrbdresources.internal.linstor.linbit.com -o json | jq -r '.spec.versions[] | select(.storage==true) | .name')
for kind in resourcedefinitions layerdrbdresourcedefinitions volumedefinitions layerdrbdvolumedefinitions; do
kubectl get --raw "/apis/internal.linstor.linbit.com/$VERSION/$kind" \
| jq -r --arg r "$RSC" '.items[] | select(.spec.resource_name == $r) | "\(.kind).internal.linstor.linbit.com/\(.metadata.name)"'
done

Comment on lines +523 to +530
```bash
kubectl get --raw "/apis/internal.linstor.linbit.com/v1-31-1/layerdrbdresources" \
| jq -r '.items[] | select(.spec.tcp_port_list == null or .spec.tcp_port_list == "") | .spec.layer_resource_id' \
| while read lri; do
kubectl get --raw "/apis/internal.linstor.linbit.com/v1-31-1/layerresourceids" \
| jq -r --argjson l "$lri" '.items[] | select(.spec.layer_resource_id == $l and .spec.layer_resource_kind == "DRBD") | [.spec.layer_resource_id, .spec.node_name, .spec.resource_name] | @tsv'
done
```
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

Dynamically query the storage version instead of hardcoding v1-31-1 to ensure the command works seamlessly on any cluster regardless of the installed LINSTOR version.

Suggested change
```bash
kubectl get --raw "/apis/internal.linstor.linbit.com/v1-31-1/layerdrbdresources" \
| jq -r '.items[] | select(.spec.tcp_port_list == null or .spec.tcp_port_list == "") | .spec.layer_resource_id' \
| while read lri; do
kubectl get --raw "/apis/internal.linstor.linbit.com/v1-31-1/layerresourceids" \
| jq -r --argjson l "$lri" '.items[] | select(.spec.layer_resource_id == $l and .spec.layer_resource_kind == "DRBD") | [.spec.layer_resource_id, .spec.node_name, .spec.resource_name] | @tsv'
done
```
VERSION=$(kubectl get crd layerdrbdresources.internal.linstor.linbit.com -o json | jq -r '.spec.versions[] | select(.storage==true) | .name')
kubectl get --raw "/apis/internal.linstor.linbit.com/$VERSION/layerdrbdresources" \
| jq -r '.items[] | select(.spec.tcp_port_list == null or .spec.tcp_port_list == "") | .spec.layer_resource_id' \
| while read lri; do
kubectl get --raw "/apis/internal.linstor.linbit.com/$VERSION/layerresourceids" \
| jq -r --argjson l "$lri" '.items[] | select(.spec.layer_resource_id == $l and .spec.layer_resource_kind == "DRBD") | [.spec.layer_resource_id, .spec.node_name, .spec.resource_name] | @tsv'
done

@IvanHunters IvanHunters marked this pull request as ready for review May 27, 2026 15:05
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@content/en/docs/next/operations/troubleshooting/linstor-database.md`:
- Around line 429-435: The doc hard-codes the storage API version "v1-31-1" in
several kubectl commands (e.g., the kubectl get --raw lines selecting
layerdrbdresources and layerresourceids), which can break on clusters with a
different storage API; update those commands to use the discovered
${STORAGE_VERSION} variable instead of the literal "v1-31-1" in all affected
snippets (lines shown and also the other occurrences noted: 465-470, 502-504,
524-529) so the commands reference
"/apis/internal.linstor.linbit.com/${STORAGE_VERSION}/..." and remain portable.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0b432932-56b0-4140-be35-cd439956964b

📥 Commits

Reviewing files that changed from the base of the PR and between ef54f10 and 3ff934e.

📒 Files selected for processing (2)
  • content/en/docs/next/operations/troubleshooting/linstor-database.md
  • content/en/docs/v1.4/operations/troubleshooting/linstor-database.md

Comment thread content/en/docs/next/operations/troubleshooting/linstor-database.md Outdated
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.

Fix hard wraps please

- Unwrap hard-wrapped paragraphs to match project markdown convention
- Replace hard-coded v1-31-1 with ${STORAGE_VERSION} variable in all
  kubectl --raw commands, discovered once at the start of the section
  and reused across snippets

Addresses review comments from lexfrei, gemini-code-assist, and
coderabbitai on PR #552.

Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
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