volumereplica

package
v1.12.1 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// VolumeReplicaOperator is the name of the tool that makes volume-related operations.
	VolumeReplicaOperator = "zfs"
	// BinaryCapacityUnitSuffix is the suffix for binary capacity unit.
	BinaryCapacityUnitSuffix = "i"
	// CreateCmd is the create command for zfs volume.
	CreateCmd = "create"
	// CloneCmd is the zfs volume clone command.
	CloneCmd = "clone"
	// BackupCmd is the zfs send command
	BackupCmd = "send"
	// RestoreCmd is the zfs volume send command.
	RestoreCmd = "recv"
	// StatsCmd is the zfs volume stats command.
	StatsCmd = "stats"
	// ZfsStatusDegraded is the degraded state of zfs volume.
	ZfsStatusDegraded = "Degraded"
	// ZfsStatusOffline is the offline state of zfs volume.
	ZfsStatusOffline = "Offline"
	// ZfsStatusHealthy is the healthy state of zfs volume.
	ZfsStatusHealthy = "Healthy"
	// ZfsStatusRebuilding is the rebuilding state of zfs volume.
	ZfsStatusRebuilding = "Rebuilding"
	// MaxBackupRetryCount is a max number of retry should be performed during backup transfer
	MaxBackupRetryCount = 10
	// BackupRetryDelay is time(in seconds) to wait before the next attempt for backup transfer
	BackupRetryDelay = 5
	// MaxRestoreRetryCount is a max number of retry should be performed during restore transfer
	MaxRestoreRetryCount = 10
	// RestoreRetryDelay is time(in seconds) to wait before the next attempt for restore transfer
	RestoreRetryDelay = 5
)
View Source
const (
	// PvNameKey is the key for pv object uid which is present in cvr labels.
	PvNameKey = "cstorvolume.openebs.io/name"
	// PoolPrefix is the prefix of zpool name.
	PoolPrefix = "cstor-"
)

Variables

View Source
var RunnerVar util.Runner

RunnerVar the runner variable for executing binaries.

Functions

func Capacity

Capacity finds the capacity of the volume. The ouptut of command executed is as follows:

root@cstor-sparse-pool-6dft-5b5c78ccc7-dls8s:/# zfs get used,logicalreferenced cstor-d82bd105-f3a8-11e8-87fd-42010a800087/pvc-1b2a7d4b-f3a9-11e8-87fd-42010a800087 NAME PROPERTY VALUE SOURCE cstor-d82bd105-f3a8-11e8-87fd-42010a800087/pvc-1b2a7d4b-f3a9-11e8-87fd-42010a800087 used 6K - cstor-d82bd105-f3a8-11e8-87fd-42010a800087/pvc-1b2a7d4b-f3a9-11e8-87fd-42010a800087 logicalreferenced 6K -

func CheckValidVolumeReplica

func CheckValidVolumeReplica(cVR *cstor.CStorVolumeReplica) error

CheckValidVolumeReplica checks for validity of cStor replica resource.

func CreateVolumeBackup added in v1.11.0

func CreateVolumeBackup(bkp *openebsio.CStorBackup) error

CreateVolumeBackup sends cStor snapshots to remote location specified by cstorbackup.

func CreateVolumeReplica

func CreateVolumeReplica(cStorVolumeReplica *cstor.CStorVolumeReplica, fullVolName string, quorum bool) error

CreateVolumeReplica creates cStor replica(zfs volumes).

func CreateVolumeRestore added in v1.11.0

func CreateVolumeRestore(rst *openebsio.CStorRestore) error

CreateVolumeRestore receive cStor snapshots from remote location(zfs volumes).

func DeleteVolume

func DeleteVolume(fullVolName string) error

DeleteVolume deletes the specified volume.

func GenerateReplicaID

func GenerateReplicaID(cvr *cstor.CStorVolumeReplica) error

GenerateReplicaID generate new replicaID for given CVR

func GetAndUpdateReplicaID

func GetAndUpdateReplicaID(cvr *cstor.CStorVolumeReplica) error

GetAndUpdateReplicaID update replicaID for CVR and set it to volume

func GetAndUpdateSnapshotInfo

func GetAndUpdateSnapshotInfo(
	clientset clientset.Interface, cvr *cstor.CStorVolumeReplica) error

GetAndUpdateSnapshotInfo get the snapshot list from ZFS and updates in CVR status. Execution happens in following steps:

  1. Get snapshot list from ZFS
  2. Checks whether above snapshots exist on CVR under Status.Snapshots: 2.1 If snapshot doesn't exist then get the info of snapshot from ZFS and update the details in CVR.Status.Snapshots
  3. Verify and delete the snapshot details on CVR if it is deleted from ZFS
  4. Update the pending list of snapshots by verifying with snapshot list obtained from step1
  5. If replica is under rebuilding get the snapshot list from peer CVR and update them under pending snapshot list

func GetListOfPropertyValues added in v1.11.0

func GetListOfPropertyValues(dataSetName string, propertyList []string, executor bin.Executor) ([]string, error)

GetListOfPropertyValues will return value list for given property list NOTE: It will return the property values in the same order as property list

func GetPoolName added in v1.11.0

func GetPoolName() string

GetPoolName gets the name of cstor pool

func GetProvisionedAndHealthyReplicaCount added in v1.12.0

func GetProvisionedAndHealthyReplicaCount(executor bin.Executor) (int32, int32, error)

GetProvisionedAndHealthyReplicaCount return the count of provisioned and healthy replicas count

func GetReplicaIDFromZFS

func GetReplicaIDFromZFS(volumeName string) (string, error)

GetReplicaIDFromZFS returns replicaID for provided volume name by executing ZFS commands

func GetSnapshotList

func GetSnapshotList(dsName string) (map[string]string, error)

GetSnapshotList get the list of snapshots by executing command: `zfs listsnap <dataset_name>` and returns output: {"name":"pool1\/vol1","snaplist":{"istgt_snap1":null,"istgt_snap2":null}} and error if there are any(Few Error codes: 11 -- TryAgain).

func GetStats added in v1.12.0

func GetStats(executor bin.Executor) (*zstats.ZFSStats, error)

GetStats return stats of all the volume replicas present in the pool

func GetVolumeName

func GetVolumeName(cVR *cstor.CStorVolumeReplica) (string, error)

GetVolumeName finds the zctual zfs volume name for the given cvr.

func GetVolumes

func GetVolumes() ([]string, error)

GetVolumes returns the slice of volumes.

func SetReplicaID

func SetReplicaID(cvr *cstor.CStorVolumeReplica) error

SetReplicaID set replicaID to volume

func Status

func Status(volumeName string) (string, error)

Status gives the status of cvr which was extracted and mapped to a set of cvr statuses after getting the zfs volume status

func ZfsToCvrStatusMapper

func ZfsToCvrStatusMapper(zfsstatus string, quorum int) string

ZfsToCvrStatusMapper maps zfs status to defined cvr status.

Types

This section is empty.

Jump to

Keyboard shortcuts

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