rally

package
v0.0.11 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// CephFSType is the ceph fs type of storage
	CephFSType = "cephfs"
	// CephBlockType is the ceph rbd type of storage
	CephBlockType = "block"

	// Monitor is a ceph monitor, does everything
	Monitor = "mon"
	// Manager is a ceph manager
	Manager = "mdr"
	// Metadata is a ceph metadata service, handles cephfs/objects
	Metadata = "mds"
	// Devices are the ceph object store devices, handles all ceph storage
	Devices = "ods"
	// Gateway is a ceph gateway for rados, S3/Swift- not used
	Gateway = "rgw"
)
View Source
const (
	// ErrNoName cannot find name for associated storage.
	ErrNoName = "name not specified"

	// ErrNoType cannot find type for associated storage
	ErrNoType = "storage type not specified"

	// ErrNoQuota cannot find quota for associated storage
	ErrNoQuota = "quota not specified"

	// ErrNoLifetime cannot find longevity for associated storage
	ErrNoLifetime = "storage longevity not specified"

	// ErrNoOwner means no owner could be found for storage
	ErrNoOwner = "storage has no owner specified"

	// ErrInvalid is an invalid option
	ErrInvalid = "invalid specification"

	// ErrNotImplemented is a functionality that has yet to be implemented
	ErrNotImplemented = "not implemented"

	// ErrNoPerms indicates that the struct is missing permissions
	ErrNoPerms = "no permissions found"

	// ErrNoCreateDate indicates the struct has no create date
	ErrNoCreateDate = "no created date found"

	// ErrNoSecret indicates no authentication was provided
	ErrNoSecret = "no authentication found"
)

Variables

View Source
var CephKey = "ceph"

Functions

func CheckNamespaceExists added in v0.0.6

func CheckNamespaceExists(pool, namespace string) (bool, error)

CheckNamespaceExists verifies the existance of the namespace

func CheckPoolExists

func CheckPoolExists(name string) (bool, error)

CheckPoolExists check if a pool exists, used in conjunction with create, create if not exist.

func CheckRBDExists

func CheckRBDExists(name, namespace, pool string) (exists bool, err error)

CheckRBDExists check if the block device was created.

func ChmodCephMountDir

func ChmodCephMountDir(path string, permission uint32) error

ChmodCephMountDir change permissions for a directory.

func ChownCephMountDir

func ChownCephMountDir(path string, user, group uint32) error

ChownCephMountDir change ownership for a directory.

func ConfigureStorSettings added in v0.0.3

func ConfigureStorSettings(etcdCfg *common.ServiceConfig) error

ConfigureStorSettings initializes stor configuration file with rally configuration file settings.

func CreateAllUserStructs added in v0.0.5

func CreateAllUserStructs(name string) error

CreateAllUserStructs creates a rally user and an empty ceph user data

func CreateAllUsers added in v0.0.5

func CreateAllUsers(name string) error

CreateAllUsers creates a rally user and an empty ceph user data

func CreateBlockDevice

func CreateBlockDevice(username, pool, image string, size uint64) error

CreateBlockDevice creates a block device in a pool with a name and size. The current implementation creates a 1-to-1 mapping between each block device and a pool namespace. So the first thing we are going to do is check the pool exists, create a namespace, jump into the namespace, create our block device and verify it was created.

func CreateCephFS

func CreateCephFS(fsname string) error

CreateCephFS create the initial ceph filesystem This is a one time use function, it cannot be done multiple times, unless experiment features enabled. It would be best to not.

func CreateOnlyRallyUser added in v0.0.5

func CreateOnlyRallyUser(name string) error

CreateOnlyRallerUser creates only a rally user

func CreatePool

func CreatePool(name string) error

CreatePool create a pool.

func CreateRallyStorage

func CreateRallyStorage(user *api.RallyUser) error

CreateRallyStorage creates a rally user, and the necessary ceph backings.

func DeleteAllData added in v0.0.5

func DeleteAllData(name string, force bool) error

DeleteAllData removes rally and ceph users as well as ceph attached data

func DeleteAllUserStructs added in v0.0.5

func DeleteAllUserStructs(name string, force bool) error

DeleteAllUserStructs deletes rally and ceph users

func DeleteBlockDevice

func DeleteBlockDevice(pool, namespace, image string) error

DeleteBlockDevice deletes the block device from the pool. Inverse to Create, first we check the pool exists, then we check the namespace exists, then we delete the image, verify it is gone and the namespace is empty, finally delete the namespace and exit.

func DeleteCephDirectory added in v0.0.3

func DeleteCephDirectory(mountName string, logOutput bool) error

DeleteCephDirectory will recursively delete the directory of the the mount in cephfs

func DeleteOnlyRallyUser added in v0.0.5

func DeleteOnlyRallyUser(name string) error

DeleteOnlyRallyUser removes only rally users and keeps ceph user and data

func DeleteRallyStorage

func DeleteRallyStorage(name string, force bool) error

DeleteRallyStorage deletes storage be removed from ceph.

func EnsureCephDirectory added in v0.0.3

func EnsureCephDirectory(path string) bool

EnsureCephDirectory tests the existence of a ceph directory without needing to mount the fileystem.

func EnsureCephPools added in v0.0.6

func EnsureCephPools(pools []string) ([]string, error)

func EnsurePool added in v0.0.3

func EnsurePool(name string) (bool, error)

EnsurePool check if a pool exists, used in conjunction with create, create if not exist.

func GetCephAvailableCapacity

func GetCephAvailableCapacity() (string, error)

GetCephAvailableCapacity returns the global storage capacity of the ceph cluster.

func GetCephMountedDir

func GetCephMountedDir(mountName string) (os.FileInfo, error)

GetCephMountedDir returns the file info struct of the directory located in cephfs.

func GetCephPoolCapacityPercent

func GetCephPoolCapacityPercent(poolName string) (string, error)

GetCephPoolCapacityPercent returns the allocation for a single ceph pool.

func GetDefaultPool added in v0.0.6

func GetDefaultPool() (pool string, err error)

GetDefaultPool returns the default pool used from the config

func GetPools

func GetPools() ([]string, error)

GetPools get rados ceph pools.

func GetSecretCeph

func GetSecretCeph(username string) (string, error)

GetSecretCeph request from ceph the secret key for our username.

func ListAllRadosBlocks added in v0.0.6

func ListAllRadosBlocks(pool, namespace string, all bool) ([]string, error)

ListAllRadosBlocks takes an optional pool. If not given, check the config for the default pool name. Then we request all blocks from all namespaces.

func ListCephMountDir

func ListCephMountDir(path string) ([]string, error)

ListCephMountDir returns the contents of the cephfs directory

func ListNamespaces added in v0.0.6

func ListNamespaces(pool string) ([]string, error)

ListNamespaces takes an optional pool. If not given, check the config for the default pool name. Then pass `namespace list` to ceph and parse the output as a list of namespaces.

func ListRallyUsers added in v0.0.5

func ListRallyUsers() ([]string, error)

func MakeBlock added in v0.0.6

func MakeBlock(pool, namespace, image string, size uint64) error

func MakeCephDirectory added in v0.0.3

func MakeCephDirectory(mountName string) error

MakeCephDirectory create the mount in cephfs.

func MakeNamespace added in v0.0.6

func MakeNamespace(namespace, pool string) error

MakeNamespaces takes an optional pool. If not given, check the config for the default pool name. Then create the namespace in the pool if it does not already exist

func ModifyBlock added in v0.0.6

func ModifyBlock(pool, namespace, image string, size uint64, action string) error

func ModifyNamespace added in v0.0.6

func ModifyNamespace(namespace, pool, action string) error

func NewRallyResponse

func NewRallyResponse() *api.RallyResponse

NewRallyResponse creates a blank api.RallyResponse.

func RemoveBlock added in v0.0.6

func RemoveBlock(pool, namespace, image string) error

func RemoveNamespace added in v0.0.6

func RemoveNamespace(namespace, pool string) error

RemoveNamespaces takes an optional pool. If not given, check the config for the default pool name. Then remove the namespace in the pool if it exists

func RunCephAuthCommand

func RunCephAuthCommand(cmdString string) (string, error)

RunCephAuthCommand run a ceph auth command.

func RunCephFSCommand

func RunCephFSCommand(cmdString string) (string, error)

RunCephFSCommand run a ceph filesystem command.

func RunCephGetMonAddrCommand added in v0.0.2

func RunCephGetMonAddrCommand() ([]string, error)

RunCephGetMonAddrCommand gets the monitor public addresses.

func RunRadosCommand added in v0.0.6

func RunRadosCommand(cmdString string) (string, error)

rbd -p rados --namespace lincoln ls RunRadosCommand run a ceph filesystem command.

func SetError

func SetError(r *api.RallyResponse, out string) *api.RallyResponse

SetError configures the output.

func SetErrorLifetime added in v0.0.2

func SetErrorLifetime(r *api.RallyResponse) *api.RallyResponse

SetErrorLifetime configures the output.

func SetErrorName

func SetErrorName(r *api.RallyResponse) *api.RallyResponse

SetErrorName configures the output.

func SetErrorOwner

func SetErrorOwner(r *api.RallyResponse) *api.RallyResponse

SetErrorOwner configures the output.

func SetErrorQuota

func SetErrorQuota(r *api.RallyResponse) *api.RallyResponse

SetErrorQuota configures the output.

func SetErrorType

func SetErrorType(r *api.RallyResponse) *api.RallyResponse

SetErrorType configures the output.

func ValidateFullUser

func ValidateFullUser(user api.RallyUser) error

