Skip to content

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

Closed
@zjj2wry

Description

@zjj2wry

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))
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions