Skip to content

Commit 40320be

Browse files
authored
Merge pull request kubernetes#86612 from andyzhangx/azuredisk-excludepath
fix: azure disk could not mounted on Standard_DC4s/DC2s instances
2 parents aad7394 + 3639339 commit 40320be

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

pkg/volume/azure_dd/azure_common_linux.go

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,20 @@ import (
2929
utilexec "k8s.io/utils/exec"
3030
)
3131

32-
// exclude those used by azure as resource and OS root in /dev/disk/azure
32+
// exclude those used by azure as resource and OS root in /dev/disk/azure, /dev/disk/azure/scsi0
33+
// "/dev/disk/azure/scsi0" dir is populated in Standard_DC4s/DC2s on Ubuntu 18.04
3334
func listAzureDiskPath(io ioHandler) []string {
34-
azureDiskPath := "/dev/disk/azure/"
3535
var azureDiskList []string
36-
if dirs, err := io.ReadDir(azureDiskPath); err == nil {
37-
for _, f := range dirs {
38-
name := f.Name()
39-
diskPath := azureDiskPath + name
40-
if link, linkErr := io.Readlink(diskPath); linkErr == nil {
41-
sd := link[(libstrings.LastIndex(link, "/") + 1):]
42-
azureDiskList = append(azureDiskList, sd)
36+
azureResourcePaths := []string{"/dev/disk/azure/", "/dev/disk/azure/scsi0/"}
37+
for _, azureDiskPath := range azureResourcePaths {
38+
if dirs, err := io.ReadDir(azureDiskPath); err == nil {
39+
for _, f := range dirs {
40+
name := f.Name()
41+
diskPath := filepath.Join(azureDiskPath, name)
42+
if link, linkErr := io.Readlink(diskPath); linkErr == nil {
43+
sd := link[(libstrings.LastIndex(link, "/") + 1):]
44+
azureDiskList = append(azureDiskList, sd)
45+
}
4346
}
4447
}
4548
}

0 commit comments

Comments
 (0)