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

feat: Make PublishVolume compatible with Hosts and Host Groups #58

Merged

Conversation

David-T-White
Copy link

Add support for Host and Host Groups on the system when mapping volumes (addresses "duplicate lun" issue: Seagate/seagate-exos-x-csi#113). Update the openAPI generated code to accept the different possible return types of show maps depending on the presence of hosts and host groups vs raw initiators and make corresponding updates in volume publishing and LUN selection routines.

Changes:

  • Add "oneOf" support from OpenAPI as a parameter to the mc-commands.yaml spec and support this in spec.go
  • Adjust the oneOf "with discriminator" mustache template file to generate code that uses the returned object name appropriately for the API JSON
  • Use oneOf to support multiple possible return types in 'show maps initiator' commands.
  • Refactor Publish volume - duplicate mapping detection is now handled during LUN selection by adding the volumeID to the Volume type and comparing it when listing mappings. Addresses a CSI driver idempotency issue that may be seen with multiple identical PublishVolume RPCs.
  • Refactor ShowHostMaps to gather mappings from any of the possible return types of the show maps API calls.

Update the openAPI generated code to accept the different possible return types
of show maps depending on the presence of Hosts and Host Groups vs raw initiators.
Corresponding updates to the PublishVolume and LUN selection code.
if lun < 1 {
lun = vol.LUN
} else if lun != vol.LUN {
return -1, fmt.Errorf("found multiple LUNs (%d, %d) for volume %s", lun, vol.LUN, volumeID)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this an error? Is this restriction in line with other user interfaces, or just an assumption we want to make to keep the API code simpler?

@David-T-White David-T-White merged commit 8a20de9 into Seagate:main Jan 11, 2025
2 of 3 checks passed
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.

2 participants