utils

package
v0.0.0-...-3620358 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2019 License: Apache-2.0, Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMappedRBDs

func GetMappedRBDs(ctx types.Context) (map[string]string, error)

GetMappedRBDs returns a map of RBDs currently mapped to the *local* host

func GetRBDStatus

func GetRBDStatus(
	ctx types.Context,
	pool, image *string) (map[string]interface{}, error)

GetRBDStatus returns a map of RBD status info

func GetRadosPools

func GetRadosPools(ctx types.Context) ([]string, error)

GetRadosPools returns a slice containing all the pool names

func GetVolumeID

func GetVolumeID(pool, image *string) *string

GetVolumeID returns an RBD Volume formatted as <pool>.<imageName>

func ParseMonitorAddresses

func ParseMonitorAddresses(addrs []string) ([]net.IP, error)

ParseMonitorAddresses returns a slice of IP address from the given slice of string addresses. Addresses can be IPv4, IPv4:port, [IPv6], or [IPv6]:port

func RBDCreate

func RBDCreate(
	ctx types.Context,
	pool *string,
	image *string,
	sizeGB *int64,
	objectSize *string,
	features []*string) error

RBDCreate creates a new RBD volume on the cluster

func RBDHasWatchers

func RBDHasWatchers(
	ctx types.Context,
	pool *string,
	image *string) (bool, error)

RBDHasWatchers returns true if RBD image has watchers

func RBDMap

func RBDMap(
	ctx types.Context,
	pool, image *string) (string, error)

RBDMap attaches the given RBD image to the *local* host

func RBDRemove

func RBDRemove(
	ctx types.Context,
	pool *string,
	image *string) error

RBDRemove deletes the RBD volume on the cluster

func RBDUnmap

func RBDUnmap(ctx types.Context, device *string) error

RBDUnmap detaches the given RBD device from the *local* host

func RunCommand

func RunCommand(
	ctx types.Context,
	cmd *exec.Cmd,
	ignoreCodes ...int) ([]byte, int, error)

RunCommand run the given command, taking care of proper logging

func StrContainsClient

func StrContainsClient(arg string) bool

StrContainsClient search str arg for flags that can set a Ceph client id/name

Types

type RBDImage

type RBDImage struct {
	Name   string `json:"image"`
	Size   int64  `json:"size"`
	Format uint   `json:"format"`
	Pool   string
}

RBDImage holds details about an RBD image

func GetRBDImages

func GetRBDImages(
	ctx types.Context,
	pool string) ([]*RBDImage, error)

GetRBDImages returns a slice of RBD image info

type RBDInfo

type RBDInfo struct {
	Name            string   `json:"name"`
	Size            int64    `json:"size"`
	Objects         int64    `json:"objects"`
	Order           int64    `json:"order"`
	ObjectSize      int64    `json:"object_size"`
	BlockNamePrefix string   `json:"block_name_prefix"`
	Format          int64    `json:"format"`
	Features        []string `json:"features"`
	Pool            string
}

RBDInfo holds low-level details about an RBD image

func GetRBDInfo

func GetRBDInfo(
	ctx types.Context,
	pool *string,
	name *string) (*RBDInfo, error)

GetRBDInfo gets low-level details about an RBD image

Jump to

Keyboard shortcuts

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