Merge pull request #86612 from andyzhangx/azuredisk-excludepath

fix: azure disk could not mounted on Standard_DC4s/DC2s instances
This commit is contained in:
Kubernetes Prow Robot 2019-12-26 13:43:51 -08:00 committed by GitHub
commit 40320be679
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
}
}
}
}