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

kubeapi for matching pv/pvc to /dev/sd devices #4378

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

andrewd-zededa
Copy link
Contributor

@andrewd-zededa andrewd-zededa commented Oct 17, 2024

This will be used in an upcoming PR to create DiskMetric objects for cluster PVCs.

When a cluster volume is created it will show on the controller as the PVC name. This PVC(PersistentVolumeClaim) has a linked PV(PersistentVolume) which is the name of a block device under /dev/longhorn/ which itself shares the same major:minor pair as one /dev/sdX device. Volumemgr will use this API to map from PVC->PV->/dev/sdX device to link from existing sdX DiskMetric object to a cluster volume DiskMetric if it is currently attached on this node.

}

for _, devEnt := range blockDevs {
if !strings.HasPrefix(devEnt.Name(), "sd") {
Copy link
Contributor

Choose a reason for hiding this comment

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

@andrewd-zededa , why are you considering only sdX devices? What about devices that have NVMes that will be named into something like nvme0n1, nvme0n1p1, nvme0n1p2, nvme0n1p3?

Copy link
Contributor

Choose a reason for hiding this comment

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

And also eMMCs, that in this case will be named as something like mmcblk0p1, mmcblk0p2, etc...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rene this is filtering to only sdX devices as those are the only type which are presented as virtual frontend block devices by the longhorn engine we are using currently. I see your point though and this function could be opened up to build a map of all block devices or allow a filter passed in as a parameter to control the size of the map.

This will be used in an upcoming PR to
create DiskMetric objects for cluster PVCs.

Signed-off-by: Andrew Durbin <[email protected]>
@andrewd-zededa
Copy link
Contributor Author

I'm readying an updated commit with a fix found in testing this path.

@andrewd-zededa
Copy link
Contributor Author

Updated with the latest from the poc-oct03-2024 branch which resolves a problem where IsDir DiskMetrics were incorrectly unpublished.

I need to verify the new test runs before further review.

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.

3 participants