client

package
v1.3.9 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

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.

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 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"
	// Kubectl is the name of the CLI tool for 'kubectl'
	Kubectl = "kubectl"
	// CrushTool is the name of the CLI tool for 'crushtool'
	CrushTool         = "crushtool"
	CmdExecuteTimeout = 1 * time.Minute

	// DefaultPGCount will cause Ceph to use the internal default PG count
	DefaultPGCount = "0"
)
View Source
const (
	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 (
	ImageMinSize = uint64(1048576) // 1 MB
)
View Source
const (
	// MultiFsEnv defines the name of the Rook environment variable which controls if Rook is
	// allowed to create multiple Ceph filesystems.
	MultiFsEnv = "ROOK_ALLOW_MULTIPLE_FILESYSTEMS"
)

Variables

View Source
var RunAllCephCommandsInToolbox = false

RunAllCephCommandsInToolbox - 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.

Functions

func AllowStandbyReplay added in v1.3.9

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

AllowStandbyReplay gets detailed status information about a Ceph filesystem.

func AuthDelete

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

AuthDelete will delete the given user.

func AuthGetCaps added in v1.3.9

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

AuthGetCaps gets the capabilities for the given user.

func AuthGetKey

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

AuthGetKey gets the key for the given user.

func AuthGetOrCreate

func AuthGetOrCreate(context *clusterd.Context, clusterName, 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, clusterName, name string, caps []string) (string, error)

AuthGetOrCreateKey gets or creates the key for the given user.

func AuthUpdateCaps added in v1.3.9

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

AuthUpdateCaps updates the capabilities for the given user.

func CephConfFilePath added in v1.3.9

func CephConfFilePath(configDir, clusterName string) string

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

func ConfigureBalancerModule added in v1.3.9

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

ConfigureBalancerModule configures the balancer module

func CreateECPoolForApp added in v0.8.0

func CreateECPoolForApp(context *clusterd.Context, namespace, poolName, ecProfileName string, pool cephv1.PoolSpec, pgCount, appName string, enableECOverwrite bool) error

func CreateErasureCodeProfile

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

func CreateFilesystem

func CreateFilesystem(context *clusterd.Context, clusterName, name, metadataPool string, dataPools []string, force bool) error

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

func CreatePoolWithProfile

func CreatePoolWithProfile(context *clusterd.Context, namespace, poolName string, pool cephv1.PoolSpec, appName string) error

func CreateReplicatedPoolForApp added in v0.8.0

func CreateReplicatedPoolForApp(context *clusterd.Context, namespace, poolName string, pool cephv1.PoolSpec, pgCount, appName string) error

func DeleteErasureCodeProfile

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

func DeleteImage

func DeleteImage(context *clusterd.Context, clusterName, name, poolName string) error

func DeletePool

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

DeletePool purges a pool from Ceph

func EnableMessenger2 added in v1.3.9

func EnableMessenger2(context *clusterd.Context, clusterName string) error

EnableMessenger2 enable the messenger 2 protocol on Nautilus clusters

func EnableReleaseOSDFunctionality added in v1.3.9

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

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

func ExecuteCephCommandWithRetry added in v1.3.9

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

func ExecuteRBDCommandWithTimeout

func ExecuteRBDCommandWithTimeout(context *clusterd.Context, clusterName string, 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.3.9

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

func FailFilesystem added in v1.3.9

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

FailFilesystem efficiently brings down the filesystem by marking the filesystem as down and failing the MDSes using a single Ceph command. This works only from nautilus version of Ceph onwards.

func FailMDS

func FailMDS(context *clusterd.Context, clusterName string, gid int) error

FailMDS instructs Ceph to fail an mds daemon.

func FinalizeCephCommandArgs added in v0.8.0

func FinalizeCephCommandArgs(command string, args []string, configDir, clusterName, username string) (string, []string)

FinalizeCephCommandArgs builds the command line to be called

func GetCephMonVersion added in v1.3.9

func GetCephMonVersion(context *clusterd.Context, clusterName string) (*cephver.CephVersion, error)

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

func GetCrushHostName

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

GetCrushHostName gets the hostname where an OSD is running on

func GetErasureCodeProfileForPool

func GetErasureCodeProfileForPool(baseName string) string

func GetOSDOnHost added in v1.3.9

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

GetOSDOnHost returns the list of osds running on a given host

func GetPoolNamesByID

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

func IsCephHealthy added in v1.3.9

func IsCephHealthy(context *clusterd.Context, clusterName string) 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, clusterName 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.3.9

func IsClusterCleanError(context *clusterd.Context, clusterName 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 IsMultiFSEnabled added in v0.8.0

func IsMultiFSEnabled() bool

IsMultiFSEnabled returns true if ROOK_ALLOW_MULTIPLE_FILESYSTEMS is set to "true", allowing Rook to create multiple Ceph filesystems. False if Rook is not allowed to do so.

func IsNormalizedCrushNameEqual added in v1.3.9

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.3.9

func LeastUptodateDaemonVersion(context *clusterd.Context, clusterName, 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 13.2.5 (cbff874f9007f1869bfd3821b7e33b2a6ffd4988) mimic (stable)": 1,
    "ceph version 14.2.0 (3a54b2b6d167d4a2a19e003a705696d4fe619afc) nautilus (stable)": 2
}

In the case we will pick: "ceph version 13.2.5 (cbff874f9007f1869bfd3821b7e33b2a6ffd4988) mimic (stable)": 1, And eventually return 13.2.5

func ListErasureCodeProfiles

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

func MapImage

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

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

func MarkFilesystemAsDown

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

MarkFilesystemAsDown marks a Ceph filesystem as down.

func MdsActiveOrStandbyReplay added in v1.3.9

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

MdsActiveOrStandbyReplay returns wether a given MDS is active or in standby

func MgrDisableModule added in v0.8.0

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

MgrDisableModule disables a mgr module

func MgrEnableModule

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

MgrEnableModule enables a mgr module

func MgrSetConfig added in v0.9.0

func MgrSetConfig(context *clusterd.Context, clusterName, mgrName string, key, val string, force bool) (bool, error)

MgrSetConfig applies a setting for a single mgr daemon

func NormalizeCrushName added in v1.3.9

func NormalizeCrushName(name string) string

NormalizeCrushName replaces . with -

func OSDOut

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

func OkToContinue added in v1.3.9

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

OkToContinue determines if it's ok to continue an upgrade

func OkToStop added in v1.3.9

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

OkToStop determines if it's ok to stop an upgrade

func OsdSafeToDestroy added in v1.3.9

func OsdSafeToDestroy(context *clusterd.Context, clusterName string, osdID int) (bool, error)

func RemoveFilesystem

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

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

func SetFlagOnCrushUnit added in v1.3.9

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

SetFlagOnCrushUnit sets the specified flag on the crush unit

func SetNumMDSRanks added in v0.9.0

func SetNumMDSRanks(context *clusterd.Context, clusterName, 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, namespace, name, propName, propVal string) error

SetPoolProperty sets a property to a given pool

func SetPoolReplicatedSizeProperty added in v1.3.9

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

SetPoolReplicatedSizeProperty sets the replica size of a pool

func UnMapImage

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

UnMapImage unmap an RBD image from the node

func UnsetFlagOnCrushUnit added in v1.3.9

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

UnsetFlagOnCrushUnit unsets the specified flag on the crush unit

func UpdateCrushMapValue added in v1.3.9

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,
	clusterName, 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.

Types

type AddrvecEntry added in v1.3.9

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 CephBlockImage

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

func CreateImage

func CreateImage(context *clusterd.Context, clusterName, 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 ListImages

func ListImages(context *clusterd.Context, clusterName, poolName string) ([]CephBlockImage, error)

type CephDaemonsVersions added in v1.3.9

type CephDaemonsVersions struct {
	Mon       map[string]int `json:"mon,omitempty"`
	Mgr       map[string]int `json:"mgr,omitempty"`
	Osd       map[string]int `json:"osd,omitempty"`
	Rgw       map[string]int `json:"rgw,omitempty"`
	Mds       map[string]int `json:"mds,omitempty"`
	RbdMirror map[string]int `json:"rbd-mirror,omitempty"`
	Overall   map[string]int `json:"overall,omitempty"`
}

CephDaemonsVersions is a structure that can be used to parsed the output of the 'ceph versions' command

func GetAllCephDaemonVersions added in v1.3.9

func GetAllCephDaemonVersions(context *clusterd.Context, clusterName string) (*CephDaemonsVersions, error)

GetAllCephDaemonVersions reports the Ceph version of each daemon in the cluster

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, namespace, 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, clusterName string) ([]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'

func GetFilesystem

func GetFilesystem(context *clusterd.Context, clusterName string, fsName string) (*CephFilesystemDetails, error)

GetFilesystem gets detailed status information about a Ceph filesystem.

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        struct {
		OsdMap OsdMap `json:"osdmap"`
	} `json:"osdmap"`
	PgMap  PgMap  `json:"pgmap"`
	MgrMap MgrMap `json:"mgrmap"`
	Fsmap  Fsmap  `json:"fsmap"`
}

func Status

func Status(context *clusterd.Context, clusterName string) (CephStatus, error)

func StatusWithUser added in v1.3.9

func StatusWithUser(context *clusterd.Context, clusterName, userName string) (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"`
	FailureDomain          string  `json:"failureDomain"`
	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"`
}

func GetPoolDetails

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

GetPoolDetails gets all the details of a given pool

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, namespace string) (*CephStoragePoolStats, error)

type CephStoragePoolSummary

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

func ListPoolSummaries

func ListPoolSummaries(context *clusterd.Context, namespace string) ([]CephStoragePoolSummary, error)

type CephToolCommand added in v1.3.9

type CephToolCommand struct {
	JsonOutput bool
	OutputFile bool
	// contains filtered or unexported fields
}

func NewCephCommand added in v1.3.9

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

func NewRBDCommand added in v1.3.9

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

func (*CephToolCommand) Run added in v1.3.9

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

func (*CephToolCommand) RunWithTimeout added in v1.3.9

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

type CheckMessage

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

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, clusterName string, 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 []struct {
		ID      int    `json:"rule_id"`
		Name    string `json:"rule_name"`
		Ruleset int    `json:"ruleset"`
		Type    int    `json:"type"`
		MinSize int    `json:"min_size"`
		MaxSize int    `json:"max_size"`
		Steps   []struct {
			Operation string `json:"op"`
			Number    int    `json:"num"`
			Item      int    `json:"item"`
			ItemName  string `json:"item_name"`
			Type      string `json:"type"`
		} `json:"steps"`
	} `json:"rules"`
	Tunables struct {
	} `json:"tunables"`
}

CrushMap is the go representation of a CRUSH map

func GetCrushMap

func GetCrushMap(context *clusterd.Context, clusterName string) (CrushMap, error)

GetCrushMap fetches the Ceph CRUSH map

type Fsmap added in v1.3.9

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 HealthStatus

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

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 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"`
}

