From f7e4fd8a651f18ec88af316e27744cb79fcebe8e Mon Sep 17 00:00:00 2001 From: andyzhangx Date: Wed, 25 Dec 2019 13:55:58 +0000 Subject: [PATCH] fix: azure disk could not mounted on Standard_DC4s/DC2s instances --- pkg/volume/azure_dd/azure_common_linux.go | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/pkg/volume/azure_dd/azure_common_linux.go b/pkg/volume/azure_dd/azure_common_linux.go index f37e8686a15e..9da9adfef032 100644 --- a/pkg/volume/azure_dd/azure_common_linux.go +++ b/pkg/volume/azure_dd/azure_common_linux.go @@ -29,17 +29,20 @@ import ( utilexec "k8s.io/utils/exec" ) -// exclude those used by azure as resource and OS root in /dev/disk/azure +// exclude those used by azure as resource and OS root in /dev/disk/azure, /dev/disk/azure/scsi0 +// "/dev/disk/azure/scsi0" dir is populated in Standard_DC4s/DC2s on Ubuntu 18.04 func listAzureDiskPath(io ioHandler) []string { - azureDiskPath := "/dev/disk/azure/" var azureDiskList []string - if dirs, err := io.ReadDir(azureDiskPath); err == nil { - for _, f := range dirs { - name := f.Name() - diskPath := azureDiskPath + name - if link, linkErr := io.Readlink(diskPath); linkErr == nil { - sd := link[(libstrings.LastIndex(link, "/") + 1):] - azureDiskList = append(azureDiskList, sd) + azureResourcePaths := []string{"/dev/disk/azure/", "/dev/disk/azure/scsi0/"} + for _, azureDiskPath := range azureResourcePaths { + if dirs, err := io.ReadDir(azureDiskPath); err == nil { + for _, f := range dirs { + name := f.Name() + diskPath := filepath.Join(azureDiskPath, name) + if link, linkErr := io.Readlink(diskPath); linkErr == nil { + sd := link[(libstrings.LastIndex(link, "/") + 1):] + azureDiskList = append(azureDiskList, sd) + } } } }