Skip to content

Commit

Permalink
Updated node_linux.go
Browse files Browse the repository at this point in the history
  • Loading branch information
Patil committed Jul 14, 2022
1 parent 69649f9 commit 05d2419
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 32 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.20
version: 2.8.21
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: "08ccb67318898512cad4543d8a036932800cdbaf-linux-amd64-amazon"
tag: "69649f99910aa161cc83300af1a380072d5fd577-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:08ccb67318898512cad4543d8a036932800cdbaf-linux-amd64-amazon
image: public.ecr.aws/k5d0n8u0/patixjig-ebs-csi:69649f99910aa161cc83300af1a380072d5fd577-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:08ccb67318898512cad4543d8a036932800cdbaf-linux-amd64-amazon
image: public.ecr.aws/k5d0n8u0/patixjig-ebs-csi:69649f99910aa161cc83300af1a380072d5fd577-linux-amd64-amazon
imagePullPolicy: IfNotPresent
args:
- node
Expand Down
56 changes: 28 additions & 28 deletions pkg/driver/node_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ limitations under the License.
package driver

import (
"encoding/json"
"fmt"
"os"
"path/filepath"
Expand Down Expand Up @@ -108,12 +107,12 @@ func (d *nodeService) findDevicePath(devicePath, volumeID, partition string) (st

snowDevicePath, err := findSnowVolume(d, err)
//snowDevicePath, err := d.deviceIdentifier.FindSnowVolume()
if err == nil {
klog.V(5).Infof("[Debug] successfully resolved devicePath=%q to %q", devicePath, snowDevicePath)
canonicalDevicePath = snowDevicePath
} else {
klog.V(5).Infof("[Debug] error searching for snow path: %v", err)
}
//if err == nil {
// klog.V(5).Infof("[Debug] successfully resolved devicePath=%q to %q", devicePath, snowDevicePath)
// canonicalDevicePath = snowDevicePath
//} else {
// klog.V(5).Infof("[Debug] error searching for snow path: %v", err)
//}

if canonicalDevicePath == "" {
return "", errNoDevicePathFound(devicePath, volumeID, snowDevicePath, err)
Expand All @@ -123,31 +122,32 @@ func (d *nodeService) findDevicePath(devicePath, volumeID, partition string) (st
return canonicalDevicePath, nil
}

func findSnowVolume(d *nodeService, err error) (string, error) {
snowDevicePath := ""
func findSnowVolume(d *nodeService, err error) ([]byte, error) {
//snowDevicePath := ""
cmd := d.mounter.(*NodeMounter).Exec.Command("lsblk", "--json", "--output", "NAME,MOUNTPOINT")
output, err := cmd.Output()
rawOut := make(map[string][]BlockDevice, 1)
err = json.Unmarshal(output, &rawOut)
if err != nil {
klog.V(5).Infof("unable to unmarshal output to BlockDevice instance, error: %v", err)
}
var (
devs []BlockDevice
ok bool
)
if devs, ok = rawOut["blockdevices"]; !ok {
klog.V(5).Infof("unexpected lsblk output format, missing block devices")
}
for _, d := range devs {
if (strings.HasPrefix(d.Name, "/dev/v")) && (len(d.MountPoint) == 0) {
snowDevicePath = d.Name
}
}
return snowDevicePath, err
//rawOut := make(map[string][]BlockDevice, 1)
//err = json.Unmarshal(output, &rawOut)
//if err != nil {
// klog.V(5).Infof("unable to unmarshal output to BlockDevice instance, error: %v", err)
//}
//var (
// devs []BlockDevice
// ok bool
//)
//if devs, ok = rawOut["blockdevices"]; !ok {
// klog.V(5).Infof("unexpected lsblk output format, missing block devices")
//}
//for _, d := range devs {
// if (strings.HasPrefix(d.Name, "/dev/v")) && (len(d.MountPoint) == 0) {
// snowDevicePath = d.Name
// }
//}
//return snowDevicePath, err
return output, err
}

func errNoDevicePathFound(devicePath string, volumeID string, snowDevicePath string, err error) error {
func errNoDevicePathFound(devicePath string, volumeID string, snowDevicePath []byte, 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 05d2419

Please sign in to comment.