type MgrStandby

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

type MonMap

type MonMap struct {
	Epoch        int           `json:"epoch"`
	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.3.9

func GetMonQuorumStatus(context *clusterd.Context, clusterName string) (MonStatusResponse, error)

GetMonQuorumStatus calls quorum_status mon_command

func GetMonQuorumStatusHealth added in v1.3.9

func GetMonQuorumStatusHealth(context *clusterd.Context, clusterName, userName string) (MonStatusResponse, error)

GetMonQuorumStatusHealth calls quorum_status mon_command with a special client key

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"`
}

func GetOSDDump

func GetOSDDump(context *clusterd.Context, clusterName string) (*OSDDump, error)

func (*OSDDump) IsFlagSet added in v1.3.9

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

IsFlagSet checks if an OSD flag is set

func (*OSDDump) IsFlagSetOnCrushUnit added in v1.3.9

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.3.9

func (dump *OSDDump) UpdateFlagOnCrushUnit(context *clusterd.Context, set bool, clusterName, 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"`
	CrushWeight json.Number `json:"crush_weight"`
	Depth       json.Number `json:"depth"`
	Reweight    json.Number `json:"reweight"`
	KB          json.Number `json:"kb"`
	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 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, clusterName string) (*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, clusterName string) (*OSDUsage, error)

type OsdList added in v1.3.9

type OsdList []int

OsdList returns the list of OSD by their IDs

func OsdListNum added in v1.3.9

func OsdListNum(context *clusterd.Context, clusterName string) (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.3.9

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.3.9

func HostTree(context *clusterd.Context, clusterName string) (OsdTree, error)

HostTree returns the osd tree

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.3.9

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.3.9

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

type SafeToDestroyStatus added in v1.3.9

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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