Fix support for VolumeId dimension on nitro instances
Description of the issue
Linux allows mounting disks using a device alias (symlink) but the CWAgent is not able to resolve the EBS VolumeId for the device. Fixes #1727.
When PR #1156 implemented support to use ${aws:VolumeId} for a dimension value, it included extensive normalization of the device name:
https://github.com/aws/amazon-cloudwatch-agent/blob/4123ffc888f6e864cc5a75ee653033464a2a9783/plugins/processors/ec2tagger/internal/volume/volume.go#L109-L145
This linux specific logic runs for all platforms, prevents the device names returned by the describeVolumesProvider (DescribeVolumes.Volumes.Attachments) from being included in the volume cache map. This normalization is not needed for the results of the linux hostProvider as it enumerates the devices registered in /sys/block/.
Description of changes
- Move normalization of device name (trimming prefix
/dev/) todescribeVolumesProvider.DeviceToSerialMapmethod. - Remove normalization from volume provider.
- Enables support for having multiple device names in volume cache with the same device serial (volumeId).
License
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Tests
- Updated and ran unit tests.
- Built linux binary and tested on above system.
Requirements
Before commiting your code, please do the following steps.
- [x] Run
make fmtandmake fmt-sh - [x] Run
make lint
Integration Tests
To run integration tests against this PR, add the ready for testing label.
This PR was marked stale due to lack of activity.
This PR was marked stale due to lack of activity.
poke
This PR was marked stale due to lack of activity.
bump
This PR was marked stale due to lack of activity.
ping
This PR was marked stale due to lack of activity.
ping
This PR was marked stale due to lack of activity.