models

package
v0.0.0-...-58f6e79 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScanAllSCSIDeviceAddress  = "-"
	ScanSCSIDeviceAddressZero = "0"
)
View Source
const (
	NodeDirty     = NodePublicationState("dirty")
	NodeCleanable = NodePublicationState("cleanable")
	NodeClean     = NodePublicationState("clean")
)

Variables

This section is empty.

Functions

func GenerateVolumePublishName

func GenerateVolumePublishName(volumeID, nodeID string) string

Types

type DFInfo

type DFInfo struct {
	Target string
	Source string
}

DFInfo data structure for wrapping the parsed output from the 'df' command

type FCPAccessInfo

type FCPAccessInfo struct {
	FibreChannelAccessInfo
	FCPLunNumber int32  `json:"fcpLunNumber,omitempty"`
	FCPIgroup    string `json:"fcpIgroup,omitempty"`
	FCPLunSerial string `json:"fcpLunSerial,omitempty"`
}

type FibreChannelAccessInfo

type FibreChannelAccessInfo struct {
	FCTargetWWNN string `json:"fcTargetWWNN,omitempty"`
}

type HostSystem

type HostSystem struct {
	OS       SystemOS `json:"os"`
	Services []string `json:"services,omitempty"`
}

type ISCSIAction

type ISCSIAction int8

ISCSIAction is a data structure for iSCSI self-healing actions

const (
	NoAction ISCSIAction = iota
	Scan
	LoginScan
	LogoutLoginScan
)

func (ISCSIAction) String

func (a ISCSIAction) String() string

type ISCSIDiscoveryInfo

type ISCSIDiscoveryInfo struct {
	Portal     string
	PortalIP   string
	TargetName string
}

ISCSIDiscoveryInfo contains information about discovered iSCSI targets.

type ISCSISessionData

type ISCSISessionData struct {
	PortalInfo  PortalInfo
	LUNs        LUNs
	Remediation ISCSIAction
}

type ISCSISessions

type ISCSISessions struct {
	Info map[string]*ISCSISessionData
}

func (*ISCSISessions) AddLUNToPortal

func (p *ISCSISessions) AddLUNToPortal(portal string, lData LUNData) error

AddLUNToPortal adds a LUNInfo to a pre-existing portal entry in the map

func (*ISCSISessions) AddPortal

func (p *ISCSISessions) AddPortal(portal string, portalInfo PortalInfo) error

AddPortal creates a portal entry along with PortalInfo but without any LUNInfo

func (*ISCSISessions) CheckPortalExists

func (p *ISCSISessions) CheckPortalExists(portal string) bool

CheckPortalExists checks whether the portal is already in the map

func (*ISCSISessions) GeneratePublishInfo

func (p *ISCSISessions) GeneratePublishInfo(portal string) (*VolumePublishInfo, error)

func (*ISCSISessions) GoString

func (p *ISCSISessions) GoString() string

GoString prints Go-syntax representation of the map

func (*ISCSISessions) ISCSISessionData

func (p *ISCSISessions) ISCSISessionData(portal string) (*ISCSISessionData, error)

ISCSISessionData returns the PortalInfo and LUNInfo associated to a portal

func (*ISCSISessions) IsEmpty

func (p *ISCSISessions) IsEmpty() bool

IsEmpty identifies whether portal to LUN mapping is empty or not.

func (*ISCSISessions) LUNInfo

func (p *ISCSISessions) LUNInfo(portal string) (*LUNs, error)

LUNInfo returns LUNInfo for a given portal.

func (*ISCSISessions) LUNsForPortal

func (p *ISCSISessions) LUNsForPortal(portal string) ([]int32, error)

LUNsForPortal returns the list of LUNs associated with this portal

func (*ISCSISessions) PortalInfo

func (p *ISCSISessions) PortalInfo(portal string) (*PortalInfo, error)

PortalInfo returns portal info for a given portal.

func (*ISCSISessions) RemoveLUNFromPortal

func (p *ISCSISessions) RemoveLUNFromPortal(portal string, lunID int32)

RemoveLUNFromPortal removes a LUNInfo from the given portal mapping If it is the last LUNInfo corresponding to a portal, then portal is removed from the map as well

func (*ISCSISessions) RemovePortal

func (p *ISCSISessions) RemovePortal(portal string)

RemovePortal removes portal (along with its PortalInfo and LUNInfo) from the map

func (*ISCSISessions) ResetAllRemediationValues

func (p *ISCSISessions) ResetAllRemediationValues() error

ResetAllRemediationValues resets remediation information associated with all the portals

func (*ISCSISessions) ResetPortalRemediationValue

func (p *ISCSISessions) ResetPortalRemediationValue(portal string) error

ResetPortalRemediationValue resets remediation information associated with the portal

func (*ISCSISessions) String

func (p *ISCSISessions) String() string

String prints values of the map

func (*ISCSISessions) UpdateAndRecordPortalInfoChanges

func (p *ISCSISessions) UpdateAndRecordPortalInfoChanges(portal string, portalInfo PortalInfo) (string, error)

UpdateAndRecordPortalInfoChanges updates the portal information associated with the portal and identifies changes to the portal info (if any)

func (*ISCSISessions) UpdateCHAPForPortal

func (p *ISCSISessions) UpdateCHAPForPortal(portal string, newCHAP IscsiChapInfo) error

UpdateCHAPForPortal updates the CHAP information associated with the portal

func (*ISCSISessions) VolumeIDForPortal

func (p *ISCSISessions) VolumeIDForPortal(portal string) (string, error)

VolumeIDForPortal to get any valid volume ID behind a given portal.

func (*ISCSISessions) VolumeIDForPortalAndLUN

func (p *ISCSISessions) VolumeIDForPortalAndLUN(portal string, lunID int32) (string, error)

VolumeIDForPortalAndLUN to get any valid volume ID behind a given portal.

type IscsiAccessInfo

type IscsiAccessInfo struct {
	IscsiTargetPortal string   `json:"iscsiTargetPortal,omitempty"`
	IscsiPortals      []string `json:"iscsiPortals,omitempty"`
	IscsiTargetIQN    string   `json:"iscsiTargetIqn,omitempty"`
	IscsiLunNumber    int32    `json:"iscsiLunNumber,omitempty"`
	IscsiInterface    string   `json:"iscsiInterface,omitempty"`
	IscsiIgroup       string   `json:"iscsiIgroup,omitempty"`
	IscsiVAGs         []int64  `json:"iscsiVags,omitempty"`
	IscsiLunSerial    string   `json:"iscsiLunSerial,omitempty"`
	IscsiChapInfo
}

type IscsiChapInfo

type IscsiChapInfo struct {
	UseCHAP              bool   `json:"useCHAP"`
	IscsiUsername        string `json:"iscsiUsername,omitempty"`
	IscsiInitiatorSecret string `json:"iscsiInitiatorSecret,omitempty"`
	IscsiTargetUsername  string `json:"iscsiTargetUsername,omitempty"`
	IscsiTargetSecret    string `json:"iscsiTargetSecret,omitempty"`
}

func (IscsiChapInfo) String

func (i IscsiChapInfo) String() string

String implements the stringer interface and ensures that sensitive fields are redacted before being logged/printed

type LUNData

type LUNData struct {
	LUN   int32
	VolID string
}

type LUNs

type LUNs struct {
	Info map[int32]string
}

func (*LUNs) AddLUN

func (l *LUNs) AddLUN(m LUNData)

AddLUN adds a LUN to LUNs map

func (*LUNs) AllLUNs

func (l *LUNs) AllLUNs() []int32

AllLUNs returns a list of LUN Numbers.

func (*LUNs) CheckLUNExists

func (l *LUNs) CheckLUNExists(x int32) bool

CheckLUNExists verifies whether the given LUN exists in LUNs map

func (*LUNs) IdentifyMissingLUNs

func (l *LUNs) IdentifyMissingLUNs(m LUNs) []int32

IdentifyMissingLUNs returns the missing LUNs i.e., existing in m but not in l.

func (*LUNs) IsEmpty

func (l *LUNs) IsEmpty() bool

IsEmpty verifies whether there are any LUN entries in the map

func (*LUNs) RemoveLUN

func (l *LUNs) RemoveLUN(x int32)

RemoveLUN removes a given LUN from LUNs map

func (*LUNs) String

func (l *LUNs) String() string

func (*LUNs) VolumeID

func (l *LUNs) VolumeID(x int32) (string, error)

VolumeID returns volume ID associated with a LUN.

type MountInfo

type MountInfo struct {
	MountId      int
	ParentId     int
	DeviceId     string
	Root         string
	MountPoint   string
	MountOptions []string
	FsType       string
	MountSource  string
	SuperOptions []string
}

MountInfo represents a single line in /proc/self/mountinfo.

type MountPoint

type MountPoint struct {
	Device string
	Path   string
	Type   string
	Opts   []string
	Freq   int
	Pass   int
}

MountPoint represents a single line in /proc/mounts or /etc/fstab.

type NVMeAccessInfo

type NVMeAccessInfo struct {
	NVMeTargetIPs     []string `json:"nvmeTargetIPs,omitempty"`
	NVMeSubsystemNQN  string   `json:"nvmeSubsystemNqn,omitempty"`
	NVMeSubsystemUUID string   `json:"nvmeSubsystemUUID,omitempty"`
	NVMeNamespaceUUID string   `json:"nvmeNamespaceUUID,omitempty"`
}

type NfsAccessInfo

type NfsAccessInfo struct {
	NfsServerIP string `json:"nfsServerIp,omitempty"`
	NfsPath     string `json:"nfsPath,omitempty"`
	NfsUniqueID string `json:"nfsUniqueID,omitempty"`
}

type Node

type Node struct {
	Name             string               `json:"name"`
	IQN              string               `json:"iqn,omitempty"`
	NQN              string               `json:"nqn,omitempty"`
	HostWWPNMap      map[string][]string  `json:"hostWWPNMap,omitempty"`
	IPs              []string             `json:"ips,omitempty"`
	TopologyLabels   map[string]string    `json:"topologyLabels,omitempty"`
	NodePrep         *NodePrep            `json:"nodePrep,omitempty"`
	HostInfo         *HostSystem          `json:"hostInfo,omitempty"`
	Deleted          bool                 `json:"deleted"`
	PublicationState NodePublicationState `json:"publicationState"`
	LogLevel         string               `json:"logLevel"`
	LogWorkflows     string               `json:"logWorkflows"`
	LogLayers        string               `json:"logLayers"`
}

func (*Node) ConstructExternal

func (n *Node) ConstructExternal() *NodeExternal

ConstructExternal returns an externally facing representation of the Node.

func (*Node) Copy

func (n *Node) Copy() *Node

type NodeExternal

type NodeExternal struct {
	Name             string               `json:"name"`
	IQN              string               `json:"iqn,omitempty"`
	NQN              string               `json:"nqn,omitempty"`
	HostWWPNMap      map[string][]string  `json:"hostWWPNMap,omitempty"`
	IPs              []string             `json:"ips,omitempty"`
	TopologyLabels   map[string]string    `json:"topologyLabels,omitempty"`
	NodePrep         *NodePrep            `json:"nodePrep,omitempty"`
	HostInfo         *HostSystem          `json:"hostInfo,omitempty"`
	Deleted          *bool                `json:"deleted,omitempty"`
	PublicationState NodePublicationState `json:"publicationState,omitempty"`
	LogLevel         string               `json:"logLevel"`
	LogWorkflows     string               `json:"logWorkflows"`
	LogLayers        string               `json:"logLayers"`
}

type NodePrep

type NodePrep struct {
	Enabled            bool           `json:"enabled"`
	NFS                NodePrepStatus `json:"nfs,omitempty"`
	NFSStatusMessage   string         `json:"nfsStatusMessage,omitempty"`
	ISCSI              NodePrepStatus `json:"iscsi,omitempty"`
	ISCSIStatusMessage string         `json:"iscsiStatusMessage,omitempty"`
}

NodePrep struct is deprecated and only here for backwards compatibility

type NodePrepBreadcrumb

type NodePrepBreadcrumb struct {
	TridentVersion string `json:"tridentVersion"`
	NFS            string `json:"nfs,omitempty"`
	ISCSI          string `json:"iscsi,omitempty"`
}

type NodePrepStatus

type NodePrepStatus string

type NodePublicationState

type NodePublicationState string

type NodePublicationStateFlags

type NodePublicationStateFlags struct {
	OrchestratorReady  *bool `json:"orchestratorReady,omitempty"`  // Is the node in a state such that volumes may be published?
	AdministratorReady *bool `json:"administratorReady,omitempty"` // Should new publications be allowed?
	ProvisionerReady   *bool `json:"provisionerReady,omitempty"`   // Is publishing volumes to this node safe for the backend?
}

func (*NodePublicationStateFlags) IsNodeCleanable

func (f *NodePublicationStateFlags) IsNodeCleanable() bool

func (*NodePublicationStateFlags) IsNodeCleaned

func (f *NodePublicationStateFlags) IsNodeCleaned() bool

func (*NodePublicationStateFlags) IsNodeDirty

func (f *NodePublicationStateFlags) IsNodeDirty() bool

func (*NodePublicationStateFlags) String

func (f *NodePublicationStateFlags) String() string

type PortalInfo

type PortalInfo struct {
	ISCSITargetIQN         string
	SessionNumber          string // Should only be set when capturing current state of the Portal
	Credentials            IscsiChapInfo
	ReasonInvalid          PortalInvalid // A portal may be in an invalid state, if so then why?
	LastAccessTime         time.Time     // Time at which there was an attempt to self-heal session
	FirstIdentifiedStaleAt time.Time     // Time at which session was first identified to be stale
	Source                 string        // Source of the portal Info
}

func (*PortalInfo) CHAPInUse

func (p *PortalInfo) CHAPInUse() bool

CHAPInUse identifies whether CHAP is set or not

func (*PortalInfo) HasTargetIQN

func (p *PortalInfo) HasTargetIQN() bool

HasTargetIQN verifies if target IQN is set or not

func (*PortalInfo) IsFirstIdentifiedStaleAtSet

func (p *PortalInfo) IsFirstIdentifiedStaleAtSet() bool

IsFirstIdentifiedStaleAtSet identifies if FirstIdentifiedStaleAt time is set or not

func (*PortalInfo) IsValid

func (p *PortalInfo) IsValid() bool

IsValid verifies if PortalInfo is valid or not

func (*PortalInfo) RecordChanges

func (p *PortalInfo) RecordChanges(m PortalInfo) string

RecordChanges compares a given portal info with another portal info and record changes

func (*PortalInfo) ResetFirstIdentifiedStaleAt

func (p *PortalInfo) ResetFirstIdentifiedStaleAt()

ResetFirstIdentifiedStaleAt reset FirstIdentifiedStaleAt time to its zero value

func (*PortalInfo) String

func (p *PortalInfo) String() string

func (*PortalInfo) UpdateCHAPCredentials

func (p *PortalInfo) UpdateCHAPCredentials(credentials IscsiChapInfo)

UpdateCHAPCredentials updates Portal's CHAP credentials

type PortalInvalid

type PortalInvalid int8

PortalInvalid is a data structure for iSCSI self-healing capturing Portal's invalid non-recoverable state

const (
	NotInvalid PortalInvalid = iota
	MissingTargetIQN
	MissingMpathDevice
	DuplicatePortals
)

func (PortalInvalid) String

func (a PortalInvalid) String() string

type SMBAccessInfo

type SMBAccessInfo struct {
	SMBServer string `json:"smbServer,omitempty"`
	SMBPath   string `json:"smbPath,omitempty"`
}

type ScsiDeviceAddress

type ScsiDeviceAddress struct {
	Host    string
	Channel string
	Target  string
	LUN     string
}

ScsiDeviceAddress is a data structure for representing a SCSI device address

type ScsiDeviceInfo

type ScsiDeviceInfo struct {
	ScsiDeviceAddress
	Devices         []string
	DevicePaths     []string
	MultipathDevice string
	Filesystem      string
	IQN             string
	WWNN            string
	SessionNumber   int
	CHAPInfo        IscsiChapInfo
}

ScsiDeviceInfo contains information about SCSI devices

type SystemOS

type SystemOS struct {
	Distro  string `json:"distro"` // ubuntu/centos/rhel/windows
	Version string `json:"version"`
	Release string `json:"release,omitempty"`
}

type VolumeAccessInfo

type VolumeAccessInfo struct {
	IscsiAccessInfo
	NVMeAccessInfo
	NfsAccessInfo
	SMBAccessInfo
	FCPAccessInfo
	MountOptions       string `json:"mountOptions,omitempty"`
	FormatOptions      string `json:"formatOptions,omitempty"`
	PublishEnforcement bool   `json:"publishEnforcement,omitempty"`
	ReadOnly           bool   `json:"readOnly,omitempty"`
	// The access mode values are defined by CSI
	// See https://github.com/container-storage-interface/spec/blob/release-1.5/lib/go/csi/csi.pb.go#L135
	AccessMode int32 `json:"accessMode,omitempty"`
}

type VolumePublication

type VolumePublication struct {
	Name       string `json:"name"`
	NodeName   string `json:"node"`
	VolumeName string `json:"volume"`
	ReadOnly   bool   `json:"readOnly"`
	// The access mode values are defined by CSI
	// See https://github.com/container-storage-interface/spec/blob/release-1.5/lib/go/csi/csi.pb.go#L135
	AccessMode int32 `json:"accessMode"`
}

func (*VolumePublication) ConstructExternal

func (v *VolumePublication) ConstructExternal() *VolumePublicationExternal

ConstructExternal returns an externally facing representation of the VolumePublication.

func (*VolumePublication) Copy

Copy returns a new copy of the VolumePublication.

type VolumePublicationExternal

type VolumePublicationExternal struct {
	Name       string `json:"name"`
	NodeName   string `json:"node"`
	VolumeName string `json:"volume"`
	ReadOnly   bool   `json:"readOnly"`
	// The access mode values are defined by CSI
	// See https://github.com/container-storage-interface/spec/blob/release-1.5/lib/go/csi/csi.pb.go#L135
	AccessMode int32 `json:"accessMode"`
}

type VolumePublishInfo

type VolumePublishInfo struct {
	Localhost         bool                `json:"localhost,omitempty"`
	HostIQN           []string            `json:"hostIQN,omitempty"`
	HostNQN           string              `json:"hostNQN,omitempty"`
	HostWWPNMap       map[string][]string `json:"hostWWPNMap,omitempty"`
	HostIP            []string            `json:"hostIP,omitempty"`
	BackendUUID       string              `json:"backendUUID,omitempty"`
	Nodes             []*Node             `json:"nodes,omitempty"`
	HostName          string              `json:"hostName,omitempty"`
	FilesystemType    string              `json:"fstype,omitempty"`
	SharedTarget      bool                `json:"sharedTarget,omitempty"`
	DevicePath        string              `json:"devicePath,omitempty"`
	RawDevicePath     string              `json:"rawDevicePath,omitempty"` // NOTE: devicePath was renamed to this 23.01-23.04
	Unmanaged         bool                `json:"unmanaged,omitempty"`
	StagingMountpoint string              `json:"stagingMountpoint,omitempty"` // NOTE: Added in 22.04 release
	TridentUUID       string              `json:"tridentUUID,omitempty"`       // NOTE: Added in 22.07 release
	LUKSEncryption    string              `json:"LUKSEncryption,omitempty"`
	SANType           string              `json:"SANType,omitempty"`
	VolumeAccessInfo
}

type VolumeTrackingInfo

type VolumeTrackingInfo struct {
	VolumePublishInfo
	VolumeTrackingInfoPath string
	StagingTargetPath      string              `json:"stagingTargetPath"`
	PublishedPaths         map[string]struct{} `json:"publishedTargetPaths"`
}

type VolumeTrackingPublishInfo

type VolumeTrackingPublishInfo struct {
	StagingTargetPath string `json:"stagingTargetPath"`
}

type VolumeUpdateInfo

type VolumeUpdateInfo struct {
	SnapshotDirectory string `json:"snapshotDirectory"`
	PoolLevel         bool   `json:"poolLevel"`
}

Jump to

Keyboard shortcuts

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