mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
csi: rename volume Mounter to Manager (#18434)
to align with its broader purpose, and the volumeManager implementation
This commit is contained in:
@@ -107,10 +107,10 @@ func (i *instanceManager) setupVolumeManager() {
|
||||
}
|
||||
}
|
||||
|
||||
// VolumeMounter returns the volume manager that is configured for the given plugin
|
||||
// VolumeManager returns the volume manager that is configured for the given plugin
|
||||
// instance. If called before the volume manager has been setup, it will block until
|
||||
// the volume manager is ready or the context is closed.
|
||||
func (i *instanceManager) VolumeMounter(ctx context.Context) (VolumeMounter, error) {
|
||||
func (i *instanceManager) VolumeManager(ctx context.Context) (VolumeManager, error) {
|
||||
select {
|
||||
case <-i.volumeManagerSetupCh:
|
||||
return i.volumeManager, nil
|
||||
|
||||
@@ -53,7 +53,7 @@ func (u *UsageOptions) ToFS() string {
|
||||
return sb.String()
|
||||
}
|
||||
|
||||
type VolumeMounter interface {
|
||||
type VolumeManager interface {
|
||||
MountVolume(ctx context.Context, vol *structs.CSIVolume, alloc *structs.Allocation, usageOpts *UsageOptions, publishContext map[string]string) (*MountInfo, error)
|
||||
UnmountVolume(ctx context.Context, volID, remoteID, allocID string, usageOpts *UsageOptions) error
|
||||
HasMount(ctx context.Context, mountInfo *MountInfo) (bool, error)
|
||||
@@ -68,9 +68,9 @@ type Manager interface {
|
||||
// or until its context is canceled or times out.
|
||||
WaitForPlugin(ctx context.Context, pluginType, pluginID string) error
|
||||
|
||||
// MounterForPlugin returns a VolumeMounter for the plugin ID associated
|
||||
// ManagerForPlugin returns a VolumeManager for the plugin ID associated
|
||||
// with the volume. Returns an error if this plugin isn't registered.
|
||||
MounterForPlugin(ctx context.Context, pluginID string) (VolumeMounter, error)
|
||||
ManagerForPlugin(ctx context.Context, pluginID string) (VolumeManager, error)
|
||||
|
||||
// Shutdown shuts down the Manager and unmounts any locally attached volumes.
|
||||
Shutdown()
|
||||
|
||||
@@ -93,7 +93,7 @@ func (c *csiManager) WaitForPlugin(ctx context.Context, pType, pID string) error
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *csiManager) MounterForPlugin(ctx context.Context, pluginID string) (VolumeMounter, error) {
|
||||
func (c *csiManager) ManagerForPlugin(ctx context.Context, pluginID string) (VolumeManager, error) {
|
||||
c.instancesLock.RLock()
|
||||
defer c.instancesLock.RUnlock()
|
||||
nodePlugins, hasAnyNodePlugins := c.instances["csi-node"]
|
||||
@@ -106,7 +106,7 @@ func (c *csiManager) MounterForPlugin(ctx context.Context, pluginID string) (Vol
|
||||
return nil, fmt.Errorf("plugin %s for type csi-node not found", pluginID)
|
||||
}
|
||||
|
||||
return mgr.VolumeMounter(ctx)
|
||||
return mgr.VolumeManager(ctx)
|
||||
}
|
||||
|
||||
// Run starts a plugin manager and should return early
|
||||
|
||||
@@ -20,7 +20,7 @@ import (
|
||||
"github.com/hashicorp/nomad/plugins/csi"
|
||||
)
|
||||
|
||||
var _ VolumeMounter = &volumeManager{}
|
||||
var _ VolumeManager = &volumeManager{}
|
||||
|
||||
const (
|
||||
DefaultMountActionTimeout = 2 * time.Minute
|
||||
|
||||
Reference in New Issue
Block a user