ceph

package
v0.27.1 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCephConfFile    = "/etc/ceph/ceph.conf"
	DefaultCephKeyringFile = "/etc/ceph/ceph.client.admin.keyring"
)

Variables

This section is empty.

Functions

func ParseConnectionFromConf

func ParseConnectionFromConf(confPath, keyringPath string) ([]string, string, error)

func ValidateStorageClass

func ValidateStorageClass(storageClass string) error

Types

type Client

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

func NewClient

func NewClient(cfg Config, runner Runner) (*Client, error)

func (*Client) Cleanup

func (c *Client) Cleanup() error

func (*Client) CreateVolume

func (c *Client) CreateVolume(ctx context.Context, req VolumeRequest) error

func (*Client) DeleteVolume

func (c *Client) DeleteVolume(ctx context.Context, pool, image string) error

func (*Client) ListVolumes

func (c *Client) ListVolumes(ctx context.Context, pool string) ([]string, error)

func (*Client) StatVolume

func (c *Client) StatVolume(ctx context.Context, pool, image string) (VolumeInfo, error)

type CommandError

type CommandError struct {
	Command string
	Output  string
	Err     error
}

func (CommandError) Error

func (e CommandError) Error() string

func (CommandError) Unwrap

func (e CommandError) Unwrap() error

type Config

type Config struct {
	ConfFile    string
	KeyringFile string
	PoolByClass map[string]string
}

func DefaultConfig

func DefaultConfig() Config

func (Config) Cleanup

func (c Config) Cleanup() error

func (Config) PoolForStorageClass

func (c Config) PoolForStorageClass(storageClass string) (string, error)

type ExecRunner

type ExecRunner struct{}

func (ExecRunner) Run

func (r ExecRunner) Run(ctx context.Context, name string, args ...string) ([]byte, error)

type FakeClient

type FakeClient struct {
	CreateVolumeFunc func(ctx context.Context, req VolumeRequest) error
	DeleteVolumeFunc func(ctx context.Context, pool, image string) error
	StatVolumeFunc   func(ctx context.Context, pool, image string) (VolumeInfo, error)
	ListVolumesFunc  func(ctx context.Context, pool string) ([]string, error)

	Created []VolumeRequest
	Deleted []string
	Listed  []string
	Stated  []string
}

func (*FakeClient) Cleanup

func (f *FakeClient) Cleanup() error

func (*FakeClient) CreateVolume

func (f *FakeClient) CreateVolume(ctx context.Context, req VolumeRequest) error

func (*FakeClient) DeleteVolume

func (f *FakeClient) DeleteVolume(ctx context.Context, pool, image string) error

func (*FakeClient) ListVolumes

func (f *FakeClient) ListVolumes(ctx context.Context, pool string) ([]string, error)

func (*FakeClient) StatVolume

func (f *FakeClient) StatVolume(ctx context.Context, pool, image string) (VolumeInfo, error)

type Runner

type Runner interface {
	Run(ctx context.Context, name string, args ...string) ([]byte, error)
}

type VolumeClient

type VolumeClient interface {
	CreateVolume(ctx context.Context, req VolumeRequest) error
	DeleteVolume(ctx context.Context, pool, image string) error
	StatVolume(ctx context.Context, pool, image string) (VolumeInfo, error)
	ListVolumes(ctx context.Context, pool string) ([]string, error)
}

type VolumeInfo

type VolumeInfo struct {
	Pool             string
	Image            string
	SizeBytes        uint64
	ProviderVolumeID string
}

type VolumeRequest

type VolumeRequest struct {
	Pool         string
	Image        string
	SizeGB       int
	StorageClass string
}

func MapVolumeToRequest

func MapVolumeToRequest(volume api.Volume, cfg Config) (VolumeRequest, error)

func (VolumeRequest) ProviderVolumeID

func (r VolumeRequest) ProviderVolumeID() string

Jump to

Keyboard shortcuts

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