• Kubernetes Submit Queue's avatar
    Merge pull request #52401 from andyzhangx/azuredisk-getdevfunc · f34a24e9
    Kubernetes Submit Queue authored
    Automatic merge from submit-queue. 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 warning messages due to GetMountRefs func not implemented in windows
    
    **What this PR does / why we need it**:
    This PR completes the windows implementation of GetMountRefs in mount.go. In linux, the GetMountRefs implementaion is: read `/proc/mounts` and find all mount points, while in Windows, there is no such `/proc/mounts` place which shows all mounting points. 
    There is another way in windows, **we could walk through(by `getAllParentLinks` func) the mount path(symbolic link) and get all symlinks until we got the final device, which is actually a drive**.
    
    **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #54670
    This PR fixed the warnning issue mentioned in https://github.com/kubernetes/kubernetes/pull/51252
    
    **Special notes for your reviewer**:
    Some values in the code would be like follwoing:
    ```
    GetMountRefs: mountPath ("\\var\\lib\\kubelet\\pods/4c74b128-92ca-11e7-b86b-000d3a36d70c/volumes/kubernetes.io~azure-disk/pvc-1cc91c70-92ca-11e7-b86b-000d3a36d70c")
    getAllParentLinks: refs (["" "" "c:\\var\\lib\\kubelet\\plugins\\kubernetes.io\\azure-disk\\mounts\\b1246717734" "G:\\"])
    basemountPath c:\var\lib\kubelet\plugins\kubernetes.io\azure-disk\mounts
    got volumeID b1246717734
    ```
    
    **Release note**:
    
    ```
    fix warning messages due to GetMountRefs func not implemented in windows
    ```
    f34a24e9
mount_linux.go 21.7 KB