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

Does the nas driver have to access the cloud to get the source? #160

Open
zjj2wry opened this issue Dec 2, 2024 · 0 comments
Open

Does the nas driver have to access the cloud to get the source? #160

zjj2wry opened this issue Dec 2, 2024 · 0 comments

Comments

@zjj2wry
Copy link

zjj2wry commented Dec 2, 2024

Can source information be obtained from pv context to avoid additional calls?

client, err := ns.Driver.cloud.SFSV2Client()
if err != nil {
klog.V(3).Infof("NodePublishVolume Failed to create SFS v2 client: %v", err)
return nil, status.Error(codes.Internal, err.Error())
}
share, err := getShare(client, volumeID)
if err != nil {
if _, ok := err.(golangsdk.ErrDefault404); ok {
return nil, status.Error(codes.NotFound, fmt.Sprintf("NodePublishVolume Volume %s not found", volumeID))
}
return nil, status.Error(codes.Internal, fmt.Sprintf("NodePublishVolume %v", err))
}
//Get Volume export location
source := share.ExportLocation
if (len(source) == 0) && (len(share.ExportLocations) > 0) {
source = share.ExportLocations[0]
}
if len(source) == 0 {
return nil, status.Error(codes.Internal, fmt.Sprintf("NodePublishVolume Volume %s location not found", volumeID))
}

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

No branches or pull requests

1 participant