creator

package
v4.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AccessKrb5ReadOnly  = "read_only"
	AccessKrb5ReadWrite = "read_write"
	AccessKrb5ReadNone  = "none"
)
View Source
const (
	// AllocTypeKey is the string of AllocType's key
	AllocTypeKey = "alloctype"
	// AllSquashKey is the string of AllSquash's key
	AllSquashKey = "allsquash"
	// AuthClientKey is the string of AuthClient's key
	AuthClientKey = "authclient"
	// BackendKey is the string of Backend's key
	BackendKey = "backend"
	// CapacityKey is the string of Capacity's key
	CapacityKey = "capacity"
	// DescriptionKey is the string of Description's key
	DescriptionKey = "description"
	// MetroDomainIDKey is the string of MetroDomainID's key
	MetroDomainIDKey = "metroDomainID"
	// PvcNameKey is the string of PvcName's key
	PvcNameKey = "name"
	// PoolIDKey is the string of PoolID's key
	PoolIDKey = "poolID"
	// RootSquashKey is the string of RootSquash's key
	RootSquashKey = "rootsquash"
	// StoragePoolKey is the string of StoragePool's key
	StoragePoolKey = "storagepool"
	// ActiveVStoreIDKey is the string of ActiveVStoreID's key
	ActiveVStoreIDKey = "localVStoreID"
	// StandByVStoreIDKey is the string of StandByVStoreID's key
	StandByVStoreIDKey = "remoteVStoreID"
	// CloneFromKey is the string of CloneFrom's key
	CloneFromKey = "clonefrom"
	// CloneSpeedKey is the string of CloneSpeed's key
	CloneSpeedKey = "clonespeed"
	// SourceVolumeNameKey is the string of SourceVolumeName's key
	SourceVolumeNameKey = "sourcevolumename"
	// SourceSnapshotNameKey is the string of SourceSnapshotName's key
	SourceSnapshotNameKey = "sourcesnapshotname"
	// SnapshotParentIdKey is the string of SnapshotParentId's key
	SnapshotParentIdKey = "snapshotparentid"
	// HyperMetroKey is the string of HyperMetro's key
	HyperMetroKey = "hypermetro"
	// RemoteStoragePoolKey is the string of RemoteStoragePool's key
	RemoteStoragePoolKey = "remotestoragepool"
	// RemotePoolIdKey is the string of RemotePoolId's key
	RemotePoolIdKey = "remotePoolID"
	// VStorePairIdKey is the string of VStorePairId's key
	VStorePairIdKey = "vstorepairid"
	// ReplicationKey is the string of Replication's key
	ReplicationKey = "replication"
	// FsPermissionKey is the string of FsPermission's key
	FsPermissionKey = "fspermission"
	// SnapshotFromKey is the string of FromSnapshot's key
	SnapshotFromKey = "fromSnapshot"
	// IsSkipNfsShareAndQoS is the string of SkipNfsShareAndQoS's key
	IsSkipNfsShareAndQoS = "skipNfsShareAndQos"
	// QoSKey is the string of qos's key
	QoSKey = "qos"
	// WorkloadTypeIDKey is the string of WorkloadTypeID's key
	WorkloadTypeIDKey = "workloadTypeID"
	// IsShowSnapDirKey is the string of IsShowSnapDir's key
	IsShowSnapDirKey = "isshowsnapdir"
	// SnapshotReservePerKey is the string of SnapshotReservePer's key
	SnapshotReservePerKey = "reservedsnapshotspaceratio"
	// AccessKrb5Key is the string of AccessKrb5's key
	AccessKrb5Key = "accesskrb5"
	// AccessKrb5iKey is the string of AccessKrb5i's key
	AccessKrb5iKey = "accesskrb5i"
	// AccessKrb5pKey is the string of AccessKrb5p's key
	AccessKrb5pKey = "accesskrb5p"
	// FilesystemModeKey is the string of FilesystemMode's key
	FilesystemModeKey = "filesystemmode"
	// ProductKey is the string of product's key
	ProductKey = "product"
	// ModifyVolumeKey is the string of ModifyVolume's key
	ModifyVolumeKey = "ModifyVolume"
	// SnapshotIDKey is the string of SnapshotID's key
	SnapshotIDKey = "snapshotID"
	// SnapshotParentNameKey is the string of SnapshotParentName's key
	SnapshotParentNameKey = "snapshotParentName"

	// DefaultAllSquash is the default value of all squash
	DefaultAllSquash = 1
	// DefaultRootSquash is the default value of root squash
	DefaultRootSquash = 1
	// DefaultCloneSpeed is the default value of clone speed
	DefaultCloneSpeed = 3
	// DefaultAllocType is the default value of alloc type
	DefaultAllocType = 1
)
View Source
const (
	// FilesystemObjectType filesystem object identifier
	FilesystemObjectType = "fs"
)

Variables

View Source
var (
	// ErrVolumeTypeConflict is used for create a conflict volume.
	ErrVolumeTypeConflict = errors.New("cannot create replication and hypermetro for a volume at the same time")
	// ErrNotFoundCli is used for get empty client interface.
	ErrNotFoundCli = errors.New("not found client")
)

Functions

This section is empty.

Types

type AccessKrb

type AccessKrb string

func (AccessKrb) Int

func (a AccessKrb) Int() int

type BaseCreator

type BaseCreator struct {
	// contains filtered or unexported fields
}

BaseCreator provides some common methods for volume creation.

func (*BaseCreator) AllowShareAccess

func (c *BaseCreator) AllowShareAccess(ctx context.Context, params ShareAccessParams) error

AllowShareAccess allows nfs share access.

func (*BaseCreator) CreateNfsShare

func (c *BaseCreator) CreateNfsShare(ctx context.Context, fsName, fsId, desc, vStoreId string) (string, error)

CreateNfsShare creates nfs share for the filesystem.

func (*BaseCreator) CreateQoS

func (c *BaseCreator) CreateQoS(ctx context.Context, fsID, vStoreId string) (string, error)

CreateQoS creates qos for filesystem.

func (*BaseCreator) GetPoolID

func (c *BaseCreator) GetPoolID(ctx context.Context, storagePoolName string) (string, error)

GetPoolID gets the id of pool by its fsName from storage.

func (*BaseCreator) Init

func (c *BaseCreator) Init(params *Parameter)

Init initiates fields of BaseCreator

func (*BaseCreator) RollbackQoS

func (c *BaseCreator) RollbackQoS(ctx context.Context, qosId, fsId, vStoreId string) error

RollbackQoS rollbacks qos resource.

func (*BaseCreator) RollbackShare

func (c *BaseCreator) RollbackShare(ctx context.Context, shareId, vStoreId string) error

RollbackShare rollbacks nfs share resource.

func (*BaseCreator) RollbackShareAccess

func (c *BaseCreator) RollbackShareAccess(ctx context.Context, shareId, vStoreId, authClient string) error

RollbackShareAccess rollbacks nfs share access.

type CloneFsCreator

type CloneFsCreator struct {
	*BaseCreator
	// contains filtered or unexported fields
}

CloneFsCreator provides the ability to create a clone file system.

func NewCloneFsCreatorByParams

func NewCloneFsCreatorByParams(cli client.BaseClientInterface,
	params *Parameter, opts ...CloneFsOptionFunc) *CloneFsCreator

NewCloneFsCreatorByParams returns an instance of CloneFsCreator

func (*CloneFsCreator) CreateVolume

func (creator *CloneFsCreator) CreateVolume(ctx context.Context) (utils.Volume, error)

CreateVolume creates a clone filesystem volume on the storage backend.

type CloneFsOptionFunc

type CloneFsOptionFunc func(*CloneFsCreator)

CloneFsOptionFunc defines the function to change fields of CloneFsCreator

func WithCloneFrom

func WithCloneFrom(cloneFrom string) CloneFsOptionFunc

WithCloneFrom sets cloneFrom field of CloneFsCreator

func WithIsDeleteParentSnapshot

func WithIsDeleteParentSnapshot(isDeleteParentSnapshot bool) CloneFsOptionFunc

WithIsDeleteParentSnapshot sets isDeleteParentSnapshot field of CloneFsCreator

func WithParentSnapshotId

func WithParentSnapshotId(snapshotId string) CloneFsOptionFunc

WithParentSnapshotId sets parentSnapshotId field of CloneFsCreator

type FilesystemCreator

type FilesystemCreator struct {
	*BaseCreator
	// contains filtered or unexported fields
}

FilesystemCreator is the filesystem creator that implement VolumeCreator interface.

func NewFsCreatorFromParams

func NewFsCreatorFromParams(cli client.BaseClientInterface,
	params *Parameter, opts ...FsOptionFunc) *FilesystemCreator

NewFsCreatorFromParams returns an instance of FilesystemCreator

func (*FilesystemCreator) CreateVolume

func (creator *FilesystemCreator) CreateVolume(ctx context.Context) (utils.Volume, error)

CreateVolume creates a filesystem volume on the storage backend.

type FsOptionFunc

type FsOptionFunc func(*FilesystemCreator)

FsOptionFunc defines the function to change fields of FilesystemCreator

type HyperMetroFsCreator

type HyperMetroFsCreator struct {
	*BaseCreator
	// contains filtered or unexported fields
}

HyperMetroFsCreator is the filesystem creator that implement VolumeCreator interface.

func NewHyperMetroCreatorFromParams

func NewHyperMetroCreatorFromParams(
	activeCli client.BaseClientInterface,
	standbyCli client.BaseClientInterface,
	params *Parameter,
	opts ...HyperMetroFsOptionFunc,
) *HyperMetroFsCreator

NewHyperMetroCreatorFromParams returns an instance of HyperMetroFsCreator

func (*HyperMetroFsCreator) CreateVolume

func (creator *HyperMetroFsCreator) CreateVolume(ctx context.Context) (utils.Volume, error)

CreateVolume creates a hyper metro filesystem volume on the storage backend.

type HyperMetroFsOptionFunc

type HyperMetroFsOptionFunc func(creator *HyperMetroFsCreator)

HyperMetroFsOptionFunc defines the function to change fields of ModifyFsCreator

type HyperMetroFsRequiredOptions

type HyperMetroFsRequiredOptions struct {

	// Name is the name of clone filesystem
	Name string
	// StoragePoolName is the name of storage pool that the filesystem belong to
	StoragePoolName string
	// StoragePoolId is the id of storage pool that the filesystem belong to
	StoragePoolId string
	// Description is the description of the filesystem
	Description string
	// Capacity is the capacity of the filesystem
	Capacity int64
	// AllocType is the allocation type of the filesystem
	AllocType int
	// contains filtered or unexported fields
}

HyperMetroFsRequiredOptions defines the required options of ModifyFsCreator

type ModifyFsCreator

type ModifyFsCreator struct {
	*BaseCreator
	// contains filtered or unexported fields
}

ModifyFsCreator is the filesystem creator that implement VolumeCreator interface.

func NewModifyCreatorFromParams

func NewModifyCreatorFromParams(
	activeCli client.BaseClientInterface,
	standbyCli client.BaseClientInterface,
	params *Parameter,
	opts ...ModifyFsOptionFunc,
) *ModifyFsCreator

NewModifyCreatorFromParams returns an instance of ModifyFsCreator

func (*ModifyFsCreator) CreateVolume

func (creator *ModifyFsCreator) CreateVolume(ctx context.Context) (utils.Volume, error)

CreateVolume creates a hyper metro filesystem volume on the storage backend.

type ModifyFsOptionFunc

type ModifyFsOptionFunc func(creator *ModifyFsCreator)

ModifyFsOptionFunc defines the function to change fields of ModifyFsCreator

type Parameter

type Parameter struct {
	// contains filtered or unexported fields
}

Parameter wraps the parameters from the PVC creation request, make each of parameters can be type-checked, and make it is easier to read and use.

func NewParameter

func NewParameter(params map[string]any) *Parameter

NewParameter returns a new instance of Parameter.

func (*Parameter) AccessKrb5

func (p *Parameter) AccessKrb5() int

AccessKrb5 gets the AccessKrb5 value of the params map.

func (*Parameter) AccessKrb5i

func (p *Parameter) AccessKrb5i() int

AccessKrb5i gets the AccessKrb5i value of the params map.

func (*Parameter) AccessKrb5p

func (p *Parameter) AccessKrb5p() int

AccessKrb5p gets the AccessKrb5p value of the params map.

func (*Parameter) ActiveVStoreID

func (p *Parameter) ActiveVStoreID() string

ActiveVStoreID gets the ActiveVStoreID value of the params map.

func (*Parameter) AllSquash

func (p *Parameter) AllSquash() int

AllSquash gets the AllSquash value of the params map.

func (*Parameter) AllocType

func (p *Parameter) AllocType() int

AllocType gets the AllocType value of the params map.

func (*Parameter) AuthClient

func (p *Parameter) AuthClient() string

AuthClient gets the AuthClient value of the params map.

func (*Parameter) Backend

func (p *Parameter) Backend() string

Backend gets the Backend value of the params map.

func (*Parameter) Capacity

func (p *Parameter) Capacity() int64

Capacity gets the Capacity value of the params map.

func (*Parameter) CloneFrom

func (p *Parameter) CloneFrom() string

CloneFrom gets the CloneFrom value of the params map.

func (*Parameter) CloneSpeed

func (p *Parameter) CloneSpeed() int

CloneSpeed gets the CloneSpeed value of the params map.

func (*Parameter) Description

func (p *Parameter) Description() string

Description gets the Description value of the params map.

func (*Parameter) FilesystemMode

func (p *Parameter) FilesystemMode() string

FilesystemMode gets the FilesystemMode value of the params map.

func (*Parameter) FsPermission

func (p *Parameter) FsPermission() string

FsPermission gets the FsPermission value of the params map.

func (*Parameter) IsClone

func (p *Parameter) IsClone() bool

IsClone returns true if a clone filesystem needs to be created, or returns false.

func (*Parameter) IsHyperMetro

func (p *Parameter) IsHyperMetro() bool

IsHyperMetro gets the HyperMetro value of the params map.

func (*Parameter) IsModifyVolume

func (p *Parameter) IsModifyVolume() bool

IsModifyVolume gets the ModifyVolume value of the params map.

func (*Parameter) IsReplication

func (p *Parameter) IsReplication() bool

IsReplication gets the Replication value of the params map.

func (*Parameter) IsShowSnapDir

func (p *Parameter) IsShowSnapDir() (bool, bool)

IsShowSnapDir gets the IsShowSnapDir value of the params map.

func (*Parameter) IsSkipNfsShareAndQos

func (p *Parameter) IsSkipNfsShareAndQos() bool

IsSkipNfsShareAndQos returns true if the filesystem didn't need to create nfs share and QoS, or return false.

func (*Parameter) IsSnapshot

func (p *Parameter) IsSnapshot() bool

IsSnapshot returns true if a snapshot filesystem needs to be created, or returns false.

func (*Parameter) MetroDomainID

func (p *Parameter) MetroDomainID() string

MetroDomainID gets the MetroDomainID value of the params map.

func (*Parameter) PoolID

func (p *Parameter) PoolID() string

PoolID gets the PoolID value of the params map.

func (*Parameter) Product

func (p *Parameter) Product() StorageProduct

Product gets the Product value of the params map.

func (*Parameter) PvcName

func (p *Parameter) PvcName() string

PvcName gets the PvcName value of the params map.

func (*Parameter) QoS

func (p *Parameter) QoS() map[string]int

QoS gets the QoS value of the params map.

func (*Parameter) RemotePoolId

func (p *Parameter) RemotePoolId() string

RemotePoolId gets the RemotePoolID value of the params map.

func (*Parameter) RemoteStoragePool

func (p *Parameter) RemoteStoragePool() string

RemoteStoragePool gets the RemoteStoragePool value of the params map.

func (*Parameter) RootSquash

func (p *Parameter) RootSquash() int

RootSquash gets the RootSquash value of the params map.

func (*Parameter) SetIsSkipNfsShare

func (p *Parameter) SetIsSkipNfsShare(isSkip bool)

SetIsSkipNfsShare sets the value of isSkipNfsShare

func (*Parameter) SetQos

func (p *Parameter) SetQos(qos map[string]int)

SetQos sets the value of qos

func (*Parameter) SnapshotID

func (p *Parameter) SnapshotID() string

SnapshotID gets the SnapshotID value of the params map.

func (*Parameter) SnapshotParentId

func (p *Parameter) SnapshotParentId() string

SnapshotParentId gets the SnapshotParentId value of the params map.

func (*Parameter) SnapshotParentName

func (p *Parameter) SnapshotParentName() string

SnapshotParentName gets the SnapshotParentName value of the params map.

func (*Parameter) SnapshotReservePer

func (p *Parameter) SnapshotReservePer() (int, bool)

SnapshotReservePer gets the SnapshotReservePer value of the params map.

func (*Parameter) SourceSnapshotName

func (p *Parameter) SourceSnapshotName() string

SourceSnapshotName gets the SourceSnapshotName value of the params map.

func (*Parameter) SourceVolumeName

func (p *Parameter) SourceVolumeName() string

SourceVolumeName gets the SourceVolumeName value of the params map.

func (*Parameter) StandByVStoreID

func (p *Parameter) StandByVStoreID() string

StandByVStoreID gets the ActiveVStoreID value of the params map.

func (*Parameter) StoragePool

func (p *Parameter) StoragePool() string

StoragePool gets the StoragePool value of the params map.

func (*Parameter) VStorePairId

func (p *Parameter) VStorePairId() string

VStorePairId gets the VStorePairId value of the params map.

func (*Parameter) WorkloadTypeID

func (p *Parameter) WorkloadTypeID() string

WorkloadTypeID gets the WorkloadTypeID value of the params map.

type ShareAccessParams

type ShareAccessParams struct {
	// contains filtered or unexported fields
}

ShareAccessParams is parameters for creating share access

type SnapshotFsCreator

type SnapshotFsCreator struct {
	*BaseCreator
	// contains filtered or unexported fields
}

SnapshotFsCreator provides the ability to create a snapshot file system.

func NewSnapshotFsFromParams

func NewSnapshotFsFromParams(cli client.BaseClientInterface,
	params *Parameter, opts ...SnapshotFsOptionFunc) *SnapshotFsCreator

NewSnapshotFsFromParams returns an instance of NewSnapshotFsFromParams

func (*SnapshotFsCreator) CreateVolume

func (creator *SnapshotFsCreator) CreateVolume(ctx context.Context) (utils.Volume, error)

CreateVolume creates a snapshot filesystem volume on the storage backend.

type SnapshotFsOptionFunc

type SnapshotFsOptionFunc func(*SnapshotFsCreator)

SnapshotFsOptionFunc defines the function to change fields of SnapshotFsCreator

type StorageProduct

type StorageProduct string

func (StorageProduct) IsV6

func (s StorageProduct) IsV6() bool

type VolumeCreator

type VolumeCreator interface {
	CreateVolume(context.Context) (utils.Volume, error)
	// contains filtered or unexported methods
}

VolumeCreator is the interface that wraps the CreateVolume method.

func NewFromParameters

func NewFromParameters(
	ctx context.Context,
	parameters map[string]any,
	activeCli client.BaseClientInterface,
	standbyCli client.BaseClientInterface,
) (VolumeCreator, error)

NewFromParameters generates a volume creator instance from parameters.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL