From ceabf6919ba509dfc0806fc47921dc024b177eeb Mon Sep 17 00:00:00 2001 From: Ayush Rangwala Date: Thu, 18 Apr 2019 13:43:32 +0530 Subject: [PATCH] corrected the node-registrar image version to v1.0.2 to be aligned with all the side cars and used strings.Join to concatenate the path string for volume --- .../hostpath/csi-hostpath-plugin.yaml | 2 +- pkg/hostpath/controllerserver.go | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/deploy/kubernetes-1.13/hostpath/csi-hostpath-plugin.yaml b/deploy/kubernetes-1.13/hostpath/csi-hostpath-plugin.yaml index cca1e83d5..774f564ea 100644 --- a/deploy/kubernetes-1.13/hostpath/csi-hostpath-plugin.yaml +++ b/deploy/kubernetes-1.13/hostpath/csi-hostpath-plugin.yaml @@ -37,7 +37,7 @@ spec: hostNetwork: true containers: - name: node-driver-registrar - image: quay.io/k8scsi/csi-node-driver-registrar:canary + image: quay.io/k8scsi/csi-node-driver-registrar:v1.0.2 lifecycle: preStop: exec: diff --git a/pkg/hostpath/controllerserver.go b/pkg/hostpath/controllerserver.go index fa1a1d2c2..d09e959e7 100644 --- a/pkg/hostpath/controllerserver.go +++ b/pkg/hostpath/controllerserver.go @@ -22,6 +22,7 @@ import ( "os" "sort" "strconv" + "strings" "github.com/golang/protobuf/ptypes" @@ -38,8 +39,8 @@ import ( const ( deviceID = "deviceID" - provisionRoot = "/csi-data-dir/" - snapshotRoot = "/csi-data-dir/" + provisionRoot = "/csi-data-dir" + snapshotRoot = "/csi-data-dir" maxStorageCapacity = tib ) @@ -346,7 +347,9 @@ func (cs *controllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateS snapshotID := uuid.NewUUID().String() creationTime := ptypes.TimestampNow() volPath := hostPathVolume.VolPath - file := snapshotRoot + snapshotID + ".tgz" + filePath := []string{snapshotRoot, "/", snapshotID, ".tgz"} + file := strings.Join(filePath, "") + //file := snapshotRoot + snapshotID + ".tgz" args := []string{} if hostPathVolume.VolAccessType == blockAccess { glog.V(4).Infof("Creating snapshot of Raw Block Mode Volume") @@ -396,7 +399,9 @@ func (cs *controllerServer) DeleteSnapshot(ctx context.Context, req *csi.DeleteS } snapshotID := req.GetSnapshotId() glog.V(4).Infof("deleting volume %s", snapshotID) - path := snapshotRoot + snapshotID + ".tgz" + pathSlice := []string{snapshotRoot, "/", snapshotID, ".tgz"} + path := strings.Join(pathSlice, "") + //path := snapshotRoot + snapshotID + ".tgz" os.RemoveAll(path) delete(hostPathVolumeSnapshots, snapshotID) return &csi.DeleteSnapshotResponse{}, nil