admin

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2022 License: MIT Imports: 3 Imported by: 2

Documentation

Overview

Package admin is a convenience layer to support the administration of rbd volumes, snapshots, scheduling etc that is outside of the C api for librbd.

Unlike the rbd package this API does not map to APIs provided by ceph libraries themselves. This API is not yet stable and is subject to change.

Index

Constants

This section is empty.

Variables

View Source
var (
	// NoInterval indicates no specific interval.
	NoInterval = Interval("")

	// NoStartTime indicates no specific start time.
	NoStartTime = StartTime("")
)

Functions

This section is empty.

Types

type ImageSpec added in v0.13.0

type ImageSpec struct {
	// contains filtered or unexported fields
}

ImageSpec values are used to identify an RBD image wherever Ceph APIs require an image_spec/image_id_spec using image name/id and optional pool and namespace.

func NewImageSpec added in v0.13.0

func NewImageSpec(pool, namespace, image string) ImageSpec

NewImageSpec is used to construct an ImageSpec given an image name/id and optional namespace and pool names.

NewImageSpec constructs an ImageSpec to identify an RBD image and thus requires image name/id, whereas NewLevelSpec constructs LevelSpec to identify entire pool, pool namespace or single RBD image, all of which requires pool name.

func NewRawImageSpec added in v0.13.0

func NewRawImageSpec(spec string) ImageSpec

NewRawImageSpec returns a ImageSpec directly based on the spec string argument without constructing it from component values.

This should only be used if NewImageSpec can not create the imagespec value you want to pass to ceph.

type Interval

type Interval string

Interval of time between scheduled snapshots. Typically in the form <num><m,h,d>. Exact content supported is defined internally on the ceph mgr.

type LevelSpec

type LevelSpec struct {
	// contains filtered or unexported fields
}

LevelSpec values are used to identify RBD objects wherever Ceph APIs require a levelspec to select an image, pool, or namespace.

func NewLevelSpec

func NewLevelSpec(pool, namespace, image string) LevelSpec

NewLevelSpec is used to construct a LevelSpec given a pool and optional namespace and image names.

func NewRawLevelSpec

func NewRawLevelSpec(spec string) LevelSpec

NewRawLevelSpec returns a LevelSpec directly based on the spec string argument without constructing it from component values. This should only be used if NewLevelSpec can not create the levelspec value you want to pass to ceph.

type MirrorSnashotScheduleAdmin

type MirrorSnashotScheduleAdmin struct {
	// contains filtered or unexported fields
}

MirrorSnashotScheduleAdmin encapsulates management functions for ceph rbd mirror snapshot schedules.

func (*MirrorSnashotScheduleAdmin) Add

Add a new snapshot schedule to the given pool/image based on the supplied level spec.

Similar To:

rbd mirror snapshot schedule add <level_spec> <interval> <start_time>

func (*MirrorSnashotScheduleAdmin) List

List the snapshot schedules based on the supplied level spec.

Similar To:

rbd mirror snapshot schedule list <level_spec>

func (*MirrorSnashotScheduleAdmin) Remove

Remove a snapshot schedule matching the supplied arguments.

Similar To:

rbd mirror snapshot schedule remove <level_spec> <interval> <start_time>

func (*MirrorSnashotScheduleAdmin) Status

Status returns the status of the snapshot (eg. when it will next take place) matching the supplied level spec.

Similar To:

rbd mirror snapshot schedule status <level_spec>

type RBDAdmin

type RBDAdmin struct {
	// contains filtered or unexported fields
}

RBDAdmin is used to administrate rbd volumes and pools.

func NewFromConn

func NewFromConn(conn ccom.RadosCommander) *RBDAdmin

NewFromConn creates an new management object from a preexisting rados connection. The existing connection can be rados.Conn or any type implementing the RadosCommander interface.

func (*RBDAdmin) MirrorSnashotSchedule

func (ra *RBDAdmin) MirrorSnashotSchedule() *MirrorSnashotScheduleAdmin

MirrorSnashotSchedule returns a MirrorSnashotScheduleAdmin type for managing ceph rbd mirror snapshot schedules.

func (*RBDAdmin) Task added in v0.13.0

func (ra *RBDAdmin) Task() *TaskAdmin

Task returns a TaskAdmin type for managing ceph rbd task operations.

type ScheduleTerm

type ScheduleTerm struct {
	Interval  Interval  `json:"interval"`
	StartTime StartTime `json:"start_time"`
}

ScheduleTerm represents the interval and start time component of a snapshot schedule.

type ScheduleTime

type ScheduleTime string

ScheduleTime is the time a snapshot will occur.

type ScheduledImage

type ScheduledImage struct {
	Image        string       `json:"image"`
	ScheduleTime ScheduleTime `json:"schedule_time"`
}

ScheduledImage contains the item scheduled and when it will next occur.

type SnapshotSchedule

type SnapshotSchedule struct {
	Name        string
	LevelSpecID string
	Schedule    []ScheduleTerm
}

SnapshotSchedule contains values representing an entire snapshot schedule for an image or pool.

type StartTime

type StartTime string

StartTime is the time the snapshot schedule begins. Exact content supported is defined internally on the ceph mgr.

type TaskAdmin added in v0.13.0

type TaskAdmin struct {
	// contains filtered or unexported fields
}

TaskAdmin encapsulates management functions for ceph rbd task operations.

func (*TaskAdmin) AddFlatten added in v0.13.0

func (ta *TaskAdmin) AddFlatten(img ImageSpec) (TaskResponse, error)

AddFlatten adds a background task to flatten a cloned image based on the supplied image spec.

Similar To:

rbd task add flatten <image_spec>

func (*TaskAdmin) AddRemove added in v0.13.0

func (ta *TaskAdmin) AddRemove(img ImageSpec) (TaskResponse, error)

AddRemove adds a background task to remove an image based on the supplied image spec.

Similar To:

rbd task add remove <image_spec>

func (*TaskAdmin) AddTrashRemove added in v0.13.0

func (ta *TaskAdmin) AddTrashRemove(img ImageSpec) (TaskResponse, error)

AddTrashRemove adds a background task to remove an image from the trash based on the supplied image id spec.

Similar To:

rbd task add trash remove <image_id_spec>

func (*TaskAdmin) Cancel added in v0.13.0

func (ta *TaskAdmin) Cancel(taskID string) (TaskResponse, error)

Cancel a pending or running asynchronous task.

Similar To:

rbd task cancel <task_id>

func (*TaskAdmin) GetTaskByID added in v0.13.0

func (ta *TaskAdmin) GetTaskByID(taskID string) (TaskResponse, error)

GetTaskByID returns pending or running asynchronous task using id.

Similar To:

rbd task list <task_id>

func (*TaskAdmin) List added in v0.13.0

func (ta *TaskAdmin) List() ([]TaskResponse, error)

List pending or running asynchronous tasks.

Similar To:

rbd task list

type TaskRefs added in v0.13.0

type TaskRefs struct {
	Action        string `json:"action"`
	PoolName      string `json:"pool_name"`
	PoolNamespace string `json:"pool_namespace"`
	ImageName     string `json:"image_name"`
	ImageID       string `json:"image_id"`
}

TaskRefs contains the action name and information about the image.

type TaskResponse added in v0.13.0

type TaskResponse struct {
	Sequence      int      `json:"sequence"`
	ID            string   `json:"id"`
	Message       string   `json:"message"`
	Refs          TaskRefs `json:"refs"`
	InProgress    bool     `json:"in_progress"`
	Progress      float64  `json:"progress"`
	RetryAttempts int      `json:"retry_attempts"`
	RetryTime     string   `json:"retry_time"`
	RetryMessage  string   `json:"retry_message"`
}

TaskResponse contains the information about the task added on an image.

Jump to

Keyboard shortcuts

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