ValidateFullUser checks that requests to api have all necessary components.

func ValidateNewUser

func ValidateNewUser(user api.RallyUser) error

ValidateNewUser checks that requests to api have all necessary components.

Types

type BlockDevice added in v0.0.6

type BlockDevice struct {
	Pool      string
	Namespace string
	Name      string
}

type CephDF

type CephDF struct {
	Stats map[string]int `json:"stats"`
	Pools []CephDFPool   `json:"pools"`
}

CephDF is the internal ceph datastructure for `cephdf`.

func GetCephStorageCapacity

func GetCephStorageCapacity() (*CephDF, error)

GetCephStorageCapacity returns the space left in ceph that can be allocated.

type CephDFPool

type CephDFPool struct {
	Name  string         `json:"name"`
	ID    int            `json:"id"`
	Stats map[string]int `json:"stats"`
}

CephDFPool is the internal data structure for ceph df's pools data structure.

type CephData added in v0.0.5

type CephData struct {
	Username string            `json:"username,omitempty"` // pointer back to rally user
	Secret   string            `json:"secret,omitempty"`   // ceph secret for authx
	Mon      map[string]string `json:"mon,omitempty"`      // mon permissions
	Mds      map[string]string `json:"mds,omitempty"`      // mds permissions
	Osd      map[string]string `json:"osd,omitempty"`      // osd permissions
	Mgr      map[string]string `json:"mgr,omitempty"`      // mgr permissions
	BD       *BlockDevice      `json:"rbd,omitempty"`      // what rbd it owns
	FS       *Filesystem       `json:"cephfs,omitempty"`   // what path it is responsible for
	Quota    uint64            `json:"quota,omitempty"`    // max size it can be
	// contains filtered or unexported fields
}

func CreateCephUser added in v0.0.5

func CreateCephUser(username string) (*CephData, error)

Create a user in ceph, and add the secret back.

func (*CephData) GenerateCephUserPath added in v0.0.5

func (cu *CephData) GenerateCephUserPath() error

generateCephUserPath creates the etcd/stor path for storing users in etcd.

func (*CephData) GetVersion added in v0.0.5

func (cd *CephData) GetVersion() int64

GetVersion is necessary for the storagification of CephData.

func (*CephData) Key added in v0.0.5

func (cd *CephData) Key() string

Key is necessary for the storagification of CephData.

func (*CephData) SetCephBlockPerms added in v0.0.6

func (cu *CephData) SetCephBlockPerms() error

SetCephBlockPerms sets the permissions for a ceph mount directory path.

func (*CephData) SetCephPathPerms added in v0.0.5

func (cu *CephData) SetCephPathPerms() error

SetCephPathPerms sets the permissions for a ceph mount directory path.

func (*CephData) SetVersion added in v0.0.5

func (cd *CephData) SetVersion(ver int64)

SetVersion is necessary for the storagification of CephData.

func (*CephData) String added in v0.0.5

func (cu *CephData) String() string

String returns the string normally formatted for ceph auth.

func (*CephData) Value added in v0.0.5

func (cd *CephData) Value() interface{}

Value is necessary for the storagification of CephData.

type CephFS

type CephFS struct {
	Name     string
	Metadata string
	Data     []string
}

CephFS structure encapsulating ceph fs.

func GetActualCephFSInfo

func GetActualCephFSInfo() (*CephFS, error)

GetActualCephFSInfo contacts the ceph mons (running cephfs command) to get the actual values for the ceph filesystem's data and metadata.

type Filesystem added in v0.0.6

type Filesystem struct {
	Path string
}

type User added in v0.0.5

type User struct {
	ID       string       `json:"username"`            // name of the storage
	Lifetime api.Lifetime `json:"longevity,omitempty"` // book keeping, time it should exist
	Created  string       `json:"created,omitempty"`   // when storage created
	Owner    string       `json:"owner,omitempty"`     // who owns the storage
	Storage  string       `json:"storage,omitempty"`   // what type of rally storage: ceph
	// contains filtered or unexported fields
}

User is the type used to track single ceph user allocation. A ceph user in this context is a single type of storage, whether it is a cephfs path, or a rbd block device. This structure stores the relevant ceph information on that data.

func GetUser added in v0.0.5

func GetUser(user string) (*User, error)

GetUser returns the user if it exists

func (*User) GetVersion added in v0.0.5

func (cu *User) GetVersion() int64

GetVersion is necessary for the storagification of User.

func (*User) Key added in v0.0.5

func (cu *User) Key() string

Key is necessary for the storagification of User.

func (*User) SetVersion added in v0.0.5

func (cu *User) SetVersion(ver int64)

SetVersion is necessary for the storagification of User.

func (*User) Value added in v0.0.5

func (cu *User) Value() interface{}

Value is necessary for the storagification of User.

Jump to

Keyboard shortcuts

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