cnsvolumeoperationrequest

package
v3.3.0-rc.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// CRDSingular represents the singular name of cnsvolumeoperationrequest CRD.
	CRDSingular = "cnsvolumeoperationrequest"
	// CRDPlural represents the plural name of cnsvolumeoperationrequest CRD.
	CRDPlural = "cnsvolumeoperationrequests"
	// EnvCSINamespace represents the environment variable which
	// stores the namespace in which the CSI driver is running.
	EnvCSINamespace = "CSI_NAMESPACE"
)
View Source
const (

	// TaskInvocationStatusInProgress represents a task thats status is InProgress.
	TaskInvocationStatusInProgress = "InProgress"
	// TaskInvocationStatusError represents a task thats status is Error.
	TaskInvocationStatusError = "Error"
	// TaskInvocationStatusSuccess represents a task thats status is Success.
	TaskInvocationStatusSuccess = "Success"
	// TaskInvocationStatusPartiallyFailed represents a task thats status is PartiallyFailed.
	TaskInvocationStatusPartiallyFailed = "PartiallyFailed"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type OperationDetails

type OperationDetails struct {
	TaskInvocationTimestamp metav1.Time
	TaskID                  string
	VCenterServer           string
	OpID                    string
	TaskStatus              string
	Error                   string
}

OperationDetails stores information about a particular operation.

type QuotaDetails added in v3.2.0

type QuotaDetails struct {
	Reserved         *resource.Quantity
	StoragePolicyId  string
	StorageClassName string
	Namespace        string
}

QuotaDetails stores information required to interact with the custom storage policy quota CRs during create volume operations.

type VolumeOperationRequest

type VolumeOperationRequest interface {
	// GetRequestDetails returns the details of the operation on the volume
	// that is persisted by the VolumeOperationRequest interface.
	// Returns an error if any error is encountered while attempting to
	// read the previously persisted information.
	GetRequestDetails(ctx context.Context, name string) (*VolumeOperationRequestDetails, error)
	// StoreRequestDetails persists the details of the operation taking
	// place on the volume.
	// Returns an error if any error is encountered. Clients must assume
	// that the attempt to persist the information failed if an error is returned.
	StoreRequestDetails(ctx context.Context, instance *VolumeOperationRequestDetails) error
	// DeleteRequestDetails deletes the details of the operation on the volume
	// that was persisted by the VolumeOperationRequest interface.
	DeleteRequestDetails(ctx context.Context, name string) error
}

VolumeOperationRequest is an interface that supports handling idempotency in CSI volume manager. This interface persists operation details invoked on CNS and returns the persisted information to callers whenever it is requested.

func InitVolumeOperationRequestInterface

func InitVolumeOperationRequestInterface(ctx context.Context, cleanupInterval int,
	isBlockVolumeSnapshotEnabled func() bool, isPodVMOnStretchSupervisorEnabled bool) (
	VolumeOperationRequest, error)

InitVolumeOperationRequestInterface creates the CnsVolumeOperationRequest definition on the API server and returns an implementation of VolumeOperationRequest interface. Clients are unaware of the implementation details to read and persist volume operation details.

type VolumeOperationRequestDetails

type VolumeOperationRequestDetails struct {
	Name             string
	VolumeID         string
	SnapshotID       string
	Capacity         int64
	QuotaDetails     *QuotaDetails
	OperationDetails *OperationDetails
}

VolumeOperationRequestDetails stores details about a single operation on the given volume. These details are persisted by VolumeOperationRequestInterface and the persisted details will be returned by the interface on request by the caller via this structure.

func CreateVolumeOperationRequestDetails

func CreateVolumeOperationRequestDetails(name, volumeID, snapshotID string, capacity int64,
	quotaDetails *QuotaDetails, taskInvocationTimestamp metav1.Time, taskID, vCenterServer, opID,
	taskStatus, error string) *VolumeOperationRequestDetails

CreateVolumeOperationRequestDetails returns an object of type VolumeOperationRequestDetails from the input parameters.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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