amazon-ecs-agent icon indicating copy to clipboard operation
amazon-ecs-agent copied to clipboard

added the implementation for IsBlockDevice method in CSI Driver for Windows

Open rawahars opened this issue 1 year ago • 0 comments

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.

rawahars avatar Jun 28 '24 06:06 rawahars