Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added the implementation for IsBlockDevice method in CSI Driver for Windows #4224

Open
wants to merge 2 commits into
base: feature/ebs-windows
Choose a base branch
from

Conversation

rawahars
Copy link
Contributor

Summary

Presently, we were using the empty implementation of the IsBlockDevice method for Windows. In this change, we will add the same.

In order to accomplish the same, we use GetVolumeNameForVolumeMountPointW Win32 API. Reference: https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getvolumenameforvolumemountpointw

We will call the API to fetch the Volume GUID. If the mount path is invalid, this method would fail and therefore, we can be certain that the mount path is not the block device mount path.

Implementation details

Added the implementation to invoke Win32 API for GetVolumeNameForVolumeMountPointW to figure out if the device is block device or not. Also, since the implementation depended upon golang.org/x/sys/windows, the same were vendor'ed in.

Testing

A sample binary was created with the same changes as the method implementation in this PR. That was tested for block and non-block devices.

New tests cover the changes: Yes

Description for the changelog

added the implementation for IsBlockDevice method in CSI Driver for Windows

Does this PR include breaking model changes? If so, Have you added transformation functions?

No

Licensing

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

…indows

Presently, we were using the empty implementation of the IsBlockDevice method for Windows. In this change, we will add the same.

In order to accomplish the same, we use `GetVolumeNameForVolumeMountPointW` Win32 API. Reference: https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getvolumenameforvolumemountpointw

We will call the API to fetch the Volume GUID. If the mount path is invalid, this method would fail and therefore, we can be certain that the mount path is not the block device mount path.
This change adds `golang.org/x/sys/windows` dependencies as vendor dependencies.
Copy link
Contributor

@saurabhc123 saurabhc123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants