Documentation ¶
Index ¶
- Constants
- Variables
- func CheckNamespaceExists(pool, namespace string) (bool, error)
- func CheckPoolExists(name string) (bool, error)
- func CheckRBDExists(name, namespace, pool string) (exists bool, err error)
- func ChmodCephMountDir(path string, permission uint32) error
- func ChownCephMountDir(path string, user, group uint32) error
- func ConfigureStorSettings(etcdCfg *common.ServiceConfig) error
- func CreateAllUserStructs(name string) error
- func CreateAllUsers(name string) error
- func CreateBlockDevice(username, pool, image string, size uint64) error
- func CreateCephFS(fsname string) error
- func CreateOnlyRallyUser(name string) error
- func CreatePool(name string) error
- func CreateRallyStorage(user *api.RallyUser) error
- func DeleteAllData(name string, force bool) error
- func DeleteAllUserStructs(name string, force bool) error
- func DeleteBlockDevice(pool, namespace, image string) error
- func DeleteCephDirectory(mountName string, logOutput bool) error
- func DeleteOnlyRallyUser(name string) error
- func DeleteRallyStorage(name string, force bool) error
- func EnsureCephDirectory(path string) bool
- func EnsureCephPools(pools []string) ([]string, error)
- func EnsurePool(name string) (bool, error)
- func GetCephAvailableCapacity() (string, error)
- func GetCephMountedDir(mountName string) (os.FileInfo, error)
- func GetCephPoolCapacityPercent(poolName string) (string, error)
- func GetDefaultPool() (pool string, err error)
- func GetPools() ([]string, error)
- func GetSecretCeph(username string) (string, error)
- func ListAllRadosBlocks(pool, namespace string, all bool) ([]string, error)
- func ListCephMountDir(path string) ([]string, error)
- func ListNamespaces(pool string) ([]string, error)
- func ListRallyUsers() ([]string, error)
- func MakeBlock(pool, namespace, image string, size uint64) error
- func MakeCephDirectory(mountName string) error
- func MakeNamespace(namespace, pool string) error
- func ModifyBlock(pool, namespace, image string, size uint64, action string) error
- func ModifyNamespace(namespace, pool, action string) error
- func NewRallyResponse() *api.RallyResponse
- func RemoveBlock(pool, namespace, image string) error
- func RemoveNamespace(namespace, pool string) error
- func RunCephAuthCommand(cmdString string) (string, error)
- func RunCephFSCommand(cmdString string) (string, error)
- func RunCephGetMonAddrCommand() ([]string, error)
- func RunRadosCommand(cmdString string) (string, error)
- func SetError(r *api.RallyResponse, out string) *api.RallyResponse
- func SetErrorLifetime(r *api.RallyResponse) *api.RallyResponse
- func SetErrorName(r *api.RallyResponse) *api.RallyResponse
- func SetErrorOwner(r *api.RallyResponse) *api.RallyResponse
- func SetErrorQuota(r *api.RallyResponse) *api.RallyResponse
- func SetErrorType(r *api.RallyResponse) *api.RallyResponse
- func ValidateFullUser(user api.RallyUser) error
- func ValidateNewUser(user api.RallyUser) error
- type BlockDevice
- type CephDF
- type CephDFPool
- type CephData
- func (cu *CephData) GenerateCephUserPath() error
- func (cd *CephData) GetVersion() int64
- func (cd *CephData) Key() string
- func (cu *CephData) SetCephBlockPerms() error
- func (cu *CephData) SetCephPathPerms() error
- func (cd *CephData) SetVersion(ver int64)
- func (cu *CephData) String() string
- func (cd *CephData) Value() interface{}
- type CephFS
- type Filesystem
- type User
Constants ¶
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" )
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 ¶
var CephKey = "ceph"
Functions ¶
func CheckNamespaceExists ¶ added in v0.0.6
CheckNamespaceExists verifies the existance of the namespace
func CheckPoolExists ¶
CheckPoolExists check if a pool exists, used in conjunction with create, create if not exist.
func CheckRBDExists ¶
CheckRBDExists check if the block device was created.
func ChmodCephMountDir ¶
ChmodCephMountDir change permissions for a directory.
func ChownCephMountDir ¶
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
CreateAllUserStructs creates a rally user and an empty ceph user data
func CreateAllUsers ¶ added in v0.0.5
CreateAllUsers creates a rally user and an empty ceph user data
func CreateBlockDevice ¶
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 ¶
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
CreateOnlyRallerUser creates only a rally user
func CreateRallyStorage ¶
CreateRallyStorage creates a rally user, and the necessary ceph backings.
func DeleteAllData ¶ added in v0.0.5
DeleteAllData removes rally and ceph users as well as ceph attached data
func DeleteAllUserStructs ¶ added in v0.0.5
DeleteAllUserStructs deletes rally and ceph users
func DeleteBlockDevice ¶
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
DeleteCephDirectory will recursively delete the directory of the the mount in cephfs
func DeleteOnlyRallyUser ¶ added in v0.0.5
DeleteOnlyRallyUser removes only rally users and keeps ceph user and data
func DeleteRallyStorage ¶
DeleteRallyStorage deletes storage be removed from ceph.
func EnsureCephDirectory ¶ added in v0.0.3
EnsureCephDirectory tests the existence of a ceph directory without needing to mount the fileystem.
func EnsureCephPools ¶ added in v0.0.6
func EnsurePool ¶ added in v0.0.3
EnsurePool check if a pool exists, used in conjunction with create, create if not exist.
func GetCephAvailableCapacity ¶
GetCephAvailableCapacity returns the global storage capacity of the ceph cluster.
func GetCephMountedDir ¶
GetCephMountedDir returns the file info struct of the directory located in cephfs.
func GetCephPoolCapacityPercent ¶
GetCephPoolCapacityPercent returns the allocation for a single ceph pool.
func GetDefaultPool ¶ added in v0.0.6
GetDefaultPool returns the default pool used from the config
func GetSecretCeph ¶
GetSecretCeph request from ceph the secret key for our username.
func ListAllRadosBlocks ¶ added in v0.0.6
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 ¶
ListCephMountDir returns the contents of the cephfs directory
func ListNamespaces ¶ added in v0.0.6
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 MakeCephDirectory ¶ added in v0.0.3
MakeCephDirectory create the mount in cephfs.
func MakeNamespace ¶ added in v0.0.6
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 ModifyNamespace ¶ added in v0.0.6
func NewRallyResponse ¶
func NewRallyResponse() *api.RallyResponse
NewRallyResponse creates a blank api.RallyResponse.
func RemoveBlock ¶ added in v0.0.6
func RemoveNamespace ¶ added in v0.0.6
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 ¶
RunCephAuthCommand run a ceph auth command.
func RunCephFSCommand ¶
RunCephFSCommand run a ceph filesystem command.
func RunCephGetMonAddrCommand ¶ added in v0.0.2
RunCephGetMonAddrCommand gets the monitor public addresses.
func RunRadosCommand ¶ added in v0.0.6
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 ¶
ValidateFullUser checks that requests to api have all necessary components.
func ValidateNewUser ¶
ValidateNewUser checks that requests to api have all necessary components.
Types ¶
type BlockDevice ¶ added in v0.0.6
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 ¶
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
Create a user in ceph, and add the secret back.
func (*CephData) GenerateCephUserPath ¶ added in v0.0.5
generateCephUserPath creates the etcd/stor path for storing users in etcd.
func (*CephData) GetVersion ¶ added in v0.0.5
GetVersion is necessary for the storagification of CephData.
func (*CephData) SetCephBlockPerms ¶ added in v0.0.6
SetCephBlockPerms sets the permissions for a ceph mount directory path.
func (*CephData) SetCephPathPerms ¶ added in v0.0.5
SetCephPathPerms sets the permissions for a ceph mount directory path.
func (*CephData) SetVersion ¶ added in v0.0.5
SetVersion is necessary for the storagification of CephData.
type CephFS ¶
CephFS structure encapsulating ceph fs.
func GetActualCephFSInfo ¶
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 (*User) GetVersion ¶ added in v0.0.5
GetVersion is necessary for the storagification of User.
func (*User) SetVersion ¶ added in v0.0.5
SetVersion is necessary for the storagification of User.