client

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 37 Imported by: 398

Documentation

Overview

Copyright 2016 The Rook Authors. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package client provides methods for creating and formatting Ceph configuration files for daemons.

Copyright 2016 The Rook Authors. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016 The Rook Authors. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2018 The Rook Authors. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016 The Rook Authors. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016 The Rook Authors. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	// AdminUsername is the name of the admin user
	AdminUsername = "client.admin"
	// CephTool is the name of the CLI tool for 'ceph'
	CephTool = "ceph"
	// RBDTool is the name of the CLI tool for 'rbd'
	RBDTool = "rbd"
	// RadosTool is the name of the CLI tool for 'rados'
	RadosTool = "rados"
	// Kubectl is the name of the CLI tool for 'kubectl'
	Kubectl = "kubectl"
	// CrushTool is the name of the CLI tool for 'crushtool'
	CrushTool = "crushtool"
	// GaneshaRadosGraceTool is the name of the CLI tool for 'ganesha-rados-grace'
	GaneshaRadosGraceTool = "ganesha-rados-grace"
	// DefaultPGCount will cause Ceph to use the internal default PG count
	DefaultPGCount = "0"
	// CommandProxyInitContainerName is the name of the init container for proxying ceph command when multus is used
	CommandProxyInitContainerName = "cmd-proxy"
	// ProxyAppLabel is the label used to identify the proxy container
	ProxyAppLabel = "rook-ceph-mgr"
)
View Source
const (
	// DefaultKeyringFile is the default name of the file where Ceph stores its keyring info
	DefaultKeyringFile = "keyring"
	// Msgr2port is the listening port of the messenger v2 protocol
	Msgr2port = 3300
	// Msgr1port is the listening port of the messenger v1 protocol
	Msgr1port = 6789
)
View Source
const (
	MiB          = uint64(1048576) // 1 MiB
	ImageMinSize = MiB
)
View Source
const (
	// AdminKeyringTemplate is a string template of Ceph keyring settings which allow connection
	// as admin. The key value must be filled in by the admin auth key for the cluster.
	AdminKeyringTemplate = `
[client.admin]
	key = %s
	caps mds = "allow *"
	caps mon = "allow *"
	caps osd = "allow *"
	caps mgr = "allow *"
`

	// UserKeyringTemplate is a string template of Ceph keyring settings which allow connection.
	UserKeyringTemplate = `
[%s]
	key = %s
`
)
View Source
const (
	CompressionModeProperty = "compression_mode"
	PgAutoscaleModeProperty = "pg_autoscale_mode"
	PgAutoscaleModeOn       = "on"
)
View Source
const (
	// CephHealthOK denotes the status of ceph cluster when healthy.
	CephHealthOK = "HEALTH_OK"

	// CephHealthWarn denotes the status of ceph cluster when unhealthy but recovering.
	CephHealthWarn = "HEALTH_WARN"

	// CephHealthErr denotes the status of ceph cluster when unhealthy but usually needs
	// manual intervention.
	CephHealthErr = "HEALTH_ERR"
)
View Source
const (
	CrushRootConfigKey = "crushRoot"
)
View Source
const NoSubvolumeGroup = ""

NoSubvolumeGroup can be passed to commands that operate on filesystem subvolume groups to indicate the case where there is no subvolume group.

Variables

View Source
var (
	// DefaultConfigDir is the default dir where Ceph stores its configs. Can be overridden for unit
	// tests.
	DefaultConfigDir = "/etc/ceph"

	// DefaultConfigFile is the default name of the file where Ceph stores its configs. Can be
	// overridden for unit tests.
	DefaultConfigFile = "ceph.conf"
)
View Source
var GetFilesystem = getFilesystem
View Source
var ListSubVolumeSnapshotPendingClones = listSubVolumeSnapshotPendingClones
View Source
var ListSubVolumeSnapshots = listSubVolumeSnapshots

ListSubVolumeSnaphots lists all the subvolume snapshots present in the subvolume in the given filesystem's subvolume group.

View Source
var ListSubvolumeGroups = listSubvolumeGroups

ListSubvolumeGroups lists all subvolume groups in a given filesystem by name. Times out after 5 seconds.

View Source
var ListSubvolumesInGroup = listSubvolumesInGroup

ListSubvolumesInGroup lists all subvolumes present in the given filesystem's subvolume group by name. If groupName is empty, list subvolumes that are not in any group.

View Source
var RunAllCephCommandsInToolboxPod string

RunAllCephCommandsInToolboxPod - when running the e2e tests, all ceph commands need to be run in the toolbox. Everywhere else, the ceph tools are assumed to be in the container where we can shell out. This is the name of the pod.

Functions

func AddDataPoolToFilesystem added in v1.5.0

func AddDataPoolToFilesystem(context *clusterd.Context, clusterInfo *ClusterInfo, name, poolName string) error

AddDataPoolToFilesystem associates the provided data pool with the filesystem.

func AddSnapshotSchedule added in v1.7.1

func AddSnapshotSchedule(context *clusterd.Context, clusterInfo *ClusterInfo, path, interval, startTime, filesystem string) error

func AddSnapshotScheduleRetention added in v1.7.1

func AddSnapshotScheduleRetention(context *clusterd.Context, clusterInfo *ClusterInfo, path, duration, filesystem string) error

func AllowStandbyReplay added in v1.0.0

func AllowStandbyReplay(context *clusterd.Context, clusterInfo *ClusterInfo, fsName string, allowStandbyReplay bool) error

AllowStandbyReplay gets detailed status information about a Ceph filesystem.

func ArchiveCrash added in v1.5.8

func ArchiveCrash(context *clusterd.Context, clusterInfo *ClusterInfo, crashID string) error

ArchiveCrash archives the crash with respective crashID

func AuthDelete

func AuthDelete(context *clusterd.Context, clusterInfo *ClusterInfo, name string) error

AuthDelete will delete the given user.

func AuthGetCaps added in v1.2.0

func AuthGetCaps(context *clusterd.Context, clusterInfo *ClusterInfo, name string) (caps map[string]string, error error)

AuthGetCaps gets the capabilities for the given user.

func AuthGetKey

func AuthGetKey(context *clusterd.Context, clusterInfo *ClusterInfo, name string) (string, error)

AuthGetKey gets the key for the given user.

func AuthGetOrCreate

func AuthGetOrCreate(context *clusterd.Context, clusterInfo *ClusterInfo, name, keyringPath string, caps []string) error

AuthGetOrCreate will either get or create a user with the given capabilities. The keyring for the user will be written to the given keyring path.

func AuthGetOrCreateKey

func AuthGetOrCreateKey(context *clusterd.Context, clusterInfo *ClusterInfo, name string, caps []string) (string, error)

AuthGetOrCreateKey gets or creates the key for the given user.

func AuthUpdateCaps added in v1.0.0

func AuthUpdateCaps(context *clusterd.Context, clusterInfo *ClusterInfo, name string, caps []string) error

AuthUpdateCaps updates the capabilities for the given user.

func CancelSnapshotClone added in v1.14.1

func CancelSnapshotClone(context *clusterd.Context, clusterInfo *ClusterInfo, fs, svg, clone string) error

func CephConfFilePath added in v1.1.0

func CephConfFilePath(configDir, clusterName string) string

CephConfFilePath returns the location to the cluster's config file in the operator container.

func CephKeyring added in v1.4.0

func CephKeyring(cred CephCred) string

CephKeyring returns the filled-out user keyring

func ConfigureBalancerModule added in v1.3.6

func ConfigureBalancerModule(context *clusterd.Context, clusterInfo *ClusterInfo, balancerModuleMode string) error

ConfigureBalancerModule configures the balancer module

func CreateCephFSSubVolumeGroup added in v1.8.2

func CreateCephFSSubVolumeGroup(context *clusterd.Context, clusterInfo *ClusterInfo, volName, groupName string, svgSpec *cephv1.CephFilesystemSubVolumeGroupSpec) error

CreateCephFSSubVolumeGroup create a CephFS subvolume group. volName is the name of the Ceph FS volume, the same as the CephFilesystem CR name.

func CreateDefaultStretchCrushRule added in v1.5.0

func CreateDefaultStretchCrushRule(context *clusterd.Context, clusterInfo *ClusterInfo, clusterSpec *cephv1.ClusterSpec, failureDomain string) error

CreateDefaultStretchCrushRule creates the default CRUSH rule for the stretch cluster

func CreateErasureCodeProfile

func CreateErasureCodeProfile(context *clusterd.Context, clusterInfo *ClusterInfo, profileName string, pool cephv1.PoolSpec) error

func CreateFSMirrorBootstrapPeer added in v1.7.1

func CreateFSMirrorBootstrapPeer(context *clusterd.Context, clusterInfo *ClusterInfo, fsName string) ([]byte, error)

CreateFSMirrorBootstrapPeer add a mirror peer in the cephfs-mirror configuration

func CreateFilesystem

func CreateFilesystem(context *clusterd.Context, clusterInfo *ClusterInfo, name, metadataPool string, dataPools []string) error

CreateFilesystem performs software configuration steps for Ceph to provide a new filesystem.

func CreateKeyring added in v1.4.0

func CreateKeyring(context *clusterd.Context, clusterInfo *ClusterInfo, username, keyringPath string, access []string, generateContents func(string) string) error

CreateKeyring creates a keyring for access to the cluster with the desired set of privileges and writes it to disk at the keyring path

func CreatePool

func CreatePool(context *clusterd.Context, clusterInfo *ClusterInfo, clusterSpec *cephv1.ClusterSpec, pool *cephv1.NamedPoolSpec) error

func CreatePoolWithPGs added in v1.8.5

func CreatePoolWithPGs(context *clusterd.Context, clusterInfo *ClusterInfo, clusterSpec *cephv1.ClusterSpec, pool *cephv1.NamedPoolSpec, pgCount string) error

func CreateRBDMirrorBootstrapPeer added in v1.5.0

func CreateRBDMirrorBootstrapPeer(context *clusterd.Context, clusterInfo *ClusterInfo, poolName string) ([]byte, error)

CreateRBDMirrorBootstrapPeer add a mirror peer in the rbd-mirror configuration

func CreateRBDMirrorBootstrapPeerWithoutPool added in v1.7.1

func CreateRBDMirrorBootstrapPeerWithoutPool(context *clusterd.Context, clusterInfo *ClusterInfo) ([]byte, error)
CreateRBDMirrorBootstrapPeerWithoutPool creates a bootstrap peer for the current cluster

It creates the cephx user for the remote cluster to use with all the necessary details This function is handy on scenarios where no pools have been created yet but replication communication is required (connecting peers) It essentially sits above CreateRBDMirrorBootstrapPeer() and is a cluster-wide option in the scenario where all the pools will be mirrored to the same remote cluster

So the scenario looks like:

  1. Create the cephx ID on the source cluster

  2. Enable a source pool for mirroring - at any time, we just don't know when rbd --cluster site-a mirror pool enable image-pool image

  3. Copy the key details over to the other cluster (non-ceph workflow)

  4. Enable destination pool for mirroring rbd --cluster site-b mirror pool enable image-pool image

  5. Add the peer details to the destination pool

  6. Repeat the steps flipping source and destination to enable bi-directional mirroring

func CreateRadosNamespace added in v1.9.0

func CreateRadosNamespace(context *clusterd.Context, clusterInfo *ClusterInfo, poolName, namespaceName string) error

CreateRadosNamespace create a rados namespace in a pool. poolName is the name of the ceph block pool, the same as the CephBlockPool CR name.

func DefaultConfigFilePath added in v1.4.0

func DefaultConfigFilePath() string

DefaultConfigFilePath returns the full path to Ceph's default config file

func DeleteCephFSSubVolumeGroup added in v1.8.2

func DeleteCephFSSubVolumeGroup(context *clusterd.Context, clusterInfo *ClusterInfo, volName, groupName string) error

DeleteCephFSSubVolumeGroup delete a CephFS subvolume group.

func DeleteErasureCodeProfile

func DeleteErasureCodeProfile(context *clusterd.Context, clusterInfo *ClusterInfo, profileName string) error

func DeleteImageFromTrashInRadosNamespace added in v1.14.1

func DeleteImageFromTrashInRadosNamespace(context *clusterd.Context, clusterInfo *ClusterInfo, poolName, imageID, namespace string) error

DeleteImageFromTrashInRadosNamespace deletes the image from trash in the rados namespace

func DeleteImageInPool added in v1.14.1

func DeleteImageInPool(context *clusterd.Context, clusterInfo *ClusterInfo, name, poolName string) error

func DeleteImageInRadosNamespace added in v1.14.1

func DeleteImageInRadosNamespace(context *clusterd.Context, clusterInfo *ClusterInfo, name, poolName, namespace string) error

func DeleteOmapKey added in v1.14.1

func DeleteOmapKey(context *clusterd.Context, clusterInfo *ClusterInfo, omapKey, poolName, namespace string) error

func DeleteOmapValue added in v1.14.1

func DeleteOmapValue(context *clusterd.Context, clusterInfo *ClusterInfo, omapValue, poolName, namespace string) error

func DeletePool

func DeletePool(context *clusterd.Context, clusterInfo *ClusterInfo, name string) error

DeletePool purges a pool from Ceph

func DeleteRadosNamespace added in v1.9.0

func DeleteRadosNamespace(context *clusterd.Context, clusterInfo *ClusterInfo, poolName, namespaceName string) error

DeleteRadosNamespace delete a rados namespace.

func DeleteSnapshotInRadosNamespace added in v1.14.1

func DeleteSnapshotInRadosNamespace(context *clusterd.Context, clusterInfo *ClusterInfo, poolName, imageName, snapshot, namespace string) error

DeleteSnapshotInRadosNamespace deletes a image snapshot created in block pool in a given rados namespace

func DeleteSubVolume added in v1.14.1

func DeleteSubVolume(context *clusterd.Context, clusterInfo *ClusterInfo, fs, subvol, svg string) error

func DeleteSubvolumeSnapshot added in v1.14.1

func DeleteSubvolumeSnapshot(context *clusterd.Context, clusterInfo *ClusterInfo, fs, subvol, svg, snap string) error

func DisableFilesystemSnapshotMirror added in v1.6.0

func DisableFilesystemSnapshotMirror(context *clusterd.Context, clusterInfo *ClusterInfo, filesystem string) error

DisableFilesystemSnapshotMirror enables filesystem snapshot mirroring

func DisablePoolMirroring added in v1.14.0

func DisablePoolMirroring(context *clusterd.Context, clusterInfo *ClusterInfo, poolName string) error

disablePoolMirroring turns off mirroring on a pool

func DisableRBDRadosNamespaceMirroring added in v1.16.0

func DisableRBDRadosNamespaceMirroring(context *clusterd.Context, clusterInfo *ClusterInfo, poolAndRadosNamespaceName string) error

func EnableFilesystemSnapshotMirror added in v1.6.0

func EnableFilesystemSnapshotMirror(context *clusterd.Context, clusterInfo *ClusterInfo, filesystem string) error

EnableFilesystemSnapshotMirror enables filesystem snapshot mirroring

func EnableRBDRadosNamespaceMirroring added in v1.16.0

func EnableRBDRadosNamespaceMirroring(context *clusterd.Context, clusterInfo *ClusterInfo, poolAndRadosNamespaceName string, remoteNamespace *string, mode string) error

EnableRBDRadosNamespaceMirroring enables rbd mirroring on a rados namespace.

func EnableReleaseOSDFunctionality added in v1.3.0

func EnableReleaseOSDFunctionality(context *clusterd.Context, clusterInfo *ClusterInfo, release string) error

EnableReleaseOSDFunctionality disallows pre-Nautilus OSDs and enables all new Nautilus-only functionality

func EnableSnapshotSchedules added in v1.16.0

func EnableSnapshotSchedules(context *clusterd.Context, clusterInfo *ClusterInfo, poolName string, snapshotSchedules []cephv1.SnapshotScheduleSpec) error

`poolName` is the name of the pool or the pool/radosNamespace

func EnableStretchElectionStrategy added in v1.5.0

func EnableStretchElectionStrategy(context *clusterd.Context, clusterInfo *ClusterInfo) error

EnableStretchElectionStrategy enables the mon connectivity algorithm for stretch clusters

func ExecuteCephCommandWithRetry added in v1.0.0

func ExecuteCephCommandWithRetry(
	cmd func() (string, []byte, error),
	retries int,
	waitTime time.Duration,
) ([]byte, error)

func ExecuteRBDCommandWithTimeout

func ExecuteRBDCommandWithTimeout(context *clusterd.Context, args []string) (string, error)

ExecuteRBDCommandWithTimeout executes the 'rbd' command with a timeout of 1 minute. This method is left as a special case in which the caller has fully configured its arguments. It is future work to integrate this case into the generalization.

func ExpandImage added in v1.1.0

func ExpandImage(context *clusterd.Context, clusterInfo *ClusterInfo, name, poolName, monitors, keyring string, size uint64) error

func FailAllStandbyReplayMDS added in v1.6.2

func FailAllStandbyReplayMDS(context *clusterd.Context, clusterInfo *ClusterInfo, fsName string) error

FailAllStandbyReplayMDS: fail all mds in up:standby-replay state

func FailFilesystem added in v1.0.0

func FailFilesystem(context *clusterd.Context, clusterInfo *ClusterInfo, fsName string) error

FailFilesystem efficiently brings down the filesystem by marking the filesystem as down and failing the MDSes using a single Ceph command.

func FinalizeCephCommandArgs added in v0.8.0

func FinalizeCephCommandArgs(command string, clusterInfo *ClusterInfo, args []string, configDir string) (string, []string)

FinalizeCephCommandArgs builds the command line to be called

func GenerateConnectionConfig added in v1.4.0

func GenerateConnectionConfig(context *clusterd.Context, cluster *ClusterInfo) (string, error)

GenerateConnectionConfig calls GenerateConnectionConfigWithSettings with no settings overridden.

func GenerateConnectionConfigWithSettings added in v1.4.0

func GenerateConnectionConfigWithSettings(context *clusterd.Context, clusterInfo *ClusterInfo, settings *CephConfig) (string, error)

GenerateConnectionConfigWithSettings generates a Ceph config and keyring which will allow the daemon to connect. Default config file settings can be overridden by specifying some subset of settings.

func GetAllCephDaemonVersions added in v1.1.0

func GetAllCephDaemonVersions(context *clusterd.Context, clusterInfo *ClusterInfo) (*cephv1.CephDaemonsVersions, error)

GetAllCephDaemonVersions reports the Ceph version of each daemon in the cluster

func GetCephMonVersion added in v1.0.0

func GetCephMonVersion(context *clusterd.Context, clusterInfo *ClusterInfo) (*cephver.CephVersion, error)

GetCephMonVersion reports the Ceph version of all the monitors, or at least a majority with quorum

func GetCompiledCrushMap added in v1.5.0

func GetCompiledCrushMap(context *clusterd.Context, clusterInfo *ClusterInfo) (string, error)

GetCompiledCrushMap fetches the Ceph compiled version of the CRUSH map

func GetCrushHostName

func GetCrushHostName(context *clusterd.Context, clusterInfo *ClusterInfo, osdID int) (string, error)

GetCrushHostName gets the hostname where an OSD is running on

func GetCrushRootFromSpec added in v1.5.0

func GetCrushRootFromSpec(c *cephv1.ClusterSpec) string

Obtain the cluster-wide default crush root from the cluster spec

func GetDeviceClassOSDs added in v1.7.1

func GetDeviceClassOSDs(context *clusterd.Context, clusterInfo *ClusterInfo, deviceClass string) ([]int, error)

GetDeviceClassOSDs gets the OSDs associated with a device class.

func GetDeviceClasses added in v1.4.0

func GetDeviceClasses(context *clusterd.Context, clusterInfo *ClusterInfo) ([]string, error)

GetDeviceClasses gets the available device classes.

func GetErasureCodeProfileForPool

func GetErasureCodeProfileForPool(baseName string) string

func GetFSMirrorDaemonStatus added in v1.7.1

func GetFSMirrorDaemonStatus(context *clusterd.Context, clusterInfo *ClusterInfo, fsName string) ([]cephv1.FilesystemMirroringInfo, error)

GetFSMirrorDaemonStatus returns the mirroring status of a given filesystem

func GetMdsIdByRank added in v1.6.2

func GetMdsIdByRank(context *clusterd.Context, clusterInfo *ClusterInfo, fsName string, rank int32) (string, error)

GetMdsIdByRank get mds ID from the given rank

func GetOMAPKey added in v1.14.1

func GetOMAPKey(context *clusterd.Context, clusterInfo *ClusterInfo, omapObj, poolName, namespace string) (string, error)

func GetOSDOnHost added in v1.4.0

func GetOSDOnHost(context *clusterd.Context, clusterInfo *ClusterInfo, node string) (string, error)

GetOSDOnHost returns the list of osds running on a given host

func GetPoolMirroringInfo added in v1.5.0

func GetPoolMirroringInfo(context *clusterd.Context, clusterInfo *ClusterInfo, poolName string) (*cephv1.MirroringInfo, error)

GetPoolMirroringInfo prints the pool mirroring information `poolName` is the name of the pool or the pool/radosNamespace

func GetPoolMirroringStatus added in v1.5.0

func GetPoolMirroringStatus(context *clusterd.Context, clusterInfo *ClusterInfo, poolName string) (*cephv1.MirroringStatus, error)

GetPoolMirroringStatus prints the pool mirroring status

func GetPoolNamesByID

func GetPoolNamesByID(context *clusterd.Context, clusterInfo *ClusterInfo) (map[int]string, error)

func GetSnapshotScheduleStatus added in v1.5.1

func GetSnapshotScheduleStatus(context *clusterd.Context, clusterInfo *ClusterInfo, filesystem string) ([]cephv1.FilesystemSnapshotSchedulesSpec, error)

func ImportFSMirrorBootstrapPeer added in v1.7.1

func ImportFSMirrorBootstrapPeer(context *clusterd.Context, clusterInfo *ClusterInfo, fsName, token string) error

ImportFSMirrorBootstrapPeer add a mirror peer in the cephfs-mirror configuration

func ImportRBDMirrorBootstrapPeer added in v1.5.0

func ImportRBDMirrorBootstrapPeer(context *clusterd.Context, clusterInfo *ClusterInfo, poolName string, direction string, token []byte) error

ImportRBDMirrorBootstrapPeer add a mirror peer in the rbd-mirror configuration

func IsCephHealthy added in v1.1.0

func IsCephHealthy(context *clusterd.Context, clusterInfo *ClusterInfo) bool

IsCephHealthy verifies Ceph is healthy, useful when performing an upgrade check if it's a minor or major upgrade... too!

func IsClusterClean

func IsClusterClean(context *clusterd.Context, clusterInfo *ClusterInfo, pgHealthyRegex string) (string, bool, error)

IsClusterClean returns msg (string), clean (bool), err (error) msg describes the state of the PGs clean is true if the cluster is clean err is not nil if getting the status failed.

func IsClusterCleanError added in v1.1.0

func IsClusterCleanError(context *clusterd.Context, clusterInfo *ClusterInfo, pgHealthyRegex string) error

IsClusterCleanError returns an error indicating if the cluster is fully clean yet (i.e., all placement groups are in the active+clean state). It returns nil if the cluster is clean. Using IsClusterClean is recommended if you want to differentiate between a failure of the status query and an unclean cluster.

func IsKeyringBase64Encoded added in v1.4.0

func IsKeyringBase64Encoded(keyring string) bool

IsKeyringBase64Encoded returns whether the keyring is valid

func IsNormalizedCrushNameEqual added in v1.1.0

func IsNormalizedCrushNameEqual(notNormalized, normalized string) bool

IsNormalizedCrushNameEqual returns true if normalized is either equal to or the normalized version of notNormalized a crush name is normalized if it comes from the crushmap or has passed through the NormalizeCrushName function.

func LeastUptodateDaemonVersion added in v1.1.0

func LeastUptodateDaemonVersion(context *clusterd.Context, clusterInfo *ClusterInfo, daemonType string) (cephver.CephVersion, error)

LeastUptodateDaemonVersion returns the ceph version of the least updated daemon type So if we invoke this method function with "mon", it will look for the least recent version Assume the following:

"mon": {
    "ceph version 18.2.5 (cbff874f9007f1869bfd3821b7e33b2a6ffd4988) reef (stable)": 2,
    "ceph version 19.2.0 (3a54b2b6d167d4a2a19e003a705696d4fe619afc) squid (stable)": 1
}

In the case we will pick: "ceph version 18.2.5 (cbff874f9007f1869bfd3821b7e33b2a6ffd4988) reef (stable)": 2, And eventually return 18.2.5

func ListErasureCodeProfiles

func ListErasureCodeProfiles(context *clusterd.Context, clusterInfo *ClusterInfo) ([]string, error)

func ListRadosNamespacesInPool added in v1.16.0

func ListRadosNamespacesInPool(context *clusterd.Context, clusterInfo *ClusterInfo, poolName string) ([]string, error)

ListRadosNamespacesInPool lists the rados namespaces in a pool

func ListSnapshotSchedulesRecursively added in v1.6.0

func ListSnapshotSchedulesRecursively(context *clusterd.Context, clusterInfo *ClusterInfo, poolName string) ([]cephv1.SnapshotSchedulesSpec, error)

ListSnapshotSchedulesRecursively configures the snapshots schedule on a mirrored pool

func MapImage

func MapImage(context *clusterd.Context, clusterInfo *ClusterInfo, imageName, poolName, id, keyring, monitors string) error

MapImage maps an RBD image using admin cephfx and returns the device path

func MarkFilesystemAsDown

func MarkFilesystemAsDown(context *clusterd.Context, clusterInfo *ClusterInfo, fsName string) error

MarkFilesystemAsDown marks a Ceph filesystem as down.

func MdsActiveOrStandbyReplay added in v1.1.0

func MdsActiveOrStandbyReplay(context *clusterd.Context, clusterInfo *ClusterInfo, fsName string) error

MdsActiveOrStandbyReplay returns whether a given MDS is active or in standby

func MgrDisableModule added in v0.8.0

func MgrDisableModule(context *clusterd.Context, clusterInfo *ClusterInfo, name string) error

MgrDisableModule disables a mgr module

func MgrEnableModule

func MgrEnableModule(context *clusterd.Context, clusterInfo *ClusterInfo, name string, force bool) error

MgrEnableModule enables a mgr module

func MoveImageToTrashInRadosNamespace added in v1.14.1

func MoveImageToTrashInRadosNamespace(context *clusterd.Context, clusterInfo *ClusterInfo, poolName, imageName, namespace string) error

MoveImageToTrashInRadosNamespace moves the cephblockpool image to trash in the rados namespace

func NewMinimumOwnerInfo added in v1.6.0

func NewMinimumOwnerInfo(t *testing.T) *k8sutil.OwnerInfo

func NewMinimumOwnerInfoWithOwnerRef added in v1.6.0

func NewMinimumOwnerInfoWithOwnerRef() *k8sutil.OwnerInfo

func NewMirrorChecker added in v1.16.0

func NewMirrorChecker(context *clusterd.Context, client client.Client, clusterInfo *ClusterInfo, namespacedName types.NamespacedName, monitoringSpec *cephv1.NamedPoolSpec, object client.Object) *mirrorChecker

newMirrorChecker creates a new HealthChecker object

func NormalizeCrushName added in v1.1.0

func NormalizeCrushName(name string) string

NormalizeCrushName replaces . with -

func OSDOkToStop added in v1.6.0

func OSDOkToStop(context *clusterd.Context, clusterInfo *ClusterInfo, osdID, maxReturned int) ([]int, error)

OSDOkToStop returns a list of OSDs that can be stopped that includes the OSD ID given. This is relevant, for example, when checking which OSDs can be updated. The number of OSDs returned is limited by the value set in maxReturned. maxReturned=0 is the same as maxReturned=1.

func OSDOut

func OSDOut(context *clusterd.Context, clusterInfo *ClusterInfo, osdID int) (string, error)

func OSDUpdateShouldCheckOkToStop added in v1.6.0

func OSDUpdateShouldCheckOkToStop(context *clusterd.Context, clusterInfo *ClusterInfo) bool

OSDUpdateShouldCheckOkToStop returns true if Rook should check ok-to-stop for OSDs when doing OSD daemon updates. It will return false if it should not perform ok-to-stop checks, for example, when there are fewer than 3 OSDs

func OkToContinue added in v1.1.0

func OkToContinue(context *clusterd.Context, clusterInfo *ClusterInfo, deployment, daemonType, daemonName string) error

OkToContinue determines if it's ok to continue an upgrade

func OkToStop added in v1.1.0

func OkToStop(context *clusterd.Context, clusterInfo *ClusterInfo, deployment, daemonType, daemonName string) error

OkToStop determines if it's ok to stop an upgrade

func OsdSafeToDestroy added in v1.1.0

func OsdSafeToDestroy(context *clusterd.Context, clusterInfo *ClusterInfo, osdID int) (bool, error)

func PinCephFSSubVolumeGroup added in v1.13.0

func PinCephFSSubVolumeGroup(context *clusterd.Context, clusterInfo *ClusterInfo, volName string, cephFilesystemSubVolumeGroup *cephv1.CephFilesystemSubVolumeGroup, cephFilesystemSubVolumeGroupName string) error

PinCephFSSubVolumeGroup pin the cephfs subvolume group

func PopulateMonHostMembers added in v1.4.0

func PopulateMonHostMembers(clusterInfo *ClusterInfo) ([]string, []string)

PopulateMonHostMembers extracts a list of just the monitor names, which will populate the "mon initial members" and "mon hosts" global config field

func RadosLockObject added in v1.10.2

func RadosLockObject(
	context *clusterd.Context, clusterInfo *ClusterInfo,
	pool, namespace, objectName, lockName string,
	lockTimeout time.Duration,
) (string, error)

RadosLockObject locks a rados object in a given pool and namespace and returns a lock "cookie" that can be used to identify this unique lock.

func RadosRemoveObject added in v1.10.2

func RadosRemoveObject(
	context *clusterd.Context, clusterInfo *ClusterInfo,
	pool, namespace, objectName string,
) error

RadosRemoveObject idempotently removes a rados object from the given pool and namespace.

func RadosUnlockObject added in v1.10.2

func RadosUnlockObject(
	context *clusterd.Context, clusterInfo *ClusterInfo,
	pool, namespace, objectName, lockName string,
	lockCookie string,
) error

RadosUnlockObject unlocks a rados object in a given pool and namespace by searching for locks on the object that match the "cookie" obtained from a RadosLockObject() call.

func RemoveClusterPeer added in v1.14.0

func RemoveClusterPeer(context *clusterd.Context, clusterInfo *ClusterInfo, poolName, peerUUID string) error

func RemoveFilesystem

func RemoveFilesystem(context *clusterd.Context, clusterInfo *ClusterInfo, fsName string, preservePoolsOnDelete bool) error

RemoveFilesystem performs software configuration steps to remove a Ceph filesystem and its backing pools.

func RemoveFilesystemMirrorPeer added in v1.6.0

func RemoveFilesystemMirrorPeer(context *clusterd.Context, clusterInfo *ClusterInfo, peerUUID string) error

RemoveFilesystemMirrorPeer add a mirror peer in the cephfs-mirror configuration

func ResizeOsdCrushWeight added in v1.15.0

func ResizeOsdCrushWeight(actualOSD OSDNodeUsage, ctx *clusterd.Context, clusterInfo *ClusterInfo) (bool, error)

func SetDeviceClass added in v1.15.0

func SetDeviceClass(context *clusterd.Context, clusterInfo *ClusterInfo, osdID int, deviceClass string) error

func SetFlagOnCrushUnit added in v1.1.0

func SetFlagOnCrushUnit(context *clusterd.Context, clusterInfo *ClusterInfo, crushUnit, flag string) error

SetFlagOnCrushUnit sets the specified flag on the crush unit

func SetMonStretchTiebreaker added in v1.5.0

func SetMonStretchTiebreaker(context *clusterd.Context, clusterInfo *ClusterInfo, monName, bucketType string) error

SetMonStretchTiebreaker sets the tiebreaker mon in the stretch cluster

func SetNewTiebreaker added in v1.7.6

func SetNewTiebreaker(context *clusterd.Context, clusterInfo *ClusterInfo, monName string) error

SetNewTiebreaker sets the new tiebreaker mon in the stretch cluster during a failover

func SetNumMDSRanks added in v0.9.0

func SetNumMDSRanks(context *clusterd.Context, clusterInfo *ClusterInfo, fsName string, activeMDSCount int32) error

SetNumMDSRanks sets the number of mds ranks (max_mds) for a Ceph filesystem.

func SetPoolProperty

func SetPoolProperty(context *clusterd.Context, clusterInfo *ClusterInfo, name, propName, propVal string) error

SetPoolProperty sets a property to a given pool

func SetPoolReplicatedSizeProperty added in v1.3.0

func SetPoolReplicatedSizeProperty(context *clusterd.Context, clusterInfo *ClusterInfo, poolName, size string) error

SetPoolReplicatedSizeProperty sets the replica size of a pool

func SetPrimaryAffinity added in v1.6.2

func SetPrimaryAffinity(context *clusterd.Context, clusterInfo *ClusterInfo, osdID int, affinity string) error

SetPrimaryAffinity assigns primary-affinity (within range [0.0, 1.0]) to a specific OSD.

func UnMapImage

func UnMapImage(context *clusterd.Context, clusterInfo *ClusterInfo, imageName, poolName, id, keyring, monitors string, force bool) error

UnMapImage unmap an RBD image from the node

func UnsetFlagOnCrushUnit added in v1.1.0

func UnsetFlagOnCrushUnit(context *clusterd.Context, clusterInfo *ClusterInfo, crushUnit, flag string) error

UnsetFlagOnCrushUnit unsets the specified flag on the crush unit

func UpdateCrushMapValue added in v1.1.0

func UpdateCrushMapValue(pairs *[]string, key, value string)

UpdateCrushMapValue is for updating the location in the crush map this is not safe for incorrectly formatted strings

func WaitForActiveRanks added in v0.9.0

func WaitForActiveRanks(
	context *clusterd.Context,
	clusterInfo *ClusterInfo, fsName string,
	desiredActiveRanks int32, moreIsOkay bool, timeout time.Duration,
) error

WaitForActiveRanks waits for the filesystem's number of active ranks to equal the desired count. It times out with an error if the number of active ranks does not become desired in time. Param 'moreIsOkay' will allow success condition if num of ranks is more than active count given.

func WaitForNoStandbys added in v1.6.2

func WaitForNoStandbys(context *clusterd.Context, clusterInfo *ClusterInfo, fsName string, retryInterval, timeout time.Duration) error

WaitForNoStandbys waits for all standbys go away

func WriteCephConfig added in v1.6.0

func WriteCephConfig(context *clusterd.Context, clusterInfo *ClusterInfo) error

WriteCephConfig writes the ceph config so ceph commands can be executed

func WriteKeyring added in v1.4.0

func WriteKeyring(keyringPath, authKey string, generateContents func(string) string) error

WriteKeyring calls the generate contents function with auth key as an argument then saves the output of the generateContents function to disk at the keyring path TODO: Kludgey; can keyring files be generated w/ go-ini package or using the '-o' option to 'ceph auth get-or-create ...'?

Types

type AddrvecEntry added in v1.1.0

type AddrvecEntry struct {
	Type  string `json:"type"`
	Addr  string `json:"addr"`
	Nonce int    `json:"nonce"`
}

AddrvecEntry represents an entry type for a given messenger version

type BootstrapPeerToken added in v1.7.1

type BootstrapPeerToken struct {
	Token string `json:"token"`
}

type CephBlockImage

type CephBlockImage struct {
	ID       string `json:"id"`
	Name     string `json:"image"`
	Size     uint64 `json:"size"`
	Format   int    `json:"format"`
	InfoName string `json:"name"`
}

func CreateImage

func CreateImage(context *clusterd.Context, clusterInfo *ClusterInfo, name, poolName, dataPoolName string, size uint64) (*CephBlockImage, error)

CreateImage creates a block storage image. If dataPoolName is not empty, the image will use poolName as the metadata pool and the dataPoolname for data. If size is zero an empty image will be created. Otherwise, an image will be created with a size rounded up to the nearest Mi. The adjusted image size is placed in return value CephBlockImage.Size.

func ListImagesInPool added in v1.14.1

func ListImagesInPool(context *clusterd.Context, clusterInfo *ClusterInfo, poolName string) ([]CephBlockImage, error)

ListImagesInPool returns a list of images created in a cephblockpool

func ListImagesInRadosNamespace added in v1.14.1

func ListImagesInRadosNamespace(context *clusterd.Context, clusterInfo *ClusterInfo, poolName, namespace string) ([]CephBlockImage, error)

ListImagesInRadosNamespace returns a list if images created in a cephblockpool rados namespace

type CephBlockImageSnapshot added in v1.14.1

type CephBlockImageSnapshot struct {
	Name string `json:"name"`
}

func ListSnapshotsInRadosNamespace added in v1.14.1

func ListSnapshotsInRadosNamespace(context *clusterd.Context, clusterInfo *ClusterInfo, poolName, imageName, namespace string) ([]CephBlockImageSnapshot, error)

ListSnapshotsInRadosNamespace lists all the snapshots created for an image in a cephblockpool in a given rados namespace

type CephConfig added in v1.4.0

type CephConfig struct {
	*GlobalConfig `ini:"global,omitempty"`
}

CephConfig represents an entire Ceph config including all sections.

func CreateDefaultCephConfig added in v1.4.0

func CreateDefaultCephConfig(context *clusterd.Context, clusterInfo *ClusterInfo) (*CephConfig, error)

CreateDefaultCephConfig creates a default ceph config file.

type CephCred added in v1.4.0

type CephCred struct {
	Username string `json:"name"`
	Secret   string `json:"secret"`
}

CephCred represents the Ceph cluster username and key used by the operator. For converged clusters it will be the admin key, but external clusters will have a lower-privileged key.

type CephErasureCodeProfile

type CephErasureCodeProfile struct {
	DataChunkCount   uint   `json:"k,string"`
	CodingChunkCount uint   `json:"m,string"`
	Plugin           string `json:"plugin"`
	Technique        string `json:"technique"`
	FailureDomain    string `json:"crush-failure-domain"`
	CrushRoot        string `json:"crush-root"`
}

func GetErasureCodeProfileDetails

func GetErasureCodeProfileDetails(context *clusterd.Context, clusterInfo *ClusterInfo, name string) (CephErasureCodeProfile, error)

type CephFilesystem

type CephFilesystem struct {
	Name           string   `json:"name"`
	MetadataPool   string   `json:"metadata_pool"`
	MetadataPoolID int      `json:"metadata_pool_id"`
	DataPools      []string `json:"data_pools"`
	DataPoolIDs    []int    `json:"data_pool_ids"`
}

CephFilesystem is a representation of the json structure returned by 'ceph fs ls'

func ListFilesystems

func ListFilesystems(context *clusterd.Context, clusterInfo *ClusterInfo) ([]CephFilesystem, error)

ListFilesystems lists all filesystems provided by the Ceph cluster.

type CephFilesystemDetails

type CephFilesystemDetails struct {
	ID     int    `json:"id"`
	MDSMap MDSMap `json:"mdsmap"`
}

CephFilesystemDetails is a representation of the main json structure returned by 'ceph fs get'

type CephStatus

type CephStatus struct {
	Health        HealthStatus `json:"health"`
	FSID          string       `json:"fsid"`
	ElectionEpoch int          `json:"election_epoch"`
	Quorum        []int        `json:"quorum"`
	QuorumNames   []string     `json:"quorum_names"`
	MonMap        MonMap       `json:"monmap"`
	OsdMap        OsdMap       `json:"osdmap"`
	PgMap         PgMap        `json:"pgmap"`
	MgrMap        MgrMap       `json:"mgrmap"`
	Fsmap         Fsmap        `json:"fsmap"`
}

func Status

func Status(context *clusterd.Context, clusterInfo *ClusterInfo) (CephStatus, error)

func StatusWithUser added in v1.3.2

func StatusWithUser(context *clusterd.Context, clusterInfo *ClusterInfo) (CephStatus, error)

type CephStoragePoolDetails

type CephStoragePoolDetails struct {
	Name                   string  `json:"pool"`
	Number                 int     `json:"pool_id"`
	Size                   uint    `json:"size"`
	ErasureCodeProfile     string  `json:"erasure_code_profile"`
	CrushRoot              string  `json:"crushRoot"`
	DeviceClass            string  `json:"deviceClass"`
	CompressionMode        string  `json:"compression_mode"`
	TargetSizeRatio        float64 `json:"target_size_ratio,omitempty"`
	RequireSafeReplicaSize bool    `json:"requireSafeReplicaSize,omitempty"`
	CrushRule              string  `json:"crush_rule"`
}

func GetPoolDetails

func GetPoolDetails(context *clusterd.Context, clusterInfo *ClusterInfo, name string) (CephStoragePoolDetails, error)

GetPoolDetails gets all the details of a given pool

func ParsePoolDetails added in v1.7.3

func ParsePoolDetails(in []byte) (CephStoragePoolDetails, error)

type CephStoragePoolStats

type CephStoragePoolStats struct {
	Pools []struct {
		Name  string `json:"name"`
		ID    int    `json:"id"`
		Stats struct {
			BytesUsed    float64 `json:"bytes_used"`
			RawBytesUsed float64 `json:"raw_bytes_used"`
			MaxAvail     float64 `json:"max_avail"`
			Objects      float64 `json:"objects"`
			DirtyObjects float64 `json:"dirty"`
			ReadIO       float64 `json:"rd"`
			ReadBytes    float64 `json:"rd_bytes"`
			WriteIO      float64 `json:"wr"`
			WriteBytes   float64 `json:"wr_bytes"`
		} `json:"stats"`
	} `json:"pools"`
}

func GetPoolStats

func GetPoolStats(context *clusterd.Context, clusterInfo *ClusterInfo) (*CephStoragePoolStats, error)

type CephStoragePoolSummary

type CephStoragePoolSummary struct {
	Name   string `json:"poolname"`
	Number int    `json:"poolnum"`
}

func ListPoolSummaries

func ListPoolSummaries(context *clusterd.Context, clusterInfo *ClusterInfo) ([]CephStoragePoolSummary, error)

type CephToolCommand added in v1.1.0

type CephToolCommand struct {
	JsonOutput bool

	RemoteExecution bool
	// contains filtered or unexported fields
}

func NewCephCommand added in v1.1.0

func NewCephCommand(context *clusterd.Context, clusterInfo *ClusterInfo, args []string) *CephToolCommand

func NewGaneshaRadosGraceCommand added in v1.10.3

func NewGaneshaRadosGraceCommand(context *clusterd.Context, clusterInfo *ClusterInfo, args []string) *CephToolCommand

func NewRBDCommand added in v1.1.0

func NewRBDCommand(context *clusterd.Context, clusterInfo *ClusterInfo, args []string) *CephToolCommand

func NewRadosCommand added in v1.10.2

func NewRadosCommand(context *clusterd.Context, clusterInfo *ClusterInfo, args []string) *CephToolCommand

func (*CephToolCommand) Run added in v1.1.0

func (c *CephToolCommand) Run() ([]byte, error)

func (*CephToolCommand) RunWithTimeout added in v1.1.0

func (c *CephToolCommand) RunWithTimeout(timeout time.Duration) ([]byte, error)

type CheckMessage

type CheckMessage struct {
	Severity string  `json:"severity"`
	Summary  Summary `json:"summary"`
}

type ClusterInfo added in v1.4.0

type ClusterInfo struct {
	FSID          string
	MonitorSecret string
	CephCred      CephCred
	Monitors      map[string]*MonInfo
	CephVersion   cephver.CephVersion
	Namespace     string
	OwnerInfo     *k8sutil.OwnerInfo

	OsdUpgradeTimeout time.Duration
	NetworkSpec       cephv1.NetworkSpec
	CSIDriverSpec     cephv1.CSIDriverSpec
	// A context to cancel the context it is used to determine whether the reconcile loop should
	// exist (if the context has been cancelled). This cannot be in main clusterd context since this
	// is a pointer passed through the entire life cycle or the operator. If the context is
	// cancelled it will immediately be re-created, thus existing reconciles loops will not be
	// cancelled.
	// Whereas if passed through clusterInfo, we don't have that problem since clusterInfo is
	// re-hydrated when a context is cancelled.
	Context context.Context
	// contains filtered or unexported fields
}

ClusterInfo is a collection of information about a particular Ceph cluster. Rook uses information about the cluster to configure daemons to connect to the desired cluster.

func AdminClusterInfo added in v1.4.0

func AdminClusterInfo(ctx context.Context, namespace, name string) *ClusterInfo

AdminClusterInfo() creates a ClusterInfo with the basic info to access the cluster as an admin.

func AdminTestClusterInfo added in v1.8.0

func AdminTestClusterInfo(namespace string) *ClusterInfo

AdminTestClusterInfo() creates a ClusterInfo with the basic info to access the cluster as an admin. This cluster info should only be used by unit or integration tests.

func NewClusterInfo added in v1.4.0

func NewClusterInfo(namespace, name string) *ClusterInfo

func (*ClusterInfo) IsInitialized added in v1.4.0

func (c *ClusterInfo) IsInitialized() error

IsInitialized returns true if the critical information in the ClusterInfo struct has been filled in. This method exists less out of necessity than the desire to be explicit about the lifecycle of the ClusterInfo struct during startup, specifically that it is expected to exist after the Rook operator has started up or connected to the first components of the Ceph cluster.

func (*ClusterInfo) NamespacedName added in v1.4.0

func (c *ClusterInfo) NamespacedName() types.NamespacedName

func (*ClusterInfo) SetName added in v1.4.0

func (c *ClusterInfo) SetName(name string)

type CrashList added in v1.5.8

type CrashList struct {
	ID               string   `json:"crash_id"`
	Entity           string   `json:"entity_name"`
	Timestamp        string   `json:"timestamp"`
	ProcessName      string   `json:"process_name,omitempty"`
	CephVersion      string   `json:"ceph_version,omitempty"`
	UtsnameHostname  string   `json:"utsname_hostname,omitempty"`
	UtsnameSysname   string   `json:"utsname_sysname,omitempty"`
	UtsnameRelease   string   `json:"utsname_release,omitempty"`
	UtsnameVersion   string   `json:"utsname_version,omitempty"`
	UtsnameMachine   string   `json:"utsname_machine,omitempty"`
	OsName           string   `json:"os_name,omitempty"`
	OsID             string   `json:"os_id,omitempty"`
	OsVersionID      string   `json:"os_version_id,omitempty"`
	OsVersion        string   `json:"os_version,omitempty"`
	AssertCondition  string   `json:"assert_condition,omitempty"`
	AssertFunc       string   `json:"assert_func,omitempty"`
	AssertLine       int      `json:"assert_line,omitempty"`
	AssertFile       string   `json:"assert_file,omitempty"`
	AssertThreadName string   `json:"assert_thread_name,omitempty"`
	AssertMsg        string   `json:"assert_msg,omitempty"`
	IoError          bool     `json:"io_error,omitempty"`
	IoErrorDevname   string   `json:"io_error_devname,omitempty"`
	IoErrorPath      string   `json:"io_error_path,omitempty"`
	IoErrorCode      int      `json:"io_error_code,omitempty"`
	IoErrorOptype    int      `json:"io_error_optype,omitempty"`
	IoErrorOffset    int      `json:"io_error_offset,omitempty"`
	IoErrorLength    int      `json:"iio_error_length,omitempty"`
	Backtrace        []string `json:"backtrace,omitempty"`
}

CrashList is go representation of the "ceph crash ls" command output

func GetCrash added in v1.5.8

func GetCrash(context *clusterd.Context, clusterInfo *ClusterInfo) ([]CrashList, error)

GetCrash gets the crash list

func GetCrashList added in v1.5.8

func GetCrashList(context *clusterd.Context, clusterInfo *ClusterInfo) ([]CrashList, error)

GetCrashList gets the list of Crashes.

type CrushFindResult

type CrushFindResult struct {
	ID       int               `json:"osd"`
	IP       string            `json:"ip"`
	Host     string            `json:"host,omitempty"`
	Location map[string]string `json:"crush_location"`
}

CrushFindResult is go representation of the Ceph osd find command output

func FindOSDInCrushMap

func FindOSDInCrushMap(context *clusterd.Context, clusterInfo *ClusterInfo, osdID int) (*CrushFindResult, error)

FindOSDInCrushMap finds an OSD in the CRUSH map

type CrushMap

type CrushMap struct {
	Devices []struct {
		ID    int    `json:"id"`
		Name  string `json:"name"`
		Class string `json:"class"`
	} `json:"devices"`
	Types []struct {
		ID   int    `json:"type_id"`
		Name string `json:"name"`
	} `json:"types"`
	Buckets []struct {
		ID       int    `json:"id"`
		Name     string `json:"name"`
		TypeID   int    `json:"type_id"`
		TypeName string `json:"type_name"`
		Weight   int    `json:"weight"`
		Alg      string `json:"alg"`
		Hash     string `json:"hash"`
		Items    []struct {
			ID     int `json:"id"`
			Weight int `json:"weight"`
			Pos    int `json:"pos"`
		} `json:"items"`
	} `json:"buckets"`
	Rules    []ruleSpec `json:"rules"`
	Tunables struct {
	} `json:"tunables"`
}

CrushMap is the go representation of a CRUSH map

func GetCrushMap

func GetCrushMap(context *clusterd.Context, clusterInfo *ClusterInfo) (CrushMap, error)

GetCrushMap fetches the Ceph CRUSH map

type Fsmap added in v1.1.0

type Fsmap struct {
	Epoch  int `json:"epoch"`
	ID     int `json:"id"`
	Up     int `json:"up"`
	In     int `json:"in"`
	Max    int `json:"max"`
	ByRank []struct {
		FilesystemID int    `json:"filesystem_id"`
		Rank         int    `json:"rank"`
		Name         string `json:"name"`
		Status       string `json:"status"`
		Gid          int    `json:"gid"`
	} `json:"by_rank"`
	UpStandby int `json:"up:standby"`
}

Fsmap is a struct representing the filesystem map

type GlobalConfig added in v1.4.0

type GlobalConfig struct {
	FSID       string `ini:"fsid,omitempty"`
	MonMembers string `ini:"mon initial members,omitempty"`
	MonHost    string `ini:"mon host"`
}

GlobalConfig represents the [global] sections of Ceph's config file.

type HealthStatus

type HealthStatus struct {
	Status string                  `json:"status"`
	Checks map[string]CheckMessage `json:"checks"`
}

type Images added in v1.14.0

type Images struct {
	// Name of the pool image
	Name string
}

type MDSDump added in v1.6.2

type MDSDump struct {
	Standbys    []MDSStandBy `json:"standbys"`
	FileSystems []MDSMap     `json:"filesystems"`
}

func GetMDSDump added in v1.6.2

func GetMDSDump(context *clusterd.Context, clusterInfo *ClusterInfo) (*MDSDump, error)

type MDSInfo

type MDSInfo struct {
	GID     int    `json:"gid"`
	Name    string `json:"name"`
	Rank    int    `json:"rank"`
	State   string `json:"state"`
	Address string `json:"addr"`
}

MDSInfo is a representation of the individual mds daemon sub-sub-structure returned by 'ceph fs get'

type MDSMap

type MDSMap struct {
	FilesystemName string             `json:"fs_name"`
	Enabled        bool               `json:"enabled"`
	Root           int                `json:"root"`
	TableServer    int                `json:"tableserver"`
	MaxMDS         int                `json:"max_mds"`
	In             []int              `json:"in"`
	Up             map[string]int     `json:"up"`
	MetadataPool   int                `json:"metadata_pool"`
	DataPools      []int              `json:"data_pools"`
	Failed         []int              `json:"failed"`
	Damaged        []int              `json:"damaged"`
	Stopped        []int              `json:"stopped"`
	Info           map[string]MDSInfo `json:"info"`
}

MDSMap is a representation of the mds map sub-structure returned by 'ceph fs get'

type MDSStandBy added in v1.6.2

type MDSStandBy struct {
	Name string `json:"name"`
	Rank int    `json:"rank"`
}

type MgrMap

type MgrMap struct {
	Epoch      int          `json:"epoch"`
	ActiveGID  int          `json:"active_gid"`
	ActiveName string       `json:"active_name"`
	ActiveAddr string       `json:"active_addr"`
	Available  bool         `json:"available"`
	Standbys   []MgrStandby `json:"standbys"`
}

func CephMgrMap added in v1.6.0

func CephMgrMap(context *clusterd.Context, clusterInfo *ClusterInfo) (*MgrMap, error)

type MgrStandby

type MgrStandby struct {
	GID  int    `json:"gid"`
	Name string `json:"name"`
}

type MgrStat added in v1.6.0

type MgrStat struct {
	Epoch      int    `json:"epoch"`
	Available  bool   `json:"available"`
	ActiveName string `json:"active_name"`
	NumStandby int    `json:"num_standby"`
}

func CephMgrStat added in v1.6.0

func CephMgrStat(context *clusterd.Context, clusterInfo *ClusterInfo) (*MgrStat, error)

type MirroredImages added in v1.14.0

type MirroredImages struct {
	// Images is the list of mirrored images on a pool
	Images *[]Images
}

func GetMirroredPoolImages added in v1.14.0

func GetMirroredPoolImages(context *clusterd.Context, clusterInfo *ClusterInfo, poolName string) (*MirroredImages, error)

GetMirroredPoolImages returns a list of mirrored images for a given pool

type MonDump added in v1.5.4

type MonDump struct {
	StretchMode      bool           `json:"stretch_mode"`
	ElectionStrategy int            `json:"election_strategy"`
	FSID             string         `json:"fsid"`
	Mons             []MonDumpEntry `json:"mons"`
	Quorum           []int          `json:"quorum"`
	TiebreakerMon    string         `json:"tiebreaker_mon"`
}

MonDump represents the response from a mon dump

func GetMonDump added in v1.5.4

func GetMonDump(context *clusterd.Context, clusterInfo *ClusterInfo) (MonDump, error)

GetMonDump calls mon dump command

type MonDumpEntry added in v1.5.4

type MonDumpEntry struct {
	Name          string `json:"name"`
	Rank          int    `json:"rank"`
	CrushLocation string `json:"crush_location"`
}

type MonInfo added in v1.4.0

type MonInfo struct {
	Name     string `json:"name"`
	Endpoint string `json:"endpoint"`
	// Whether detected out of quorum by rook. May be different from actual ceph quorum.
	OutOfQuorum bool `json:"outOfQuorum"`
}

MonInfo is a collection of information about a Ceph mon.

func NewMonInfo added in v1.4.0

func NewMonInfo(name, ip string, port int32) *MonInfo

NewMonInfo returns a new Ceph mon info struct from the given inputs.

type MonMap

type MonMap struct {
	Epoch        int           `json:"epoch"`
	NumMons      int           `json:"num_mons"`
	FSID         string        `json:"fsid"`
	CreatedTime  string        `json:"created"`
	ModifiedTime string        `json:"modified"`
	Mons         []MonMapEntry `json:"mons"`
}

type MonMapEntry

type MonMapEntry struct {
	Name        string `json:"name"`
	Rank        int    `json:"rank"`
	Address     string `json:"addr"`
	PublicAddr  string `json:"public_addr"`
	PublicAddrs struct {
		Addrvec []AddrvecEntry `json:"addrvec"`
	} `json:"public_addrs"`
}

MonMapEntry represents an entry in the monitor map

type MonStatusResponse

type MonStatusResponse struct {
	Quorum []int `json:"quorum"`
	MonMap struct {
		Mons []MonMapEntry `json:"mons"`
	} `json:"monmap"`
}

MonStatusResponse represents the response from a quorum_status mon_command (subset of all available fields, only marshal ones we care about)

func GetMonQuorumStatus added in v1.2.0

func GetMonQuorumStatus(context *clusterd.Context, clusterInfo *ClusterInfo) (MonStatusResponse, error)

GetMonQuorumStatus calls quorum_status mon_command

type OSDDeviceClass added in v1.6.6

type OSDDeviceClass struct {
	ID          int    `json:"osd"`
	DeviceClass string `json:"device_class"`
}

OSDDeviceClass report device class for osd

func OSDDeviceClasses added in v1.6.6

func OSDDeviceClasses(context *clusterd.Context, clusterInfo *ClusterInfo, osdIds []string) ([]OSDDeviceClass, error)

OSDDeviceClasses returns the device classes for particular OsdIDs

type OSDDump

type OSDDump struct {
	OSDs []struct {
		OSD json.Number `json:"osd"`
		Up  json.Number `json:"up"`
		In  json.Number `json:"in"`
	} `json:"osds"`
	Flags             string              `json:"flags"`
	CrushNodeFlags    map[string][]string `json:"crush_node_flags"`
	FullRatio         float64             `json:"full_ratio"`
	BackfillFullRatio float64             `json:"backfillfull_ratio"`
	NearFullRatio     float64             `json:"nearfull_ratio"`
}

func GetOSDDump

func GetOSDDump(context *clusterd.Context, clusterInfo *ClusterInfo) (*OSDDump, error)

func (*OSDDump) IsFlagSet added in v1.1.0

func (dump *OSDDump) IsFlagSet(checkFlag string) bool

IsFlagSet checks if an OSD flag is set

func (*OSDDump) IsFlagSetOnCrushUnit added in v1.1.0

func (dump *OSDDump) IsFlagSetOnCrushUnit(checkFlag, crushUnit string) bool

IsFlagSetOnCrushUnit checks if an OSD flag is set on specified Crush unit

func (*OSDDump) StatusByID

func (dump *OSDDump) StatusByID(id int64) (int64, int64, error)

StatusByID returns status and inCluster states for given OSD id

func (*OSDDump) UpdateFlagOnCrushUnit added in v1.1.0

func (dump *OSDDump) UpdateFlagOnCrushUnit(context *clusterd.Context, clusterInfo *ClusterInfo, set bool, crushUnit, flag string) (bool, error)

UpdateFlagOnCrushUnit checks if the flag is in the desired state and sets/unsets if it isn't. Mitigates redundant calls it returns true if the value was changed

type OSDNodeUsage

type OSDNodeUsage struct {
	ID          int         `json:"id"`
	Name        string      `json:"name"`
	DeviceClass string      `json:"device_class"`
	CrushWeight json.Number `json:"crush_weight"`
	Depth       json.Number `json:"depth"`
	Reweight    json.Number `json:"reweight"`
	KB          json.Number `json:"kb"` // KB is in KiB units
	UsedKB      json.Number `json:"kb_used"`
	AvailKB     json.Number `json:"kb_avail"`
	Utilization json.Number `json:"utilization"`
	Variance    json.Number `json:"var"`
	Pgs         json.Number `json:"pgs"`
}

type OSDOkToStopStats added in v1.6.0

type OSDOkToStopStats struct {
	OkToStop          bool     `json:"ok_to_stop"`
	OSDs              []int    `json:"osds"`
	NumOkPGs          int      `json:"num_ok_pgs"`
	NumNotOkPGs       int      `json:"num_not_ok_pgs"`
	BadBecomeInactive []string `json:"bad_become_inactive"`
	OkBecomeDegraded  []string `json:"ok_become_degraded"`
}

OSDOkToStopStats report detailed information about which OSDs are okay to stop

type OSDPerfStats

type OSDPerfStats struct {
	PerfInfo []struct {
		ID    json.Number `json:"id"`
		Stats struct {
			CommitLatency json.Number `json:"commit_latency_ms"`
			ApplyLatency  json.Number `json:"apply_latency_ms"`
		} `json:"perf_stats"`
	} `json:"osd_perf_infos"`
}

func GetOSDPerfStats

func GetOSDPerfStats(context *clusterd.Context, clusterInfo *ClusterInfo) (*OSDPerfStats, error)

type OSDUsage

type OSDUsage struct {
	OSDNodes []OSDNodeUsage `json:"nodes"`
	Summary  struct {
		TotalKB      json.Number `json:"total_kb"`
		TotalUsedKB  json.Number `json:"total_kb_used"`
		TotalAvailKB json.Number `json:"total_kb_avail"`
		AverageUtil  json.Number `json:"average_utilization"`
	} `json:"summary"`
}

func GetOSDUsage

func GetOSDUsage(context *clusterd.Context, clusterInfo *ClusterInfo) (*OSDUsage, error)

type OsdList added in v1.1.0

type OsdList []int

OsdList returns the list of OSD by their IDs

func OsdListNum added in v1.1.0

func OsdListNum(context *clusterd.Context, clusterInfo *ClusterInfo) (OsdList, error)

OsdListNum returns the list of OSDs

type OsdMap

type OsdMap struct {
	Epoch          int  `json:"epoch"`
	NumOsd         int  `json:"num_osds"`
	NumUpOsd       int  `json:"num_up_osds"`
	NumInOsd       int  `json:"num_in_osds"`
	Full           bool `json:"full"`
	NearFull       bool `json:"nearfull"`
	NumRemappedPgs int  `json:"num_remapped_pgs"`
}

type OsdTree added in v1.1.0

type OsdTree struct {
	Nodes []struct {
		ID          int    `json:"id"`
		Name        string `json:"name"`
		Type        string `json:"type"`
		TypeID      int    `json:"type_id"`
		Children    []int  `json:"children,omitempty"`
		PoolWeights struct {
		} `json:"pool_weights,omitempty"`
		CrushWeight     float64 `json:"crush_weight,omitempty"`
		Depth           int     `json:"depth,omitempty"`
		Exists          int     `json:"exists,omitempty"`
		Status          string  `json:"status,omitempty"`
		Reweight        float64 `json:"reweight,omitempty"`
		PrimaryAffinity float64 `json:"primary_affinity,omitempty"`
	} `json:"nodes"`
	Stray []struct {
		ID              int     `json:"id"`
		Name            string  `json:"name"`
		Type            string  `json:"type"`
		TypeID          int     `json:"type_id"`
		CrushWeight     float64 `json:"crush_weight"`
		Depth           int     `json:"depth"`
		Exists          int     `json:"exists"`
		Status          string  `json:"status"`
		Reweight        float64 `json:"reweight"`
		PrimaryAffinity float64 `json:"primary_affinity"`
	} `json:"stray"`
}

OsdTree represents the CRUSH hierarchy

func HostTree added in v1.1.0

func HostTree(context *clusterd.Context, clusterInfo *ClusterInfo) (OsdTree, error)

HostTree returns the osd tree

type PeerToken added in v1.7.1

type PeerToken struct {
	ClusterFSID string `json:"fsid"`
	ClientID    string `json:"client_id"`
	Key         string `json:"key"`
	MonHost     string `json:"mon_host"`
	// These fields are added by Rook and NOT part of the output of client.CreateRBDMirrorBootstrapPeer()
	Namespace string `json:"namespace"`
}

PeerToken is the content of the peer token

type PgMap

type PgMap struct {
	PgsByState            []PgStateEntry `json:"pgs_by_state"`
	Version               int            `json:"version"`
	NumPgs                int            `json:"num_pgs"`
	DataBytes             uint64         `json:"data_bytes"`
	UsedBytes             uint64         `json:"bytes_used"`
	AvailableBytes        uint64         `json:"bytes_avail"`
	TotalBytes            uint64         `json:"bytes_total"`
	ReadBps               uint64         `json:"read_bytes_sec"`
	WriteBps              uint64         `json:"write_bytes_sec"`
	ReadOps               uint64         `json:"read_op_per_sec"`
	WriteOps              uint64         `json:"write_op_per_sec"`
	RecoveryBps           uint64         `json:"recovering_bytes_per_sec"`
	RecoveryObjectsPerSec uint64         `json:"recovering_objects_per_sec"`
	RecoveryKeysPerSec    uint64         `json:"recovering_keys_per_sec"`
	CacheFlushBps         uint64         `json:"flush_bytes_sec"`
	CacheEvictBps         uint64         `json:"evict_bytes_sec"`
	CachePromoteBps       uint64         `json:"promote_op_per_sec"`
}

type PgStateEntry

type PgStateEntry struct {
	StateName string `json:"state_name"`
	Count     int    `json:"count"`
}

type PoolStatistics added in v1.2.0

type PoolStatistics struct {
	Images struct {
		Count            int `json:"count"`
		ProvisionedBytes int `json:"provisioned_bytes"`
		SnapCount        int `json:"snap_count"`
	} `json:"images"`
	Trash struct {
		Count            int `json:"count"`
		ProvisionedBytes int `json:"provisioned_bytes"`
		SnapCount        int `json:"snap_count"`
	} `json:"trash"`
}

func GetPoolStatistics added in v1.2.0

func GetPoolStatistics(context *clusterd.Context, clusterInfo *ClusterInfo, name string) (*PoolStatistics, error)

type SafeToDestroyStatus added in v1.1.0

type SafeToDestroyStatus struct {
	SafeToDestroy []int `json:"safe_to_destroy"`
}

type SubVolumeSnapshot added in v1.14.1

type SubVolumeSnapshot struct {
	Name string `json:"name"`
}

SubVolumeSnapshot represents snapshot of a cephFS subvolume

type SubVolumeSnapshotPendingClones added in v1.14.1

type SubVolumeSnapshotPendingClones struct {
	Clones []struct {
		Name string `json:"name"`
	} `json:"pending_clones"`
}

SubVolumeSnapshotPendingClones refers to all the pending clones available in a cephFS subvolume snapshot

type SubVolumeSnapshots added in v1.14.1

type SubVolumeSnapshots []SubVolumeSnapshot

SubVolumeSnapshots is the list of snapshots in a CephFS subvolume

type Subvolume added in v1.9.6

type Subvolume struct {
	Name string `json:"name"`
}

Subvolume is a representation of a Ceph filesystem subvolume.

type SubvolumeGroup added in v1.9.6

type SubvolumeGroup struct {
	Name string `json:"name"`
}

SubvolumeGroup is a representation of a Ceph filesystem subvolume group.

type SubvolumeGroupList added in v1.9.6

type SubvolumeGroupList []SubvolumeGroup

SubvolumeGroupList is the representation Ceph returns when listing Ceph filesystem subvolume groups.

type SubvolumeList added in v1.9.6

type SubvolumeList []Subvolume

SubvolumeList is the representation Ceph returns when listing Ceph filesystem subvolumes.

type Summary added in v1.3.9

type Summary struct {
	Message string `json:"message"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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