k3s/pkg/volume/azure_dd
Kubernetes Submit Queue d8680a3c43
Merge pull request #57549 from andyzhangx/azurediskid-fix
Automatic merge from submit-queue (batch tested with PRs 56382, 57549). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

fix azure disk not available issue when device name changed

**What this PR does / why we need it**:
There is possibility that device name(`/dev/sd*`) would change when attach/detach data disk in Azure VM according to  [Troubleshoot Linux VM device name change](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/troubleshoot-device-names-problems). 
And We did hit this issue, see customer [case](https://github.com/Azure/acs-engine/issues/1918). 
This PR would use `/dev/disk/by-id` instead of `/dev/sd*` for azure disk and `/dev/disk/by-id` would not change even device name changed.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #57444

**Special notes for your reviewer**:
In a customer [case](https://github.com/Azure/acs-engine/issues/1918), customer is unable to use azure disk in StatefulSet since /dev/sd* changed after detach/attach disk. 
we are using `/dev/sd*`(code is [here](https://github.com/kubernetes/kubernetes/blob/master/pkg/volume/azure_dd/azure_common_linux.go#L140)) to "mount -bind" k8s path, while `/dev/sd*` could be changed when VM is attach/detaching data disks, see [Troubleshoot Linux VM device name change](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/troubleshoot-device-names-problems)
And I have also checked related AWS, GCE code, they are using `/dev/disk/by-id/` other than `/dev/sd*`, see [aws code](https://github.com/kubernetes/kubernetes/blob/master/pkg/volume/aws_ebs/aws_util.go#L228)  
[gce code](https://github.com/kubernetes/kubernetes/blob/master/pkg/volume/gce_pd/gce_util.go#L278)

**Release note**:

```
fix azure disk not available when device name changed
```
/sig azure
/assign @rootfs 
@karataliu @brendandburns @khenidak
2018-01-04 06:40:34 -08:00
..
BUILD Autogenerate BUILD files 2017-12-23 13:12:11 -08:00
OWNERS add Dong Liu as approver and add OWNERS in credentialprovider 2017-12-19 09:31:43 +00:00
attacher.go Print/return the text from a number of errors that were silent before. 2017-12-21 00:25:46 +00:00
azure_common.go add Standard GRS, RAGRS support for azure disk 2017-11-17 09:13:17 +00:00
azure_common_linux.go prefer /dev/disk/azure/scsi1/ over by-id for azure disk 2018-01-03 09:33:42 +00:00
azure_common_test.go TestIoHandler should not run on unsupported platforms 2017-09-20 00:35:58 -07:00
azure_common_unsupported.go enable azure disk mount on windows node 2017-09-12 01:52:48 +00:00
azure_common_windows.go enable azure disk mount on windows node 2017-09-12 01:52:48 +00:00
azure_dd.go search by accounttype in CreateVolume func 2017-11-19 11:18:08 +00:00
azure_dd_test.go Adding dynamic Flexvolume plugin discovery capability, using filesystem watch. 2017-08-25 11:42:32 -07:00
azure_mounter.go add mount options for azure disk 2017-11-21 13:12:51 +00:00
azure_provision.go search by accounttype in CreateVolume func 2017-11-19 11:18:08 +00:00