Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(v2): storage network with v2 data engine #3521

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

c3y1huang
Copy link
Contributor

Which issue(s) this PR fixes:

Issue longhorn/longhorn#6450

What this PR does / why we need it:

Use storage network for V2 data engine.

Special notes for your reviewer:

None

Additional documentation or context

None

@c3y1huang c3y1huang self-assigned this Feb 3, 2025
Copy link

coderabbitai bot commented Feb 3, 2025

Walkthrough

This pull request modifies how storage IP addresses are handled during instance creation. In the engine controller, it adds logic to retrieve the instance manager pod and use its storage IP when setting the InitiatorAddress and TargetAddress for engine instances, along with enhanced error handling. In the replica controller, it removes the assignment of the ImIP field. Additionally, the ImIP field is removed from both EngineInstanceCreateRequest and ReplicaInstanceCreateRequest in the engine API.

Changes

File(s) Change Summary
controller/engine_controller.go Added logic to retrieve the instance manager pod via ec.ds.GetPod(im.Name); updated EngineInstanceCreateRequest to use the pod’s storage IP; enhanced error handling.
controller/replica_controller.go Removed the line that sets the ImIP field in the ReplicaInstanceCreateRequest.
engineapi/instance_manager.go Removed the ImIP field from both EngineInstanceCreateRequest and ReplicaInstanceCreateRequest structures.

Sequence Diagram(s)

Engine Instance Creation Flow

sequenceDiagram
    participant EC as EngineController
    participant DS as DataStore
    participant Pod as Instance Manager Pod
    participant ES as EngineService

    EC->>DS: GetPod(instanceManagerName)
    DS-->>EC: Pod (with storage IP)
    EC->>ES: CreateEngineInstance(InitiatorAddress & TargetAddress = storage IP)
    ES-->>EC: Instance process created
Loading

Replica Instance Creation Flow

sequenceDiagram
    participant RC as ReplicaController
    participant ES as EngineService

    RC->>ES: CreateReplicaInstance(without IM IP)
    ES-->>RC: Instance process created
Loading

Assessment against linked issues

Objective Addressed Explanation
Update instance creation logic to use pod-derived storage IP and remove deprecated IP configuration (#6450)

Suggested reviewers

  • shuo-wu
  • innobead

Tip

🌐 Web search-backed reviews and chat
  • We have enabled web search-based reviews and chat for all users. This feature allows CodeRabbit to access the latest documentation and information on the web.
  • You can disable this feature by setting web_search: false in the knowledge_base settings.
  • Please share any feedback in the Discord discussion.

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e3492b6 and d78b240.

📒 Files selected for processing (3)
  • controller/engine_controller.go (1 hunks)
  • controller/replica_controller.go (0 hunks)
  • engineapi/instance_manager.go (0 hunks)
💤 Files with no reviewable changes (2)
  • engineapi/instance_manager.go
  • controller/replica_controller.go
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Build binaries
  • GitHub Check: Summary
🔇 Additional comments (2)
controller/engine_controller.go (2)

485-490: LGTM! Proper error handling for pod retrieval.

The implementation correctly retrieves the instance manager pod and extracts the storage IP with appropriate error handling.


500-501: LGTM! Consistent use of storage network IP.

The implementation correctly uses the storage network IP for both initiator and target addresses, replacing the previous use of instance manager IP.

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@c3y1huang c3y1huang force-pushed the 6450-storage-network-support-v2 branch from 7bffa9e to f4b3312 Compare February 4, 2025 08:25
@c3y1huang
Copy link
Contributor Author

c3y1huang commented Feb 4, 2025

Test result:

  • -m v2_volume_test:
    > k -n longhorn-system get setting storage-network
    NAME              VALUE                          APPLIED   AGE
    storage-network   kube-system/demo-192-168-0-0   true      26h
    
    =========================== short test summary info ============================
    FAILED test_scheduling.py::test_data_locality_basic - AssertionError
    
    = 1 failed, 130 passed, 1 skipped, 258 deselected, 136 warnings in 24429.59s (6:47:09) =
    
    Known issue: [BUG] V2 volume fails to cleanup error replica and rebuild new one - test_data_locality_basic longhorn#10335
  • Backing image (manual):
    • create backing image with v2 data engine
    • create and attach volume with v2 data engine backing image

Copy link
Member

@derekbit derekbit left a comment

Choose a reason for hiding this comment

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

LGTM

@derekbit derekbit force-pushed the 6450-storage-network-support-v2 branch from f4b3312 to e3492b6 Compare February 6, 2025 03:21
Signed-off-by: Chin-Ya Huang <[email protected]>
longhorn/longhorn-6450

Signed-off-by: Chin-Ya Huang <[email protected]>
@derekbit derekbit force-pushed the 6450-storage-network-support-v2 branch from e3492b6 to d78b240 Compare February 6, 2025 04:16
@ChanYiLin
Copy link
Contributor

ChanYiLin commented Feb 6, 2025

Hi @c3y1huang
Could you please check if there is anything also needs to be changed for the v2 BackingImage?
V2 BackingImage is managed by instance-manager

There is only one place where it may need the instance-manager ip, not sure if in this case will we need to pass the storage network ip instead of pod ip.

  • longhorn-manager use engine proxy api to send request to instance manger to create the BackingImage in the spdk server
  • When syncing BackingImage between each instance-manager, e.g. from A to B
    • longhorn-manager get the srcInstanceManager.Status.IP of the copy A
    • _, err = engineClientProxy.SPDKBackingImageCreate(bi.Name, bi.Status.UUID, v2DiskUUID, bi.Status.Checksum, net.JoinHostPort(srcInstanceManager.Status.IP, strconv.Itoa(engineapi.InstanceManagerSpdkServiceDefaultPort)), sourceV2DiskUUID, bi.Name, uint64(bi.Status.Size))
    • the B instance-manager spdk server will use this ip address to get the client.NewSPDKClient(addr) to ask A to expose the spdk snapshot and connect it to get the device to do the copy.

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.

3 participants