mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 14:07:14 +00:00
Merge pull request #86612 from andyzhangx/azuredisk-excludepath
fix: azure disk could not mounted on Standard_DC4s/DC2s instances
This commit is contained in:
commit
40320be679
@ -29,17 +29,20 @@ import (
|
|||||||
utilexec "k8s.io/utils/exec"
|
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 {
|
func listAzureDiskPath(io ioHandler) []string {
|
||||||
azureDiskPath := "/dev/disk/azure/"
|
|
||||||
var azureDiskList []string
|
var azureDiskList []string
|
||||||
if dirs, err := io.ReadDir(azureDiskPath); err == nil {
|
azureResourcePaths := []string{"/dev/disk/azure/", "/dev/disk/azure/scsi0/"}
|
||||||
for _, f := range dirs {
|
for _, azureDiskPath := range azureResourcePaths {
|
||||||
name := f.Name()
|
if dirs, err := io.ReadDir(azureDiskPath); err == nil {
|
||||||
diskPath := azureDiskPath + name
|
for _, f := range dirs {
|
||||||
if link, linkErr := io.Readlink(diskPath); linkErr == nil {
|
name := f.Name()
|
||||||
sd := link[(libstrings.LastIndex(link, "/") + 1):]
|
diskPath := filepath.Join(azureDiskPath, name)
|
||||||
azureDiskList = append(azureDiskList, sd)
|
if link, linkErr := io.Readlink(diskPath); linkErr == nil {
|
||||||
|
sd := link[(libstrings.LastIndex(link, "/") + 1):]
|
||||||
|
azureDiskList = append(azureDiskList, sd)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user