mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 09:49:50 +00:00
fix devicePath update issue in Azure WaitForAttach func
add WaitForAttach logging
This commit is contained in:
parent
860403dada
commit
3a0fb103c2
@ -150,27 +150,36 @@ func (a *azureDiskAttacher) VolumesAreAttached(specs []*volume.Spec, nodeName ty
|
|||||||
|
|
||||||
func (a *azureDiskAttacher) WaitForAttach(spec *volume.Spec, devicePath string, _ *v1.Pod, timeout time.Duration) (string, error) {
|
func (a *azureDiskAttacher) WaitForAttach(spec *volume.Spec, devicePath string, _ *v1.Pod, timeout time.Duration) (string, error) {
|
||||||
var err error
|
var err error
|
||||||
lun, err := strconv.Atoi(devicePath)
|
|
||||||
if err != nil {
|
|
||||||
return "", fmt.Errorf("azureDisk - Wait for attach expect device path as a lun number, instead got: %s (%v)", devicePath, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
volumeSource, err := getVolumeSource(spec)
|
volumeSource, err := getVolumeSource(spec)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
diskController, err := getDiskController(a.plugin.host)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
nodeName := types.NodeName(a.plugin.host.GetHostName())
|
||||||
|
diskName := volumeSource.DiskName
|
||||||
|
|
||||||
|
glog.V(5).Infof("azureDisk - WaitForAttach: begin to GetDiskLun by diskName(%s), DataDiskURI(%s), nodeName(%s), devicePath(%s)",
|
||||||
|
diskName, volumeSource.DataDiskURI, nodeName, devicePath)
|
||||||
|
lun, err := diskController.GetDiskLun(diskName, volumeSource.DataDiskURI, nodeName)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
glog.V(5).Infof("azureDisk - WaitForAttach: GetDiskLun succeeded, got lun(%v)", lun)
|
||||||
exec := a.plugin.host.GetExec(a.plugin.GetPluginName())
|
exec := a.plugin.host.GetExec(a.plugin.GetPluginName())
|
||||||
|
|
||||||
io := &osIOHandler{}
|
io := &osIOHandler{}
|
||||||
scsiHostRescan(io, exec)
|
scsiHostRescan(io, exec)
|
||||||
|
|
||||||
diskName := volumeSource.DiskName
|
|
||||||
nodeName := a.plugin.host.GetHostName()
|
|
||||||
newDevicePath := ""
|
newDevicePath := ""
|
||||||
|
|
||||||
err = wait.Poll(1*time.Second, timeout, func() (bool, error) {
|
err = wait.Poll(1*time.Second, timeout, func() (bool, error) {
|
||||||
if newDevicePath, err = findDiskByLun(lun, io, exec); err != nil {
|
if newDevicePath, err = findDiskByLun(int(lun), io, exec); err != nil {
|
||||||
return false, fmt.Errorf("azureDisk - WaitForAttach ticker failed node (%s) disk (%s) lun(%v) err(%s)", nodeName, diskName, lun, err)
|
return false, fmt.Errorf("azureDisk - WaitForAttach ticker failed node (%s) disk (%s) lun(%v) err(%s)", nodeName, diskName, lun, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user