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

Adding CSI Spec v1.6.0 support for Powerflex #259

Merged
merged 33 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
e1ecb25
updated code
KshitijaKakde Oct 23, 2023
c9cf184
updated code
KshitijaKakde Oct 23, 2023
1f5717f
updated code1
KshitijaKakde Oct 23, 2023
d3b7f0e
updated code1
KshitijaKakde Oct 23, 2023
e6768c0
updated code1
KshitijaKakde Oct 24, 2023
f9ce4dc
updated code1
KshitijaKakde Oct 24, 2023
297b527
updated code1
KshitijaKakde Oct 25, 2023
9dcb2ac
updated code1
KshitijaKakde Oct 25, 2023
38f6240
updated code1
KshitijaKakde Oct 25, 2023
b939ae7
updated code1
KshitijaKakde Oct 25, 2023
1b9ee51
updated code1
KshitijaKakde Oct 25, 2023
d792e2a
updated code1
KshitijaKakde Oct 25, 2023
45802ff
updated code1
KshitijaKakde Oct 25, 2023
282ea66
updated code1
KshitijaKakde Oct 25, 2023
b118553
updated code1
KshitijaKakde Oct 25, 2023
9b8a8fb
updated code1
KshitijaKakde Oct 26, 2023
77763eb
updated code1
KshitijaKakde Oct 26, 2023
041bca6
updated code1
KshitijaKakde Oct 26, 2023
73e4903
updated code1
KshitijaKakde Oct 30, 2023
63a7507
updated code1
KshitijaKakde Oct 30, 2023
c2b1e5b
updated code1
KshitijaKakde Oct 30, 2023
a2c758b
updated code1
KshitijaKakde Oct 30, 2023
dcaed72
updated readme
KshitijaKakde Oct 30, 2023
dfaa3ef
comment added
KshitijaKakde Oct 30, 2023
6e491eb
copyright year changed
KshitijaKakde Oct 30, 2023
ae898d5
varaible name changed
KshitijaKakde Oct 30, 2023
7b6404d
review comments addressed
KshitijaKakde Oct 30, 2023
be9dcbc
deafault system id changes
KshitijaKakde Oct 31, 2023
288da1b
deafault system id changes
KshitijaKakde Oct 31, 2023
d559e08
removed log
KshitijaKakde Oct 31, 2023
1bba6fa
formating changes
KshitijaKakde Oct 31, 2023
4c0ee26
Bump google.golang.org/grpc from 1.57.0 to 1.57.1 (#258)
dependabot[bot] Oct 30, 2023
5b995e7
Merge branch 'main' into CSI-1.6-changes
KshitijaKakde Oct 31, 2023
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
## Description
CSI Driver for PowerFlex is part of the [CSM (Container Storage Modules)](https://github.com/dell/csm) open-source suite of Kubernetes storage enablers for Dell products. CSI Driver for PowerFlex is a Container Storage Interface (CSI) driver that provides support for provisioning persistent storage using Dell PowerFlex storage array.

It supports CSI specification version 1.5.
It supports CSI specification version 1.6.

This project may be compiled as a stand-alone binary using Golang that, when run, provides a valid CSI endpoint. It also can be used as a precompiled container image.

Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ go 1.21

require (
github.com/akutz/memconn v0.1.0
github.com/container-storage-interface/spec v1.5.0
github.com/container-storage-interface/spec v1.6.0
github.com/cucumber/godog v0.12.1
github.com/dell/dell-csi-extensions/common v1.2.0
github.com/dell/dell-csi-extensions/podmon v1.2.0
github.com/dell/dell-csi-extensions/replication v1.5.0
github.com/dell/dell-csi-extensions/volumeGroupSnapshot v1.3.0
github.com/dell/gocsi v1.8.0
github.com/dell/gofsutil v1.13.1
github.com/dell/goscaleio v1.12.0
github.com/dell/goscaleio v1.12.1-0.20231017093409-11580d24020f
github.com/fsnotify/fsnotify v1.5.1
github.com/golang/protobuf v1.5.3
github.com/google/uuid v1.3.0
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/container-storage-interface/spec v1.2.0/go.mod h1:6URME8mwIBbpVyZV93Ce5St17xBiQJQY67NDsuohiy4=
github.com/container-storage-interface/spec v1.5.0 h1:lvKxe3uLgqQeVQcrnL2CPQKISoKjTJxojEs9cBk+HXo=
github.com/container-storage-interface/spec v1.5.0/go.mod h1:8K96oQNkJ7pFcC2R9Z1ynGGBB1I93kcS6PGg3SsOk8s=
github.com/container-storage-interface/spec v1.6.0 h1:vwN9uCciKygX/a0toYryoYD5+qI9ZFeAMuhEEKO+JBA=
github.com/container-storage-interface/spec v1.6.0/go.mod h1:8K96oQNkJ7pFcC2R9Z1ynGGBB1I93kcS6PGg3SsOk8s=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM=
Expand Down Expand Up @@ -114,8 +114,8 @@ github.com/dell/gocsi v1.8.0 h1:0qsC/Ts6QeAWBBVaQvFrZYBXdoR7bmjrDUb3QpcMfHM=
github.com/dell/gocsi v1.8.0/go.mod h1:X/8Ll8qqKAKCenmd1gPJMUvUmgY8cK0LiS8Pck12UaU=
github.com/dell/gofsutil v1.13.1 h1:hu26rfykH0gvpSxPe5lTBVCHZA3m896/iO+2Ekz0U7A=
github.com/dell/gofsutil v1.13.1/go.mod h1:UPRuS1blrPnfT2K3nWRrLHIosZsBznDglovA6DRMmUI=
github.com/dell/goscaleio v1.12.0 h1:9KbctTsxqgVG+9Lj9NDwb4wvjzO7YMZ7uDzps4LlX2E=
github.com/dell/goscaleio v1.12.0/go.mod h1:dt4Xy5Pnx8MEBza+ODOKiwNFBipcnzEXWgTnFy0+jTw=
github.com/dell/goscaleio v1.12.1-0.20231017093409-11580d24020f h1:FKJw+2Ouz0n2zenyeUo3tuLIjhFopCrUWyS8BC3NvsU=
github.com/dell/goscaleio v1.12.1-0.20231017093409-11580d24020f/go.mod h1:dt4Xy5Pnx8MEBza+ODOKiwNFBipcnzEXWgTnFy0+jTw=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM=
Expand Down
79 changes: 77 additions & 2 deletions service/controller.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2019-2022 Dell Inc. or its subsidiaries. All Rights Reserved.
// Copyright © 2019-2023 Dell Inc. or its subsidiaries. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -20,12 +20,14 @@
"net/http"
"strconv"
"strings"
"sync"
adarsh-dell marked this conversation as resolved.
Show resolved Hide resolved
"time"

"golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/wrapperspb"

csi "github.com/container-storage-interface/spec/lib/go/csi"
"github.com/dell/goscaleio"
Expand Down Expand Up @@ -104,7 +106,7 @@
// bytesInGiB is the number of bytes in a gibibyte
bytesInGiB = kiBytesInGiB * bytesInKiB

//VolumeIDList is the list of volume IDs

Check failure on line 109 in service/controller.go

View workflow job for this annotation

GitHub Actions / golangci-lint

File is not `gofumpt`-ed (gofumpt)
VolumeIDList = "VolumeIDList"

removeModeOnlyMe = "ONLY_ME"
Expand All @@ -117,9 +119,9 @@
errUnknownAccessType = "unknown access type is not Block or Mount"
errUnknownAccessMode = "access mode cannot be UNKNOWN"
errNoMultiNodeWriter = "multi-node with writer(s) only supported for block access type"
//TRUE means "true" (comment put in for lint check)

Check failure on line 122 in service/controller.go

View workflow job for this annotation

GitHub Actions / golangci-lint

File is not `gofumpt`-ed (gofumpt)
TRUE = "TRUE"
//FALSE means "false" (comment put in for lint check)

Check failure on line 124 in service/controller.go

View workflow job for this annotation

GitHub Actions / golangci-lint

File is not `gofumpt`-ed (gofumpt)
FALSE = "FALSE"

sioReplicationGroupExists = "The Replication Consistency Group already exists"
Expand All @@ -141,14 +143,14 @@
HeaderCSIPluginIdentifier = "x-csi-plugin-id"
)

var (

Check failure on line 146 in service/controller.go

View workflow job for this annotation

GitHub Actions / golangci-lint

File is not `gofumpt`-ed (gofumpt)
interestingParameters = [...]string{0: "FsType", 1: KeyMkfsFormatOption, 2: KeyBandwidthLimitInKbps, 3: KeyIopsLimit}
)

func (s *service) CreateVolume(
ctx context.Context,
req *csi.CreateVolumeRequest) (
*csi.CreateVolumeResponse, error) {

Check failure on line 153 in service/controller.go

View workflow job for this annotation

GitHub Actions / golangci-lint

File is not `gofumpt`-ed (gofumpt)

params := req.GetParameters()

Expand Down Expand Up @@ -1678,7 +1680,7 @@

func valVolumeCaps(
vcs []*csi.VolumeCapability,
vol *siotypes.Volume) (bool, string) {

Check warning on line 1683 in service/controller.go

View workflow job for this annotation

GitHub Actions / golangci-lint

unused-parameter: parameter 'vol' seems to be unused, consider removing or renaming it as _ (revive)

var (
supported = true
Expand Down Expand Up @@ -2091,6 +2093,11 @@
return capacity, nil
}

// maxVolumesSizeForArray - store the maxVolumesSizeForArray
var maxVolumesSizeForArray = make(map[string]int64)
adarsh-dell marked this conversation as resolved.
Show resolved Hide resolved

var mutex = &sync.Mutex{}

func (s *service) GetCapacity(
ctx context.Context,
req *csi.GetCapacityRequest) (
Expand All @@ -2101,6 +2108,7 @@
err error
)

systemID := ""
params := req.GetParameters()
if params == nil || len(params) == 0 {
// Get capacity of all systems
Expand All @@ -2111,7 +2119,6 @@
if !ok {
Log.Printf("Protection Domain name not provided; there could be conflicts if two storage pools share a name")
}
systemID := ""
for key, value := range params {
if strings.EqualFold(key, KeySystemID) {
systemID = value
Expand All @@ -2132,14 +2139,82 @@
"Unable to get capacity: %s", err.Error())
}

if systemID == "" && s.opts.defaultSystemID != "" {
systemID = s.opts.defaultSystemID
}

if systemID == "" {
return &csi.GetCapacityResponse{
AvailableCapacity: capacity,
}, nil
}

maxVolSize, err := s.getMaximumVolumeSize(systemID)
if err != nil {
Log.Debug("GetMaxVolumeSize returning error ", err)
}

if maxVolSize < 0 {
return &csi.GetCapacityResponse{
AvailableCapacity: capacity,
}, nil
}

maxVolSizeinBytes := maxVolSize * bytesInGiB
maxVol := wrapperspb.Int64(maxVolSizeinBytes)
return &csi.GetCapacityResponse{
AvailableCapacity: capacity,
MaximumVolumeSize: maxVol,
}, nil
}

func (s *service) getMaximumVolumeSize(systemID string) (int64, error) {
valueInCache, found := getCachedMaximumVolumeSize(systemID)
if !found || valueInCache < 0 {
adminClient := s.adminClients[systemID]
if adminClient == nil {
return 0, status.Errorf(codes.InvalidArgument, "can't find adminClient by id %s", systemID)
}

vol1, err := adminClient.GetMaxVol()
if err != nil {
Log.Debug("GetMaxVolumeSize returning error ", err)
return 0, err
}

value, err := strconv.ParseInt(vol1, 10, 64)
if err != nil {
Log.Debug("error converting str to int ", err)
return 0, err

}

cacheMaximumVolumeSize(systemID, value)
valueInCache = value

}
return valueInCache, nil

}

func getCachedMaximumVolumeSize(key string) (int64, bool) {
mutex.Lock()
defer mutex.Unlock()

value, found := maxVolumesSizeForArray[key]
return value, found
}

func cacheMaximumVolumeSize(key string, value int64) {
mutex.Lock()
defer mutex.Unlock()

maxVolumesSizeForArray[key] = value
}

func (s *service) ControllerGetCapabilities(
ctx context.Context,

Check warning on line 2216 in service/controller.go

View workflow job for this annotation

GitHub Actions / golangci-lint

unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
req *csi.ControllerGetCapabilitiesRequest) (

Check warning on line 2217 in service/controller.go

View workflow job for this annotation

GitHub Actions / golangci-lint

unused-parameter: parameter 'req' seems to be unused, consider removing or renaming it as _ (revive)
*csi.ControllerGetCapabilitiesResponse, error) {

capabilities := []*csi.ControllerServiceCapability{
Expand Down Expand Up @@ -2256,7 +2331,7 @@
}

// systemProbe will probe the given array
func (s *service) systemProbe(ctx context.Context, array *ArrayConnectionData) error {

Check warning on line 2334 in service/controller.go

View workflow job for this annotation

GitHub Actions / golangci-lint

unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)

// Check that we have the details needed to login to the Gateway
if array.Endpoint == "" {
Expand Down Expand Up @@ -2713,8 +2788,8 @@
// DeleteSnapshotConsistencyGroup is called when we wish to delete an entire CG
// of snapshots. We retrieve all the volumes and determine if any are in use.
func (s *service) DeleteSnapshotConsistencyGroup(
ctx context.Context, snapVol *siotypes.Volume,

Check warning on line 2791 in service/controller.go

View workflow job for this annotation

GitHub Actions / golangci-lint

unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
req *csi.DeleteSnapshotRequest, adminClient *goscaleio.Client) (

Check warning on line 2792 in service/controller.go

View workflow job for this annotation

GitHub Actions / golangci-lint

unused-parameter: parameter 'req' seems to be unused, consider removing or renaming it as _ (revive)
*csi.DeleteSnapshotResponse, error) {

cgVols := make([]*siotypes.Volume, 0)
Expand Down Expand Up @@ -3086,7 +3161,7 @@

// ControllerGetVolume fetch current information about a volume
// returns volume condition if found else returns not found
func (s *service) ControllerGetVolume(ctx context.Context, req *csi.ControllerGetVolumeRequest) (*csi.ControllerGetVolumeResponse, error) {

Check warning on line 3164 in service/controller.go

View workflow job for this annotation

GitHub Actions / golangci-lint

unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)

abnormal := false
csiVolID := req.GetVolumeId()
Expand Down
Loading
Loading