mirror of https://github.com/k3s-io/k3s
Merge pull request #66174 from ddebroy/scaleio1
Automatic merge from submit-queue (batch tested with PRs 64690, 66174). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Check presence of /dev/disk/by-id before reading it in ScaleIO **What this PR does / why we need it**: In certain OS environments, like RHEL 7.4 using Xen PV driver `xen_blkfront` for boot and data disks, the path `/dev/disk/by-id` does not exist in the OS post boot. When trying to dynamically provision PVs from a ScaleIO storageclass in such an environment, ScaleIO fails when trying to create the PV with: ``` E0711 08:02:50.441964 25246 sio_client.go:342] scaleio: failed to ReadDir /dev/disk/by-id: open /dev/disk/by-id: no such file or directory E0711 08:02:50.441989 25246 sio_volume.go:123] scaleio: setup of volume k8svol-282bd4fa84d: open /dev/disk/by-id: no such file or directory ``` This PR avoids the above failure by first checking for the presence of `/dev/disk/by-id` before attempting to read from it as done in other drivers like gce_pd. **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes # **Special notes for your reviewer**: **Release note**: ```release-note NONE ``` /sig storagepull/8/head
commit
78082a6a28
|
@ -339,10 +339,14 @@ func (c *sioClient) getGuid() (string, error) {
|
||||||
func (c *sioClient) getSioDiskPaths() ([]os.FileInfo, error) {
|
func (c *sioClient) getSioDiskPaths() ([]os.FileInfo, error) {
|
||||||
files, err := ioutil.ReadDir(sioDiskIDPath)
|
files, err := ioutil.ReadDir(sioDiskIDPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Error(log("failed to ReadDir %s: %v", sioDiskIDPath, err))
|
if os.IsNotExist(err) {
|
||||||
return nil, err
|
// sioDiskIDPath may not exist yet which is fine
|
||||||
|
return []os.FileInfo{}, nil
|
||||||
|
} else {
|
||||||
|
glog.Error(log("failed to ReadDir %s: %v", sioDiskIDPath, err))
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result := []os.FileInfo{}
|
result := []os.FileInfo{}
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
if c.diskRegex.MatchString(file.Name()) {
|
if c.diskRegex.MatchString(file.Name()) {
|
||||||
|
|
Loading…
Reference in New Issue