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(auto-salvage): v2 support #675

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ module github.com/longhorn/longhorn-instance-manager

go 1.22.2

replace github.com/longhorn/longhorn-spdk-engine => github.com/c3y1huang/longhorn-spdk-engine v0.0.0-20240927080335-1ad077cacae9

replace github.com/longhorn/types => github.com/c3y1huang/types v0.0.0-20240927050527-1fc6fe5fa4f9

replace github.com/longhorn/go-common-libs => github.com/c3y1huang/go-common-libs v0.0.0-20240927004544-ee33d7bb917c

require (
github.com/google/uuid v1.6.0
github.com/longhorn/backupstore v0.0.0-20240922062439-e33cb1230db9
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bits-and-blooms/bitset v1.12.0 h1:U/q1fAF7xXRhFCrhROzIfffYnu+dlS38vCZtmFVPHmA=
github.com/bits-and-blooms/bitset v1.12.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
github.com/c3y1huang/go-common-libs v0.0.0-20240927004544-ee33d7bb917c h1:hgqLyWxqr+8pswJTewMcNlO7gO8b8bYWeMnnRDOdVZw=
github.com/c3y1huang/go-common-libs v0.0.0-20240927004544-ee33d7bb917c/go.mod h1:L8QlyY7cqL84FcxnJ8HK6DaQ1Ej9JiZtZ94OW5W+Yyw=
github.com/c3y1huang/longhorn-spdk-engine v0.0.0-20240927080335-1ad077cacae9 h1:PhkUvicDuTv7z8UyRdTUvUSmDOql/Jv6Nua4KqYy0iE=
github.com/c3y1huang/longhorn-spdk-engine v0.0.0-20240927080335-1ad077cacae9/go.mod h1:7JZUkREIOX+ZteSBA+GHt+px5/L/NRARzO9U5HL2QQ0=
github.com/c3y1huang/types v0.0.0-20240927050527-1fc6fe5fa4f9 h1:Jh88TpuLXQELSFtpwEwv8yZgcHE3VurY/flB2V8fIHo=
github.com/c3y1huang/types v0.0.0-20240927050527-1fc6fe5fa4f9/go.mod h1:KlJuZB8NfHchWshYxYgV9pPIxBKC04Vq05G2TfgMf7w=
github.com/c9s/goprocinfo v0.0.0-20210130143923-c95fcf8c64a8 h1:SjZ2GvvOononHOpK84APFuMvxqsk3tEIaKH/z4Rpu3g=
github.com/c9s/goprocinfo v0.0.0-20210130143923-c95fcf8c64a8/go.mod h1:uEyr4WpAH4hio6LFriaPkL938XnrvLpNPmQHBdrmbIE=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
Expand Down Expand Up @@ -107,20 +113,14 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/longhorn/backupstore v0.0.0-20240922062439-e33cb1230db9 h1:ua4PCfArX2TyPVnldF+m7I9c2eGi+TcP8pcPPx2wp0w=
github.com/longhorn/backupstore v0.0.0-20240922062439-e33cb1230db9/go.mod h1:UTONYTgRryrw0RgDZbxwU+r1s4PeKQ+v0Z8Pb6jUWn4=
github.com/longhorn/go-common-libs v0.0.0-20240921050101-797b589b669d h1:MXJlzyXLptspJEc1UC7ee2eBIYksTl0RT2bXUAXU+8Q=
github.com/longhorn/go-common-libs v0.0.0-20240921050101-797b589b669d/go.mod h1:L8QlyY7cqL84FcxnJ8HK6DaQ1Ej9JiZtZ94OW5W+Yyw=
github.com/longhorn/go-iscsi-helper v0.0.0-20240921050131-ea564c4f8688 h1:y9icgNMNnDk/mTmgQutXcgirWWtsdZl5fRLKRm44mWg=
github.com/longhorn/go-iscsi-helper v0.0.0-20240921050131-ea564c4f8688/go.mod h1:OvkJ/xLpiCScu6SDVZ2y4F70DHxpenMyrHN+wA06nu4=
github.com/longhorn/go-spdk-helper v0.0.0-20240922062342-22115a91cbe9 h1:DVYw6dzssMcCOAQSqXLVJIQQiKdZD7lAKfnU2ZTf4Mo=
github.com/longhorn/go-spdk-helper v0.0.0-20240922062342-22115a91cbe9/go.mod h1:pKbJjuJN69T+qDaJIkR1NcpGqCzj/vGv1NTTDiaE5s0=
github.com/longhorn/longhorn-engine v1.8.0-dev-20240922 h1:sV9UfurVeEuWx0jaNndtvBJnOR6ZYmrJU3f7pObfLhA=
github.com/longhorn/longhorn-engine v1.8.0-dev-20240922/go.mod h1:d5+LbCuwivslvz0Qp0drZ5vyuT+s1NR+v9clerORT58=
github.com/longhorn/longhorn-spdk-engine v0.0.0-20240920070107-20be505a19b7 h1:FChmXjYrAqh0GoEIn27OU4BlN90G1xDgOxzSUvGJHS0=
github.com/longhorn/longhorn-spdk-engine v0.0.0-20240920070107-20be505a19b7/go.mod h1:fhoOMM2pRmLqzlWVZDy3QRRq/83DmduIgcxoZ+AFKTI=
github.com/longhorn/sparse-tools v0.0.0-20240907135423-37af3c64d59d h1:iNrrGcE9TLcaayQgOkdEZDvlzKCWMNhXXJD2d2K4Wyo=
github.com/longhorn/sparse-tools v0.0.0-20240907135423-37af3c64d59d/go.mod h1:iUJCZtOKG/9xv2rfrUAYZntFTzP5dZtvy4Kwe6dMcUc=
github.com/longhorn/types v0.0.0-20240902072916-1bf23d310acb h1:8CoW5YYn+SC43o5zFR+wscOd3SgF6rQZjrkXOkJfZPM=
github.com/longhorn/types v0.0.0-20240902072916-1bf23d310acb/go.mod h1:KlJuZB8NfHchWshYxYgV9pPIxBKC04Vq05G2TfgMf7w=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
Expand Down
2 changes: 2 additions & 0 deletions pkg/client/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ type EngineCreateRequest struct {
InitiatorAddress string
TargetAddress string
UpgradeRequired bool
SalvageRequested bool
}

type ReplicaCreateRequest struct {
Expand Down Expand Up @@ -147,6 +148,7 @@ func (c *InstanceServiceClient) InstanceCreate(req *InstanceCreateRequest) (*api
Size: req.Size,
ReplicaAddressMap: req.Engine.ReplicaAddressMap,
Frontend: req.Engine.Frontend,
SalvageRequested: req.Engine.SalvageRequested,
}
case types.InstanceTypeReplica:
spdkInstanceSpec = &rpc.SpdkInstanceSpec{
Expand Down
6 changes: 3 additions & 3 deletions pkg/instance/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (ops V2DataEngineInstanceOps) InstanceCreate(req *rpc.InstanceCreateRequest
switch req.Spec.Type {
case types.InstanceTypeEngine:
engine, err := c.EngineCreate(req.Spec.Name, req.Spec.VolumeName, req.Spec.SpdkInstanceSpec.Frontend, req.Spec.SpdkInstanceSpec.Size, req.Spec.SpdkInstanceSpec.ReplicaAddressMap,
req.Spec.PortCount, req.Spec.InitiatorAddress, req.Spec.TargetAddress, req.Spec.UpgradeRequired)
req.Spec.PortCount, req.Spec.InitiatorAddress, req.Spec.TargetAddress, req.Spec.UpgradeRequired, req.Spec.SpdkInstanceSpec.SalvageRequested)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -270,13 +270,13 @@ func (ops V2DataEngineInstanceOps) InstanceGet(req *rpc.InstanceGetRequest) (*rp

switch req.Type {
case types.InstanceTypeEngine:
engine, err := c.EngineGet(req.Name)
engine, err := c.EngineGet(req.Name, false)
if err != nil {
return nil, err
}
return engineResponseToInstanceResponse(engine), nil
case types.InstanceTypeReplica:
replica, err := c.ReplicaGet(req.Name)
replica, err := c.ReplicaGet(req.Name, false)
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/proxy/replica.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (ops V2DataEngineProxyOps) ReplicaList(ctx context.Context, req *rpc.ProxyE
}
defer c.Close()

recv, err := c.EngineGet(req.EngineName)
recv, err := c.EngineGet(req.EngineName, false)
if err != nil {
return nil, grpcstatus.Error(grpccodes.Internal, errors.Wrapf(err, "failed to get engine %v", req.EngineName).Error())
}
Expand Down Expand Up @@ -228,7 +228,7 @@ func (ops V2DataEngineProxyOps) ReplicaRebuildingStatus(ctx context.Context, req
}
defer engineCli.Close()

e, err := engineCli.EngineGet(req.EngineName)
e, err := engineCli.EngineGet(req.EngineName, false)
if err != nil {
return nil, grpcstatus.Errorf(grpccodes.Internal, "failed to get engine %v: %v", req.EngineName, err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/proxy/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func (ops V2DataEngineProxyOps) SnapshotList(ctx context.Context, req *rpc.Proxy
}
defer c.Close()

engine, err := c.EngineGet(req.EngineName)
engine, err := c.EngineGet(req.EngineName, true)
if err != nil {
return nil, errors.Wrapf(err, "failed to get engine %v", req.EngineName)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/proxy/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (ops V2DataEngineProxyOps) VolumeGet(ctx context.Context, req *rpc.ProxyEng
}
defer c.Close()

recv, err := c.EngineGet(req.EngineName)
recv, err := c.EngineGet(req.EngineName, false)
if err != nil {
return nil, grpcstatus.Errorf(grpccodes.Internal, "failed to get engine %v: %v", req.EngineName, err)
}
Expand Down
13 changes: 7 additions & 6 deletions vendor/github.com/longhorn/go-common-libs/io/file.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 1 addition & 26 deletions vendor/github.com/longhorn/go-common-libs/ns/joiner.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions vendor/github.com/longhorn/go-common-libs/ns/joiner_darwin.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions vendor/github.com/longhorn/go-common-libs/ns/joiner_linux.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions vendor/github.com/longhorn/go-common-libs/sys/sys.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 0 additions & 11 deletions vendor/github.com/longhorn/go-common-libs/types/namespace.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions vendor/github.com/longhorn/go-common-libs/types/namespace_linux.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions vendor/github.com/longhorn/go-common-libs/utils/misc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading