azure

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MinimumVolumeSizeBytes    = uint64(1000000000)   // 1 GB
	MinimumANFVolumeSizeBytes = uint64(107374182400) // 100 GiB

	Size            = "size"
	UnixPermissions = "unixPermissions"
	ServiceLevel    = "serviceLevel"
	SnapshotDir     = "snapshotDir"
	ExportRule      = "exportRule"
	VirtualNetwork  = "virtualNetwork"
	NetworkFeatures = "networkFeatures"
	Subnet          = "subnet"
	ResourceGroups  = "resourceGroups"
	NetappAccounts  = "netappAccounts"
	CapacityPools   = "capacityPools"
	FilePoolVolumes = "filePoolVolumes"
)
View Source
const (
	MinimumSubvolumeSizeBytes = uint64(20971520) // 20 MB
	RequiredHashLength        = 16
)
View Source
const (
	SubscriptionID   = "1-subid-23456789876454321"
	TenantID         = "1-tenantid-23456789876454321"
	ClientID         = "1-clientid-23456789876454321"
	ClientSecret     = "client-secret-23456789876454321"
	Location         = "fake-location"
	BackendUUID      = "deadbeef-03af-4394-ace4-e177cdbcaf28"
	SnapshotUUID     = "deadbeef-5c0d-4afa-8cd8-afa3fba5665c"
	VolumeSizeI64    = int64(107374182400)
	VolumeSizeStr    = "107374182400"
	SubvolumeSizeI64 = int64(20971520)
	SubvolumeSizeStr = "20971520"
)

Variables

View Source
var (
	DefaultVolumeSize, _ = strconv.ParseInt(defaultVolumeSizeStr, 10, 64)
)

Functions

This section is empty.

Types

type NASBlockStorageDriver

type NASBlockStorageDriver struct {
	Config drivers.AzureNASStorageDriverConfig

	SDK api.Azure
	// contains filtered or unexported fields
}

NASBlockStorageDriver is for storage provisioning using the Azure NetApp Files service.

func (*NASBlockStorageDriver) BackendName

func (d *NASBlockStorageDriver) BackendName() string

BackendName returns the name of the backend managed by this driver instance.

func (*NASBlockStorageDriver) CanSnapshot

CanSnapshot determines whether a snapshot as specified in the provided snapshot config may be taken.

func (*NASBlockStorageDriver) Create

func (d *NASBlockStorageDriver) Create(
	ctx context.Context, volConfig *storage.VolumeConfig,
	storagePool storage.Pool, volAttributes map[string]sa.Request,
) error

Create a new subvolume.

func (*NASBlockStorageDriver) CreateClone

func (d *NASBlockStorageDriver) CreateClone(
	ctx context.Context, sourceVolConfig, volConfig *storage.VolumeConfig, _ storage.Pool,
) error

CreateClone clones an existing volume. If a snapshot is not specified, one is created.

func (*NASBlockStorageDriver) CreateFollowup

func (d *NASBlockStorageDriver) CreateFollowup(ctx context.Context, volConfig *storage.VolumeConfig) error

func (*NASBlockStorageDriver) CreatePrepare

func (d *NASBlockStorageDriver) CreatePrepare(ctx context.Context, volConfig *storage.VolumeConfig)

CreatePrepare is called prior to volume creation. Currently its only role is to create the internal volume name.

func (*NASBlockStorageDriver) CreateSnapshot

func (d *NASBlockStorageDriver) CreateSnapshot(
	ctx context.Context, snapConfig *storage.SnapshotConfig, volConfig *storage.VolumeConfig,
) (*storage.Snapshot, error)

CreateSnapshot creates a snapshot for the given volume NOTE: In ANF Subvolumes there is not concept of snapshots, therefore any new snapshot is another

subvolume copy of the source subvolume.

func (*NASBlockStorageDriver) DeleteSnapshot

func (d *NASBlockStorageDriver) DeleteSnapshot(
	ctx context.Context, snapConfig *storage.SnapshotConfig, volConfig *storage.VolumeConfig,
) error

DeleteSnapshot creates a snapshot of a volume.

func (*NASBlockStorageDriver) Destroy

func (d *NASBlockStorageDriver) Destroy(ctx context.Context, volConfig *storage.VolumeConfig) error

Destroy deletes a volume.

func (*NASBlockStorageDriver) Get

func (d *NASBlockStorageDriver) Get(ctx context.Context, name string) error

Get tests for the existence of a volume

func (NASBlockStorageDriver) GetCommonConfig

GetCommonConfig returns driver's CommonConfig

func (*NASBlockStorageDriver) GetExternalConfig

func (d *NASBlockStorageDriver) GetExternalConfig(ctx context.Context) interface{}

GetExternalConfig returns a clone of this backend's config, sanitized for external consumption.

func (*NASBlockStorageDriver) GetInternalVolumeName

func (d *NASBlockStorageDriver) GetInternalVolumeName(ctx context.Context, name string) string

GetInternalVolumeName accepts the name of a volume being created and returns what the internal name should be, depending on backend requirements and Trident's operating context.

func (*NASBlockStorageDriver) GetProtocol

GetProtocol returns the protocol supported by this driver (BlockOnFile).

func (*NASBlockStorageDriver) GetSnapshot

func (d *NASBlockStorageDriver) GetSnapshot(
	ctx context.Context, snapConfig *storage.SnapshotConfig, volConfig *storage.VolumeConfig,
) (*storage.Snapshot, error)

GetSnapshot returns a snapshot of a volume, or an error if it does not exist.

func (*NASBlockStorageDriver) GetSnapshots

func (d *NASBlockStorageDriver) GetSnapshots(
	ctx context.Context, volConfig *storage.VolumeConfig,
) ([]*storage.Snapshot, error)

GetSnapshots returns the list of snapshots associated with the specified subvolume

func (*NASBlockStorageDriver) GetStorageBackendPhysicalPoolNames

func (d *NASBlockStorageDriver) GetStorageBackendPhysicalPoolNames(context.Context) []string

GetStorageBackendPhysicalPoolNames retrieves storage backend physical pools

func (*NASBlockStorageDriver) GetStorageBackendSpecs

func (d *NASBlockStorageDriver) GetStorageBackendSpecs(_ context.Context, backend storage.Backend) error

GetStorageBackendSpecs retrieves storage capabilities and register pools with specified backend.

func (*NASBlockStorageDriver) GetUpdateType

func (d *NASBlockStorageDriver) GetUpdateType(_ context.Context, driverOrig storage.Driver) *roaring.Bitmap

GetUpdateType returns a bitmap populated with updates to the driver.

func (*NASBlockStorageDriver) GetVolumeExternal

func (d *NASBlockStorageDriver) GetVolumeExternal(ctx context.Context, name string) (*storage.VolumeExternal, error)

GetVolumeExternal queries the storage backend for all relevant info about a single container volume managed by this driver and returns a VolumeExternal representation of the volume.

func (*NASBlockStorageDriver) GetVolumeExternalWrappers

func (d *NASBlockStorageDriver) GetVolumeExternalWrappers(
	ctx context.Context, channel chan *storage.VolumeExternalWrapper,
)

GetVolumeExternalWrappers queries the storage backend for all relevant info about container volumes managed by this driver. It then writes a VolumeExternal representation of each volume to the supplied channel, closing the channel when finished.

func (NASBlockStorageDriver) GoString

func (d NASBlockStorageDriver) GoString() string

GoString implements GoStringer interface for the NASBlockStorageDriver driver.

func (*NASBlockStorageDriver) Import

func (d *NASBlockStorageDriver) Import(
	ctx context.Context, volConfig *storage.VolumeConfig, originalName string,
) error

Import finds an existing subvolume and makes it available for containers. If ImportNotManaged is false, the subvolume is fully brought under Trident's management.

func (*NASBlockStorageDriver) Initialize

func (d *NASBlockStorageDriver) Initialize(
	ctx context.Context, context tridentconfig.DriverContext, configJSON string,
	commonConfig *drivers.CommonStorageDriverConfig, backendSecret map[string]string, backendUUID string,
) error

Initialize initializes this driver from the provided config.

func (*NASBlockStorageDriver) Initialized

func (d *NASBlockStorageDriver) Initialized() bool

Initialized returns whether this driver has been initialized (and not terminated).

func (*NASBlockStorageDriver) Name

func (d *NASBlockStorageDriver) Name() string

Name returns the name of this driver.

func (*NASBlockStorageDriver) Publish

func (d *NASBlockStorageDriver) Publish(
	ctx context.Context, volConfig *storage.VolumeConfig, publishInfo *utils.VolumePublishInfo,
) error

Publish the volume to the host specified in publishInfo. This method may or may not be running on the host where the volume will be mounted, so it should limit itself to updating access rules, initiator groups, etc. that require some host identity (but not locality) as well as storage controller API access.

func (*NASBlockStorageDriver) ReconcileNodeAccess

func (d *NASBlockStorageDriver) ReconcileNodeAccess(ctx context.Context, nodes []*utils.Node, _ string) error

ReconcileNodeAccess updates a per-backend export policy to match the set of Kubernetes cluster nodes. Not supported by this driver.

func (*NASBlockStorageDriver) Rename

func (d *NASBlockStorageDriver) Rename(ctx context.Context, name, newName string) error

func (*NASBlockStorageDriver) Resize

func (d *NASBlockStorageDriver) Resize(ctx context.Context, volConfig *storage.VolumeConfig, sizeBytes uint64) error

Resize increases a volume's quota.

func (*NASBlockStorageDriver) RestoreSnapshot

func (d *NASBlockStorageDriver) RestoreSnapshot(
	ctx context.Context, snapConfig *storage.SnapshotConfig, _ *storage.VolumeConfig,
) error

RestoreSnapshot restores a volume (in place) from a snapshot.

func (*NASBlockStorageDriver) StoreConfig

StoreConfig adds this backend's config to the persistent config struct, as needed by Trident's persistence layer.

func (NASBlockStorageDriver) String

func (d NASBlockStorageDriver) String() string

Implement stringer interface for the NASBlockStorageDriver driver.

func (*NASBlockStorageDriver) Terminate

func (d *NASBlockStorageDriver) Terminate(ctx context.Context, _ string)

Terminate stops the driver prior to its being unloaded.

type NASStorageDriver

type NASStorageDriver struct {
	Config drivers.AzureNASStorageDriverConfig

	SDK api.Azure
	// contains filtered or unexported fields
}

NASStorageDriver is for storage provisioning using the Azure NetApp Files service.

func (*NASStorageDriver) BackendName

func (d *NASStorageDriver) BackendName() string

BackendName returns the name of the backend managed by this driver instance.

func (*NASStorageDriver) CanSnapshot

CanSnapshot determines whether a snapshot as specified in the provided snapshot config may be taken.

func (*NASStorageDriver) Create

func (d *NASStorageDriver) Create(
	ctx context.Context, volConfig *storage.VolumeConfig, storagePool storage.Pool, volAttributes map[string]sa.Request,
) error

Create creates a new volume.

func (*NASStorageDriver) CreateClone

func (d *NASStorageDriver) CreateClone(
	ctx context.Context, sourceVolConfig, cloneVolConfig *storage.VolumeConfig, storagePool storage.Pool,
) error

CreateClone clones an existing volume. If a snapshot is not specified, one is created.

func (*NASStorageDriver) CreateFollowup

func (d *NASStorageDriver) CreateFollowup(ctx context.Context, volConfig *storage.VolumeConfig) error

CreateFollowup is called after volume creation and sets the access info in the volume config.

func (*NASStorageDriver) CreatePrepare

func (d *NASStorageDriver) CreatePrepare(ctx context.Context, volConfig *storage.VolumeConfig)

CreatePrepare is called prior to volume creation. Currently its only role is to create the internal volume name.

func (*NASStorageDriver) CreateSnapshot

func (d *NASStorageDriver) CreateSnapshot(
	ctx context.Context, snapConfig *storage.SnapshotConfig, volConfig *storage.VolumeConfig,
) (*storage.Snapshot, error)

CreateSnapshot creates a snapshot for the given volume.

func (*NASStorageDriver) DeleteSnapshot

func (d *NASStorageDriver) DeleteSnapshot(
	ctx context.Context, snapConfig *storage.SnapshotConfig, volConfig *storage.VolumeConfig,
) error

DeleteSnapshot deletes a snapshot of a volume.

func (*NASStorageDriver) Destroy

func (d *NASStorageDriver) Destroy(ctx context.Context, volConfig *storage.VolumeConfig) error

Destroy deletes a volume.

func (*NASStorageDriver) Get

func (d *NASStorageDriver) Get(ctx context.Context, name string) error

Get tests for the existence of a volume.

func (NASStorageDriver) GetCommonConfig

GetCommonConfig returns driver's CommonConfig

func (*NASStorageDriver) GetExternalConfig

func (d *NASStorageDriver) GetExternalConfig(ctx context.Context) interface{}

GetExternalConfig returns returns a clone of this backend's config, sanitized for external consumption.

func (*NASStorageDriver) GetInternalVolumeName

func (d *NASStorageDriver) GetInternalVolumeName(ctx context.Context, name string) string

GetInternalVolumeName accepts the name of a volume being created and returns what the internal name should be, depending on backend requirements and Trident's operating context.

func (*NASStorageDriver) GetProtocol

GetProtocol returns the protocol supported by this driver (File).

func (*NASStorageDriver) GetSnapshot

func (d *NASStorageDriver) GetSnapshot(
	ctx context.Context, snapConfig *storage.SnapshotConfig, volConfig *storage.VolumeConfig,
) (*storage.Snapshot, error)

GetSnapshot returns a snapshot of a volume, or an error if it does not exist.

func (*NASStorageDriver) GetSnapshots

func (d *NASStorageDriver) GetSnapshots(
	ctx context.Context, volConfig *storage.VolumeConfig,
) ([]*storage.Snapshot, error)

GetSnapshots returns the list of snapshots associated with the specified volume.

func (*NASStorageDriver) GetStorageBackendPhysicalPoolNames

func (d *NASStorageDriver) GetStorageBackendPhysicalPoolNames(context.Context) []string

GetStorageBackendPhysicalPoolNames retrieves storage backend physical pools

func (*NASStorageDriver) GetStorageBackendSpecs

func (d *NASStorageDriver) GetStorageBackendSpecs(_ context.Context, backend storage.Backend) error

GetStorageBackendSpecs retrieves storage capabilities and register pools with specified backend.

func (*NASStorageDriver) GetUpdateType

func (d *NASStorageDriver) GetUpdateType(_ context.Context, driverOrig storage.Driver) *roaring.Bitmap

GetUpdateType returns a bitmap populated with updates to the driver.

func (*NASStorageDriver) GetVolumeExternal

func (d *NASStorageDriver) GetVolumeExternal(ctx context.Context, name string) (*storage.VolumeExternal, error)

GetVolumeExternal queries the storage backend for all relevant info about a single container volume managed by this driver and returns a VolumeExternal representation of the volume.

func (*NASStorageDriver) GetVolumeExternalWrappers

func (d *NASStorageDriver) GetVolumeExternalWrappers(ctx context.Context, channel chan *storage.VolumeExternalWrapper)

GetVolumeExternalWrappers queries the storage backend for all relevant info about container volumes managed by this driver. It then writes a VolumeExternal representation of each volume to the supplied channel, closing the channel when finished.

func (NASStorageDriver) GoString

func (d NASStorageDriver) GoString() string

GoString implements GoStringer interface for the NASStorageDriver driver.

func (*NASStorageDriver) Import

func (d *NASStorageDriver) Import(ctx context.Context, volConfig *storage.VolumeConfig, originalName string) error

Import finds an existing volume and makes it available for containers. If ImportNotManaged is false, the volume is fully brought under Trident's management.

func (*NASStorageDriver) Initialize

func (d *NASStorageDriver) Initialize(
	ctx context.Context, context tridentconfig.DriverContext, configJSON string,
	commonConfig *drivers.CommonStorageDriverConfig, backendSecret map[string]string, backendUUID string,
) error

Initialize initializes this driver from the provided config.

func (*NASStorageDriver) Initialized

func (d *NASStorageDriver) Initialized() bool

Initialized returns whether this driver has been initialized (and not terminated).

