Documentation ¶
Index ¶
- Constants
- Variables
- func ByteCount(b uint64) string
- func BytesToGiB(volumeSizeBytes int64) int64
- func ChmodMountPath(mountPath string) error
- func CreateCStorVolumeAttachmentCR(csivol *apis.CStorVolumeAttachment, nodeID string) error
- func CreateSnapshot(volumeName, snapName string) error
- func DeleteCStorVolumeAttachmentCR(csivolName string) error
- func DeleteOldCStorVolumeAttachmentCRs(volumeID string) error
- func DeleteSnapshot(volumeName, snapName string) error
- func DeleteVolume(volumeID string) (err error)
- func FetchAndUpdateISCSIDetails(volumeID string, vol *apis.CStorVolumeAttachment) error
- func FetchPVDetails(name string) (*corev1.PersistentVolume, error)
- func GetCStorVolumeAttachment(csivol string) (*apis.CStorVolumeAttachment, error)
- func GetMounts(volumeID string) ([]string, error)
- func GetVolList(volume string) (*apis.CStorVolumeAttachmentList, error)
- func GetVolListForNode() (*apis.CStorVolumeAttachmentList, error)
- func GetVolume(volumeID string) (*apisv1.CStorVolumeConfig, error)
- func GetVolumeIP(volumeID string) (string, error)
- func GetVolumeSourceDetails(snapshotID string) (string, string, error)
- func GiBToBytes(volumeSizeGiB int64) int64
- func IsCVCBound(volumeID string) (bool, error)
- func IsSourceAvailable(snapshotID string) (bool, error)
- func MonitorMounts()
- func PatchCVCNodeID(volumeID, nodeID string) error
- func ProvisionVolume(size int64, ...) error
- func RemountVolume(stagingPathExists bool, targetPathExists bool, vol *apis.CStorVolumeAttachment) (err error)
- func ResizeVolume(volumeID string, size int64) error
- func RoundUpBytes(volumeSizeBytes int64) int64
- func RoundUpGiB(volumeSizeBytes int64) int64
- func UpdateCStorVolumeAttachmentCR(csivol *apis.CStorVolumeAttachment) error
- func WaitForVolumeReadyAndReachable(vol *apis.CStorVolumeAttachment) error
- func WaitForVolumeToBeReachable(targetPortal string) error
- func WaitForVolumeToBeReady(volumeID string) error
- type NodeMounter
- type NonBlockingGRPCServer
Constants ¶
const ( // NODEID is the node name on which this pod is currently scheduled NODEID = "nodeID" // VOLNAME is the name of the provisioned volume VOLNAME = "Volname" )
const ( // OpenebsVolumePolicy is the config policy name passed to CSI from the // storage class parameters OpenebsVolumePolicy = "openebs.io/volume-policy" // OpenebsVolumeID is the PV name passed to CSI OpenebsVolumeID = "openebs.io/volumeID" // OpenebsCSPCName is the name of cstor storagepool cluster OpenebsCSPCName = "openebs.io/cstor-pool-cluster" // CVCFinalizer is used for CVC protection so that cvc is not deleted until // the underlying cv is deleted CVCFinalizer = "cvc.openebs.io/finalizer" // TargetLunID indicates the LUN ID at the target TargetLunID = "0" // DefaultIscsiInterface can be used when there is no specific // IscsiInterface set DefaultIscsiInterface = "default" )
const ( // VolumeWaitTimeout indicates the timegap between two consecutive volume // status check attempts VolumeWaitTimeout = 2 // VolumeWaitRetryCount indicates the number of retries made to check the // status of volume before erroring out VolumeWaitRetryCount = 6 // MonitorMountRetryTimeout indicates the time gap between two consecutive //monitoring attempts MonitorMountRetryTimeout = 5 )
const (
// GiB ...
GiB = 1024 * 1024 * 1024
)
Variables ¶
var ( // OpenEBSNamespace is openebs system namespace OpenEBSNamespace string // NodeIDENV is the NodeID of the node on which the pod is present NodeIDENV string // TransitionVolList contains the list of volumes under transition // This list is protected by TransitionVolListLock TransitionVolList map[string]apis.CStorVolumeAttachmentStatus // TransitionVolListLock is required to protect the above Volumes list TransitionVolListLock sync.RWMutex // ReqMountList contains the list of volumes which are required // to be remounted. This list is secured by ReqMountListLock ReqMountList map[string]apis.CStorVolumeAttachmentStatus )
Functions ¶
func ChmodMountPath ¶
ChmodMountPath removes all permission from the folder if volume is not mounted on it
func CreateCStorVolumeAttachmentCR ¶
func CreateCStorVolumeAttachmentCR(csivol *apis.CStorVolumeAttachment, nodeID string) error
CreateCStorVolumeAttachmentCR creates a CSI VOlume CR
func CreateSnapshot ¶
CreateSnapshot creates a snapshot of cstor volume
func DeleteCStorVolumeAttachmentCR ¶
DeleteCStorVolumeAttachmentCR removes the CStorVolumeAttachmentCR for the specified path
func DeleteOldCStorVolumeAttachmentCRs ¶
DeleteOldCStorVolumeAttachmentCRs removes the CStorVolumeAttachmentCR for the specified path
func DeleteSnapshot ¶
DeleteSnapshot deletes a snapshot of cstor volume
func DeleteVolume ¶
DeleteVolume deletes the corresponding CstorVolumeClaim(cvc) CR
func FetchAndUpdateISCSIDetails ¶
func FetchAndUpdateISCSIDetails(volumeID string, vol *apis.CStorVolumeAttachment) error
FetchAndUpdateISCSIDetails fetches the iSCSI details from cstor volume resource and updates the corresponding csivolume resource
func FetchPVDetails ¶
func FetchPVDetails(name string) (*corev1.PersistentVolume, error)
FetchPVDetails gets the PV related to this VolumeID
func GetCStorVolumeAttachment ¶
func GetCStorVolumeAttachment(csivol string) (*apis.CStorVolumeAttachment, error)
GetCStorVolumeAttachment fetches the current Published csi Volume
func GetVolList ¶
func GetVolList(volume string) (*apis.CStorVolumeAttachmentList, error)
GetVolList fetches the current Published Volume list
func GetVolListForNode ¶
func GetVolListForNode() (*apis.CStorVolumeAttachmentList, error)
GetVolListForNode fetches the current Published Volume list
func GetVolume ¶
func GetVolume(volumeID string) (*apisv1.CStorVolumeConfig, error)
GetVolume the corresponding CstorVolumeClaim(cvc) CR
func GetVolumeIP ¶
GetVolumeIP fetches the cstor target IP Address
func GetVolumeSourceDetails ¶
GetVolumeSourceDetails splits the volumeName and snapshot
func IsCVCBound ¶
IsCVCBound returns if the CV is bound to CVC or not
func IsSourceAvailable ¶
IsSourceAvailable returns true if the source volume is available
func MonitorMounts ¶
func MonitorMounts()
MonitorMounts makes sure that all the volumes present in the inmemory list with the driver are mounted with the original mount options This function runs a never ending loop therefore should be run as a goroutine Mounted list is fetched from the OS and the state of all the volumes is reverified after every 5 seconds. If the mountpoint is not present in the list or if it has been remounted with a different mount option by the OS, the volume is added to the ReqMountList which is removed as soon as the remount operation on the volume is complete For each remount operation a new goroutine is created, so that if multiple volumes have lost their original state they can all be remounted in parallel
func PatchCVCNodeID ¶
PatchCVCNodeID patches the NodeID of CVC
func ProvisionVolume ¶
func ProvisionVolume( size int64, volName, replicaCount, cspcName, snapshotID, nodeID, policyName string, ) error
ProvisionVolume creates a CstorVolumeClaim(cvc) CR, watcher for cvc is present in maya-apiserver
func RemountVolume ¶
func RemountVolume( stagingPathExists bool, targetPathExists bool, vol *apis.CStorVolumeAttachment, ) (err error)
RemountVolume unmounts the volume if it is already mounted in an undesired state and then tries to mount again. If it is not mounted the volume, first the disk will be attached via iSCSI login and then it will be mounted
func ResizeVolume ¶
ResizeVolume updates the CstorVolumeClaim(cvc) CR, watcher for cvc is present in maya-apiserver
func RoundUpBytes ¶
RoundUpBytes rounds up the volume size in bytes upto multiplications of GiB in the unit of Bytes
func RoundUpGiB ¶
RoundUpGiB rounds up the volume size in bytes upto multiplications of GiB in the unit of GiB
func UpdateCStorVolumeAttachmentCR ¶
func UpdateCStorVolumeAttachmentCR(csivol *apis.CStorVolumeAttachment) error
UpdateCStorVolumeAttachmentCR updates CStorVolumeAttachment CR related to current nodeID
func WaitForVolumeReadyAndReachable ¶
func WaitForVolumeReadyAndReachable(vol *apis.CStorVolumeAttachment) error
WaitForVolumeReadyAndReachable waits until the volume is ready to accept IOs and is reachable, this function will not come out until both the conditions are met. This function stops the driver from overloading the OS with iSCSI login commands.
func WaitForVolumeToBeReachable ¶
WaitForVolumeToBeReachable keeps the mounts on hold until the volume is reachable
func WaitForVolumeToBeReady ¶
WaitForVolumeToBeReady retrieves the volume info from cstorVolume CR and waits until consistency factor is met for connected replicas
Types ¶
type NodeMounter ¶
type NodeMounter struct {
mount.SafeFormatAndMount
}
func NewNodeMounter ¶
func NewNodeMounter() *NodeMounter
func (*NodeMounter) ExistsPath ¶
func (m *NodeMounter) ExistsPath(pathname string) (bool, error)
func (*NodeMounter) GetDeviceName ¶
func (m *NodeMounter) GetDeviceName(mountPath string) (string, int, error)
func (*NodeMounter) MakeDir ¶
func (m *NodeMounter) MakeDir(pathname string) error
func (*NodeMounter) MakeFile ¶
func (m *NodeMounter) MakeFile(pathname string) error
type NonBlockingGRPCServer ¶
type NonBlockingGRPCServer interface { // Start services at the endpoint Start(endpoint string, ids csi.IdentityServer, cs csi.ControllerServer, ns csi.NodeServer) // Waits for the service to stop Wait() // Stops the service gracefully Stop() // Stops the service forcefully ForceStop() }
NonBlockingGRPCServer defines Non blocking GRPC server interfaces
func NewNonBlockingGRPCServer ¶
func NewNonBlockingGRPCServer() NonBlockingGRPCServer
NewNonBlockingGRPCServer returns a new instance of NonBlockingGRPCServer