Documentation ¶
Index ¶
- Constants
- Variables
- func Capacity(volName string) (*cstor.CStorVolumeReplicaCapacityDetails, error)
- func CheckValidVolumeReplica(cVR *cstor.CStorVolumeReplica) error
- func CreateVolumeBackup(bkp *openebsio.CStorBackup) error
- func CreateVolumeReplica(cStorVolumeReplica *cstor.CStorVolumeReplica, fullVolName string, quorum bool) error
- func CreateVolumeRestore(rst *openebsio.CStorRestore) error
- func DeleteVolume(fullVolName string) error
- func GenerateReplicaID(cvr *cstor.CStorVolumeReplica) error
- func GetAndUpdateReplicaID(cvr *cstor.CStorVolumeReplica) error
- func GetAndUpdateSnapshotInfo(clientset clientset.Interface, cvr *cstor.CStorVolumeReplica) error
- func GetListOfPropertyValues(dataSetName string, propertyList []string, executor bin.Executor) ([]string, error)
- func GetPoolName() string
- func GetReplicaIDFromZFS(volumeName string) (string, error)
- func GetSnapshotList(dsName string) (map[string]string, error)
- func GetVolumeName(cVR *cstor.CStorVolumeReplica) (string, error)
- func GetVolumes() ([]string, error)
- func SetReplicaID(cvr *cstor.CStorVolumeReplica) error
- func Status(volumeName string) (string, error)
- func ZfsToCvrStatusMapper(zfsstatus string, quorum int) string
- type CvrStats
- type Stats
Constants ¶
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 )
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 ¶
var RunnerVar util.Runner
RunnerVar the runner variable for executing binaries.
Functions ¶
func Capacity ¶
func Capacity(volName string) (*cstor.CStorVolumeReplicaCapacityDetails, error)
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 ¶
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:
- Get snapshot list from ZFS
- 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
- Verify and delete the snapshot details on CVR if it is deleted from ZFS
- Update the pending list of snapshots by verifying with snapshot list obtained from step1
- 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 GetReplicaIDFromZFS ¶
GetReplicaIDFromZFS returns replicaID for provided volume name by executing ZFS commands
func GetSnapshotList ¶
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 GetVolumeName ¶
func GetVolumeName(cVR *cstor.CStorVolumeReplica) (string, error)
GetVolumeName finds the zctual zfs volume name for the given cvr.
func SetReplicaID ¶
func SetReplicaID(cvr *cstor.CStorVolumeReplica) error
SetReplicaID set replicaID to volume
func Status ¶
Status function gives the status of cvr which extracted and mapped to a set of cvr statuses after getting the zfs volume status
func ZfsToCvrStatusMapper ¶
ZfsToCvrStatusMapper maps zfs status to defined cvr status.
Types ¶
type CvrStats ¶
type CvrStats struct { // Stats is an array which holds zfs volume related stats Stats []Stats `json:"stats"` }
CvrStats struct is zfs volume status output JSON contract.
type Stats ¶
type Stats struct { // Name of the zfs volume. Name string `json:"name"` // Status of the zfs volume. Status string `json:"status"` // RebuildStatus of the zfs volume. RebuildStatus string `json:"rebuildStatus"` IsIOAckSenderCreated int `json:"isIOAckSenderCreated"` IsIOReceiverCreated int `json:"isIOReceiverCreated"` RunningIONum int `json:"runningIONum"` CheckpointedIONum int `json:"checkpointedIONum"` DegradedCheckpointedIONum int `json:"degradedCheckpointedIONum"` CheckpointedTime int `json:"checkpointedTime"` RebuildBytes int `json:"rebuildBytes"` RebuildCnt int `json:"rebuildCnt"` RebuildDoneCnt int `json:"rebuildDoneCnt"` RebuildFailedCnt int `json:"rebuildFailedCnt"` Quorum int `json:"quorum"` }
Stats contain the zfs volume related stats.