func (*NASStorageDriver) List

func (d *NASStorageDriver) List(ctx context.Context) ([]string, error)

List returns the list of volumes associated with this backend.

func (*NASStorageDriver) Name

func (d *NASStorageDriver) Name() string

Name returns the name of this driver.

func (*NASStorageDriver) Publish

func (d *NASStorageDriver) Publish(
	ctx context.Context, volConfig *storage.VolumeConfig, publishInfo *utils.VolumePublishInfo,
) error

Publish the volume to the host specified in publishInfo. This method may or may not be running on the host where the volume will be mounted, so it should limit itself to updating access rules, initiator groups, etc. that require some host identity (but not locality) as well as storage controller API access.

func (*NASStorageDriver) ReconcileNodeAccess

func (d *NASStorageDriver) ReconcileNodeAccess(ctx context.Context, _ []*utils.Node, _ string) error

ReconcileNodeAccess updates a per-backend export policy to match the set of Kubernetes cluster nodes. Not supported by this driver.

func (*NASStorageDriver) Rename

func (d *NASStorageDriver) Rename(ctx context.Context, name, newName string) error

Rename changes the name of a volume. Not supported by this driver.

func (*NASStorageDriver) Resize

func (d *NASStorageDriver) Resize(ctx context.Context, volConfig *storage.VolumeConfig, sizeBytes uint64) error

Resize increases a volume's quota.

func (*NASStorageDriver) RestoreSnapshot

func (d *NASStorageDriver) RestoreSnapshot(
	ctx context.Context, snapConfig *storage.SnapshotConfig, _ *storage.VolumeConfig,
) error

RestoreSnapshot restores a volume (in place) from a snapshot. Not supported by this driver.

func (*NASStorageDriver) StoreConfig

StoreConfig adds this backend's config to the persistent config struct, as needed by Trident's persistence layer.

func (NASStorageDriver) String

func (d NASStorageDriver) String() string

String implements stringer interface for the NASStorageDriver driver.

func (*NASStorageDriver) Terminate

func (d *NASStorageDriver) Terminate(ctx context.Context, _ string)

Terminate stops the driver prior to its being unloaded.

type SubvolumeHelper

type SubvolumeHelper struct {
	Config         drivers.AzureNASStorageDriverConfig
	Context        tridentconfig.DriverContext
	SnapshotRegexp *regexp.Regexp
}

func (*SubvolumeHelper) GetSnapshotInternalName

func (o *SubvolumeHelper) GetSnapshotInternalName(volName, snapNameValue string) string

volName is expected not to have the storage prefix included parameters: volName=pvc-abc1234-324abc34 snapName=my-Snapshot output: prefix-my-Snapshot--abc12

func (*SubvolumeHelper) GetSnapshotNameFromSnapInternalName

func (o *SubvolumeHelper) GetSnapshotNameFromSnapInternalName(snapshotInternalName string) string

parameter: snapshotInternalName=storagePrefix-mySnap_chars result [1] is the snapshot name: mySnap

func (*SubvolumeHelper) GetSnapshotSuffix

func (o *SubvolumeHelper) GetSnapshotSuffix(volName string) string

volName is expected not to have the storage prefix included parameters: volName=pvc-abc1234-324abc34 output: abc12

func (*SubvolumeHelper) GetSnapshotSuffixFromSnapshotInternalName

func (o *SubvolumeHelper) GetSnapshotSuffixFromSnapshotInternalName(snapshotInternalName string) string

parameter: snapshotInternalName=storagePrefix-mySnap_chars result [2] is the snapshot suffix: chars

func (*SubvolumeHelper) IsValidSnapshotInternalName

func (o *SubvolumeHelper) IsValidSnapshotInternalName(snapshotInternalName string) bool

IsValidSnapshotInternalName identifies if the given snapLunPath has a valid snapshot name

type Telemetry

type Telemetry struct {
	tridentconfig.Telemetry
	Plugin string `json:"plugin"`
}

Directories

Path Synopsis
Package api provides a high-level interface to the Azure NetApp Files SDK
Package api provides a high-level interface to the Azure NetApp Files SDK

Jump to

Keyboard shortcuts

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