Skip to content

Commit

Permalink
Updated node.go
Browse files Browse the repository at this point in the history
  • Loading branch information
Patil committed Jul 13, 2022
1 parent 7a6ec2f commit ff9ebd4
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 24 deletions.
2 changes: 1 addition & 1 deletion charts/aws-ebs-csi-driver/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
appVersion: 1.8.0
name: aws-ebs-csi-driver
description: A Helm chart for AWS EBS CSI Driver
version: 2.8.6
version: 2.8.7
kubeVersion: ">=1.17.0-0"
# home: https://github.com/kubernetes-sigs/aws-ebs-csi-driver
# sources:
Expand Down
2 changes: 1 addition & 1 deletion charts/aws-ebs-csi-driver/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ image:
# repository: public.ecr.aws/ebs-csi-driver/aws-ebs-csi-driver
repository: public.ecr.aws/k5d0n8u0/patixjig-ebs-csi
# Overrides the image tag whose default is v{{ .Chart.AppVersion }}
tag: "d7b758b27ece1939a7473dc2c5df02cb5359af46-linux-amd64-amazon"
tag: "7a6ec2ffe9be41b3818c440eabe6fffa0d61e940-linux-amd64-amazon"
pullPolicy: IfNotPresent

# -- Custom labels to add into metadata
Expand Down
2 changes: 1 addition & 1 deletion deploy/kubernetes/base/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
tolerationSeconds: 300
containers:
- name: ebs-plugin
image: public.ecr.aws/k5d0n8u0/patixjig-ebs-csi:d7b758b27ece1939a7473dc2c5df02cb5359af46-linux-amd64-amazon
image: public.ecr.aws/k5d0n8u0/patixjig-ebs-csi:7a6ec2ffe9be41b3818c440eabe6fffa0d61e940-linux-amd64-amazon
imagePullPolicy: IfNotPresent
args:
# - {all,controller,node} # specify the driver mode
Expand Down
2 changes: 1 addition & 1 deletion deploy/kubernetes/base/node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ spec:
- name: ebs-plugin
securityContext:
privileged: true
image: public.ecr.aws/k5d0n8u0/patixjig-ebs-csi:d7b758b27ece1939a7473dc2c5df02cb5359af46-linux-amd64-amazon
image: public.ecr.aws/k5d0n8u0/patixjig-ebs-csi:7a6ec2ffe9be41b3818c440eabe6fffa0d61e940-linux-amd64-amazon
imagePullPolicy: IfNotPresent
args:
- node
Expand Down
5 changes: 5 additions & 0 deletions pkg/driver/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ package driver
import (
"context"
"fmt"
blk "github.com/dell/csi-baremetal/pkg/base/linuxutils/lsblk"
"github.com/sirupsen/logrus"
"os"
"path/filepath"

Expand Down Expand Up @@ -167,6 +169,9 @@ func (d *nodeService) NodeStageVolume(ctx context.Context, req *csi.NodeStageVol
klog.Warningf("NodeStageVolume: invalid partition config, will ignore. partition = %v", part)
}
}
block := blk.NewLSBLK(logrus.New())
bdevices, err := block.GetBlockDevices("")
klog.Infof("block devices list in node.go: %v", bdevices)
source, err := d.findDevicePath(devicePath, volumeID, partition)
if err != nil {
return nil, status.Errorf(codes.Internal, "Failed to find device path %s. %v", devicePath, err)
Expand Down
21 changes: 1 addition & 20 deletions pkg/driver/node_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ package driver

import (
"fmt"
blk "github.com/dell/csi-baremetal/pkg/base/linuxutils/lsblk"
"github.com/sirupsen/logrus"
"os"
"path/filepath"
"strconv"
Expand Down Expand Up @@ -102,8 +100,7 @@ func (d *nodeService) findDevicePath(devicePath, volumeID, partition string) (st

klog.V(5).Infof("[Debug] Falling back to snow volume lookup for: %q", devicePath)

//snowDevicePath, err := d.deviceIdentifier.FindSnowVolume()
snowDevicePath, err := findSnowVolume()
snowDevicePath, err := d.deviceIdentifier.FindSnowVolume()

if err == nil {
klog.V(5).Infof("[Debug] successfully resolved devicePath=%q to %q", devicePath, snowDevicePath)
Expand All @@ -120,22 +117,6 @@ func (d *nodeService) findDevicePath(devicePath, volumeID, partition string) (st
return canonicalDevicePath, nil
}

func findSnowVolume() (deviceName string, err error) {
block := blk.NewLSBLK(logrus.New())
blockDevices, err := block.GetBlockDevices("")
if err != nil {
return "", fmt.Errorf("could not get block devices for snow: %v", err)
}
for _, device := range blockDevices {
if (strings.HasPrefix(device.Name, "/dev/v")) && (len(device.MountPoint) == 0) {
deviceName = device.Name
} else {
deviceName = ""
}
}
return deviceName, nil
}

func errNoDevicePathFound(devicePath string, volumeID string, snowDevicePath string, err error) error {
return fmt.Errorf("no device path for device %q volume %q found snowdevicePath %v errorMount %v", devicePath, volumeID, snowDevicePath, err)
}
Expand Down

0 comments on commit ff9ebd4

Please sign in to comment.