Documentation ¶
Index ¶
- Constants
- Variables
- func Capacity(volName string) (*apis.CStorVolumeCapacityAttr, error)
- func CheckValidVolumeReplica(cVR *apis.CStorVolumeReplica) error
- func CreateVolumeBackup(bkp *apis.CStorBackup) error
- func CreateVolumeReplica(cStorVolumeReplica *apis.CStorVolumeReplica, fullVolName string, quorum bool) error
- func CreateVolumeRestore(rst *apis.CStorRestore) error
- func DeleteVolume(fullVolName string) error
- func GetVolumeName(cVR *apis.CStorVolumeReplica) (string, error)
- func GetVolumes() ([]string, error)
- func PoolNameFromBackup(bkp *apis.CStorBackup) string
- func PoolNameFromCVR(cvr *apis.CStorVolumeReplica) string
- func PoolNameFromRestore(rst *apis.CStorRestore) string
- func Status(volumeName string) (string, error)
- func ZfsToCvrStatusMapper(zfsstatus string) 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 ( // CStorPoolUIDKey is the key for csp object uid which is present in cvr labels. CStorPoolUIDKey = "cstorpool.openebs.io/uid" // 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) (*apis.CStorVolumeCapacityAttr, 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,logicalused 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 logicalused 6K -
func CheckValidVolumeReplica ¶
func CheckValidVolumeReplica(cVR *apis.CStorVolumeReplica) error
CheckValidVolumeReplica checks for validity of cStor replica resource.
func CreateVolumeBackup ¶
func CreateVolumeBackup(bkp *apis.CStorBackup) error
CreateVolumeBackup sends cStor snapshots to remote location specified by cstorbackup.
func CreateVolumeReplica ¶
func CreateVolumeReplica(cStorVolumeReplica *apis.CStorVolumeReplica, fullVolName string, quorum bool) error
CreateVolumeReplica creates cStor replica(zfs volumes).
func CreateVolumeRestore ¶
func CreateVolumeRestore(rst *apis.CStorRestore) error
CreateVolumeRestore receive cStor snapshots from remote location(zfs volumes).
func DeleteVolume ¶
DeleteVolume deletes the specified volume.
func GetVolumeName ¶
func GetVolumeName(cVR *apis.CStorVolumeReplica) (string, error)
GetVolumeName finds the zctual zfs volume name for the given cvr.
func PoolNameFromBackup ¶
func PoolNameFromBackup(bkp *apis.CStorBackup) string
PoolNameFromBackup gets the name of cstorpool from cstorvolumereplica label if not found then gets cstorpoolinstance name from the OPENEBS_IO_POOL_NAME env
func PoolNameFromCVR ¶
func PoolNameFromCVR(cvr *apis.CStorVolumeReplica) string
PoolNameFromCVR gets the name of cstorpool from cstorvolumereplica label if not found then gets cstorpoolinstance name from the OPENEBS_IO_POOL_NAME env
func PoolNameFromRestore ¶
func PoolNameFromRestore(rst *apis.CStorRestore) string
PoolNameFromRestore gets the name of cstorPool from cstorvolumereplica label if not found then gets cstorPoolInstance name from the OPENEBS_IO_POOL_NAME env
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"` 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"` // contains filtered or unexported fields }
Stats contain the zfs volume related stats.