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

Various fixes + improvements with respect to recent caching changes #272

Merged
merged 4 commits into from
Jun 5, 2024
Merged
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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ FROM --platform=$BUILDPLATFORM golang:1 as downloader

ARG TARGETOS
ARG TARGETARCH
ARG LINSTOR_WAIT_UNTIL_VERSION=v0.2.1
ARG LINSTOR_WAIT_UNTIL_VERSION=v0.2.2
RUN curl -fsSL https://github.com/LINBIT/linstor-wait-until/releases/download/$LINSTOR_WAIT_UNTIL_VERSION/linstor-wait-until-$LINSTOR_WAIT_UNTIL_VERSION-$TARGETOS-$TARGETARCH.tar.gz | tar xvzC /

FROM debian:bookworm-slim
Expand Down
2 changes: 1 addition & 1 deletion cmd/linstor-csi/linstor-csi.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func main() {
propNs = flag.String("property-namespace", linstor.NamespcAuxiliary, "Limit the reported topology keys to properties from the given namespace.")
labelBySP = flag.Bool("label-by-storage-pool", true, "Set to false to disable labeling of nodes based on their configured storage pools.")
nodeCacheTimeout = flag.Duration("node-cache-timeout", 1*time.Minute, "Duration for which the results of node and storage pool related API responses should be cached.")
resourceCacheTimeout = flag.Duration("resource-cache-timeout", 1*time.Minute, "Duration for which the results of resource related API responses should be cached.")
resourceCacheTimeout = flag.Duration("resource-cache-timeout", 30*time.Second, "Duration for which the results of resource related API responses should be cached.")
)

flag.Var(&volume.DefaultRemoteAccessPolicy, "default-remote-access-policy", "")
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.22.0
toolchain go1.22.2

require (
github.com/LINBIT/golinstor v0.52.0
github.com/LINBIT/golinstor v0.52.1
github.com/container-storage-interface/spec v1.9.0
github.com/haySwim/data v0.2.0
github.com/kubernetes-csi/csi-test/v5 v5.2.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/LINBIT/golinstor v0.52.0 h1:b+l26DJvLxGIYuvopLFJUoE7aywa6oCmCeL3jav3kKM=
github.com/LINBIT/golinstor v0.52.0/go.mod h1:D811Eyjhoy6t1Tl36HTW4by0s6O5g0cVgV/t58oN+0g=
github.com/LINBIT/golinstor v0.52.1 h1:TBLv3E9Lr7cEDQvorRivZhtZS5xP1oUUOxoAGBwJoAg=
github.com/LINBIT/golinstor v0.52.1/go.mod h1:D811Eyjhoy6t1Tl36HTW4by0s6O5g0cVgV/t58oN+0g=
github.com/container-storage-interface/spec v1.9.0 h1:zKtX4STsq31Knz3gciCYCi1SXtO2HJDecIjDVboYavY=
github.com/container-storage-interface/spec v1.9.0/go.mod h1:ZfDu+3ZRyeVqxZM0Ds19MVLkN2d1XJ5MAfi1L3VjlT0=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down
6 changes: 3 additions & 3 deletions pkg/client/linstor.go
Original file line number Diff line number Diff line change
Expand Up @@ -621,14 +621,14 @@ func (s *Linstor) Detach(ctx context.Context, volId, node string) error {
}
}

if resInUse <= 1 {
if resInUse == 1 {
rdPropsModify := lapi.GenericPropsModify{DeleteProps: []string{
linstor.PropertyAllowTwoPrimaries,
}}

err = s.client.ResourceDefinitions.Modify(ctx, volId, rdPropsModify)
if err != nil {
return err
return nil404(err)
}
}

Expand Down Expand Up @@ -2102,7 +2102,7 @@ func linstorifyResourceName(name string) (string, error) {
}

func nil404(e error) error {
if e == lapi.NotFoundError {
if errors.Is(e, lapi.NotFoundError) {
return nil
}
return e
Expand Down
4 changes: 4 additions & 0 deletions pkg/driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,10 @@ func (d Driver) ControllerPublishVolume(ctx context.Context, req *csi.Controller
"ControllerPublishVolume failed for %s: %v", req.GetVolumeId(), err)
}

if devPath == "" {
return nil, status.Errorf(codes.Internal, "ControllerPublishVolume failed for %s: could not determine device path", req.GetVolumeId())
}

return &csi.ControllerPublishVolumeResponse{
PublishContext: (&PublishContext{
DevicePath: devPath,
Expand Down
3 changes: 0 additions & 3 deletions pkg/driver/volume_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ type VolumeContext struct {
MountOptions []string
PostMountXfsOptions string
RemoteAccessPolicy volume.RemoteAccessPolicy
DevicePath string
}

// NewVolumeContext creates a new default volume context, which does not specify any fancy mkfs/mount/post-mount options
Expand Down Expand Up @@ -57,7 +56,6 @@ func VolumeContextFromMap(ctx map[string]string) (*VolumeContext, error) {
MountOptions: mountOpts,
PostMountXfsOptions: ctx[PostMountXfsOpts],
RemoteAccessPolicy: policy,
DevicePath: ctx[DevicePath],
}, nil
}

Expand All @@ -72,7 +70,6 @@ func (v *VolumeContext) ToMap() (map[string]string, error) {
MountOptions: encodeMountOpts(v.MountOptions),
PostMountXfsOpts: v.PostMountXfsOptions,
RemoteAccessPolicyOpts: string(policy),
DevicePath: v.DevicePath,
}, nil
}

Expand Down
Loading