mirror of
https://github.com/kemko/nomad.git
synced 2026-01-07 10:55:42 +03:00
csi: use ExternalID, when set, to identify volumes for outside RPC calls (#7326)
* nomad/structs/csi: new RemoteID() uses the ExternalID if set * nomad/csi_endpoint: pass RemoteID to volume request types * client/pluginmanager/csimanager/volume: pass RemoteID to NodePublishVolume
This commit is contained in:
@@ -181,7 +181,7 @@ func (v *volumeManager) publishVolume(ctx context.Context, vol *structs.CSIVolum
|
||||
}
|
||||
|
||||
err = v.plugin.NodePublishVolume(ctx, &csi.NodePublishVolumeRequest{
|
||||
VolumeID: vol.ID,
|
||||
VolumeID: vol.RemoteID(),
|
||||
PublishContext: publishContext,
|
||||
StagingTargetPath: pluginStagingPath,
|
||||
TargetPath: pluginTargetPath,
|
||||
|
||||
@@ -247,7 +247,7 @@ func (srv *Server) controllerValidateVolume(req *structs.CSIVolumeRegisterReques
|
||||
|
||||
method := "ClientCSIController.ValidateVolume"
|
||||
cReq := &cstructs.ClientCSIControllerValidateVolumeRequest{
|
||||
VolumeID: vol.ID,
|
||||
VolumeID: vol.RemoteID(),
|
||||
AttachmentMode: vol.AttachmentMode,
|
||||
AccessMode: vol.AccessMode,
|
||||
}
|
||||
@@ -532,7 +532,7 @@ func (srv *Server) controllerPublishVolume(req *structs.CSIVolumeClaimRequest, r
|
||||
|
||||
method := "ClientCSIController.AttachVolume"
|
||||
cReq := &cstructs.ClientCSIControllerAttachVolumeRequest{
|
||||
VolumeID: req.VolumeID,
|
||||
VolumeID: vol.RemoteID(),
|
||||
ClientCSINodeID: targetCSIInfo.NodeInfo.ID,
|
||||
AttachmentMode: vol.AttachmentMode,
|
||||
AccessMode: vol.AccessMode,
|
||||
@@ -587,7 +587,7 @@ func (srv *Server) controllerUnpublishVolume(req *structs.CSIVolumeClaimRequest,
|
||||
|
||||
method := "ClientCSIController.DetachVolume"
|
||||
cReq := &cstructs.ClientCSIControllerDetachVolumeRequest{
|
||||
VolumeID: req.VolumeID,
|
||||
VolumeID: vol.RemoteID(),
|
||||
ClientCSINodeID: targetCSIInfo.NodeInfo.ID,
|
||||
}
|
||||
cReq.PluginID = plug.ID
|
||||
|
||||
@@ -212,6 +212,13 @@ func (v *CSIVolume) newStructs() {
|
||||
v.WriteAllocs = map[string]*Allocation{}
|
||||
}
|
||||
|
||||
func (v *CSIVolume) RemoteID() string {
|
||||
if v.ExternalID != "" {
|
||||
return v.ExternalID
|
||||
}
|
||||
return v.ID
|
||||
}
|
||||
|
||||
func (v *CSIVolume) Stub() *CSIVolListStub {
|
||||
stub := CSIVolListStub{
|
||||
ID: v.ID,
|
||||
|
||||
Reference in New Issue
Block a user