Skip to content

feat: support snapshot max count for v2#1391

Merged
derekbit merged 1 commit into
longhorn:masterfrom
davidcheng0922:issue-12921-v2-snapshot-max-count
May 15, 2026
Merged

feat: support snapshot max count for v2#1391
derekbit merged 1 commit into
longhorn:masterfrom
davidcheng0922:issue-12921-v2-snapshot-max-count

Conversation

@davidcheng0922
Copy link
Copy Markdown
Contributor

Which issue(s) this PR fixes:

longhorn/longhorn#12921

What this PR does / why we need it:

Special notes for your reviewer:

Additional documentation or context

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for configuring and enforcing a maximum snapshot count for the V2 (SPDK) data engine, aligning instance-manager’s proxy/instance flows with the new SPDK RPC and engine-side enforcement needed for longhorn/longhorn#12921.

Changes:

  • Extend V2 instance spec and SPDK RPC to carry SnapshotMaxCount, and plumb it through engine creation and volume get responses.
  • Add a new SPDK gRPC method to update an engine’s snapshot max count at runtime, and enforce the limit during snapshot creation.
  • Update vendored dependencies and module metadata (currently includes local-path replaces).

Reviewed changes

Copilot reviewed 4 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
go.mod Adds local replace directives for types and longhorn-spdk-engine.
go.sum Dependency checksum updates/removals from module graph changes.
vendor/modules.txt Vendor metadata updates; now records local-path replacements.
vendor/github.com/longhorn/types/pkg/generated/spdkrpc/spdk_grpc.pb.go Adds SPDKService RPC wiring for EngineSnapshotMaxCountSet.
vendor/github.com/longhorn/types/pkg/generated/imrpc/instance.pb.go Adds snapshot_max_count to SpdkInstanceSpec.
vendor/github.com/longhorn/longhorn-spdk-engine/pkg/spdk/server_engine.go Plumbs SnapshotMaxCount into engine creation and adds server handler for updating it.
vendor/github.com/longhorn/longhorn-spdk-engine/pkg/spdk/engine.go Stores SnapshotMaxCount, exposes it via EngineGet, and enforces it in snapshot precheck.
vendor/github.com/longhorn/longhorn-spdk-engine/pkg/client/client_engine.go Extends EngineCreate and adds EngineSnapshotMaxCountSet client call.
vendor/github.com/longhorn/longhorn-spdk-engine/pkg/api/types.go Exposes SnapshotMaxCount in the API engine struct conversion.
pkg/instance/instance.go Passes SnapshotMaxCount into SPDK engine creation for V2 instances.
pkg/client/instance.go Adds SnapshotMaxCount to engine create request and maps it into SpdkInstanceSpec.
pkg/proxy/volume.go Returns SnapshotMaxCount for V2 in VolumeGet and implements V2 VolumeSnapshotMaxCountSet.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread go.mod Outdated
Comment on lines +128 to +131

replace github.com/longhorn/types => ../types

replace github.com/longhorn/longhorn-spdk-engine => ../longhorn-spdk-engine
Longhorn: 12921

Signed-off-by: David Cheng <david.cheng@suse.com>
@davidcheng0922 davidcheng0922 force-pushed the issue-12921-v2-snapshot-max-count branch from 71735ce to 5e39929 Compare May 15, 2026 05:15
Copy link
Copy Markdown
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 merged commit 1ecf693 into longhorn:master May 15, 2026
12 checks passed
@derekbit
Copy link
Copy Markdown
Member

@mergify backport v1.12.x

@mergify
Copy link
Copy Markdown

mergify Bot commented May 15, 2026

backport v1.12.x

✅ Backports have been created

Details

Cherry-pick of 1ecf693 has failed:

On branch mergify/bp/v1.12.x/pr-1391
Your branch is up to date with 'origin/v1.12.x'.

You are currently cherry-picking commit 1ecf693e.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   pkg/client/instance.go
	modified:   pkg/instance/instance.go
	modified:   pkg/proxy/volume.go
	modified:   vendor/github.com/longhorn/longhorn-spdk-engine/pkg/api/types.go
	modified:   vendor/github.com/longhorn/longhorn-spdk-engine/pkg/client/client_engine.go
	modified:   vendor/github.com/longhorn/longhorn-spdk-engine/pkg/spdk/engine.go
	modified:   vendor/github.com/longhorn/longhorn-spdk-engine/pkg/spdk/server_engine.go
	modified:   vendor/github.com/longhorn/types/pkg/generated/imrpc/instance.pb.go
	modified:   vendor/github.com/longhorn/types/pkg/generated/spdkrpc/spdk.pb.go
	modified:   vendor/github.com/longhorn/types/pkg/generated/spdkrpc/spdk_grpc.pb.go

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   go.mod
	both modified:   go.sum
	both modified:   vendor/modules.txt

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

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