Skip to content

Commit

Permalink
Merge pull request #23 from pmint93/master
Browse files Browse the repository at this point in the history
Fix bug cause driver CreateVolume to dysfunctioning
  • Loading branch information
lmq1999 authored Nov 29, 2022
2 parents 298327a + 0197936 commit fcf4f73
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 21 deletions.
28 changes: 8 additions & 20 deletions driver/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package driver
import (
"errors"
"fmt"
"strings"

"time"

Expand All @@ -34,16 +33,7 @@ import (
"k8s.io/klog"
)

const (
RFC3339MilliNoZ = "2006-01-02T15:04:05.999999"
PVCNameKey = "csi.storage.k8s.io/pvc/name"
PVCNamespaceKey = "csi.storage.k8s.io/pvc/namespace"
)

var (
volPVCName string
volPVCNamespace string
)
const RFC3339MilliNoZ = "2006-01-02T15:04:05.999999"

type controllerServer struct {
Driver *VolumeDriver
Expand Down Expand Up @@ -83,15 +73,13 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
volAvailability = req.GetParameters()["availability"]
}

for key, value := range req.GetParameters() {
switch strings.ToLower(key) {
case PVCNameKey:
volPVCName = value
case PVCNamespaceKey:
volPVCNamespace = value
default:
return nil, status.Errorf(codes.InvalidArgument, "Invalid parameter key %s for CreateVolume", key)
}
volPVCName, ok := req.GetParameters()["csi.storage.k8s.io/pvc/name"]
if !ok {
volPVCName = "unknown"
}
volPVCNamespace, ok := req.GetParameters()["csi.storage.k8s.io/pvc/namespace"]
if !ok {
volPVCNamespace = "unknown"
}

Description := volPVCNamespace + "/" + volPVCName + " by csi-bizflycloud"
Expand Down
2 changes: 1 addition & 1 deletion driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const (
)

var (
version = "0.2"
version = "0.3.0"
)

type VolumeDriver struct {
Expand Down

0 comments on commit fcf4f73

Please sign in to comment.