openstack

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package openstack snapshots provides an implementation of Cinder Snapshot features cinder functions using Gophercloud.

Index

Constants

View Source
const (
	VolumeAvailableStatus = "available"
	VolumeInUseStatus     = "in-use"
)

Variables

This section is empty.

Functions

func AddExtraFlags

func AddExtraFlags(fs *pflag.FlagSet)

AddExtraFlags is called by the main package to add component specific command line flags

func InitOpenStackProvider

func InitOpenStackProvider(cfgFiles []string)

Types

type BlockStorageOpts

type BlockStorageOpts struct {
	NodeVolumeAttachLimit int64 `gcfg:"node-volume-attach-limit"`
	RescanOnResize        bool  `gcfg:"rescan-on-resize"`
	IgnoreVolumeAZ        bool  `gcfg:"ignore-volume-az"`
}

type Config

type Config struct {
	Global       client.AuthOpts
	BlockStorage BlockStorageOpts
}

func GetConfigFromFiles

func GetConfigFromFiles(configFilePaths []string) (Config, error)

GetConfigFromFiles retrieves config options from file

type IOpenStack

type IOpenStack interface {
	CheckBlockStorageAPI() error
	CreateVolume(name string, size int, vtype, availability string, snapshotID string, sourcevolID string, tags *map[string]string) (*volumes.Volume, error)
	DeleteVolume(volumeID string) error
	AttachVolume(volumeID string, mountPoint string) error
	DetachVolume(volumeID string) error
	ListVolumes(limit int, startingToken string) ([]volumes.Volume, string, error)
	WaitVolumeTargetStatus(volumeID string, tStatus []string) error
	GetVolume(volumeID string) (*volumes.Volume, error)
	GetVolumesByName(name string) ([]volumes.Volume, error)
	CreateSnapshot(name, volID string, tags *map[string]string) (*snapshots.Snapshot, error)
	ListSnapshots(filters map[string]string) ([]snapshots.Snapshot, string, error)
	DeleteSnapshot(snapID string) error
	GetSnapshotByID(snapshotID string) (*snapshots.Snapshot, error)
	WaitSnapshotReady(snapshotID string) error
	ExpandVolume(volumeID string, status string, size int) error
	GetMaxVolLimit() int64
	GetBlockStorageOpts() BlockStorageOpts
	GetAvailabilityZone() (string, error)
	GetInitializeConnection(volumeID string) (map[string]interface{}, error)
}
var OsInstance IOpenStack = nil

func CreateOpenStackProvider

func CreateOpenStackProvider() (IOpenStack, error)

CreateOpenStackProvider creates Openstack Instance

func GetOpenStackProvider

func GetOpenStackProvider() (IOpenStack, error)

GetOpenStackProvider returns Openstack Instance

type OpenStack

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

func (*OpenStack) AttachVolume

func (os *OpenStack) AttachVolume(volumeID string, mountPoint string) error

func (*OpenStack) CheckBlockStorageAPI

func (os *OpenStack) CheckBlockStorageAPI() error

func (*OpenStack) CreateSnapshot

func (os *OpenStack) CreateSnapshot(name, volID string, tags *map[string]string) (*snapshots.Snapshot, error)

CreateSnapshot issues a request to take a Snapshot of the specified Volume with the corresponding ID and returns the resultant gophercloud Snapshot Item upon success

func (*OpenStack) CreateVolume

func (os *OpenStack) CreateVolume(name string, size int, vtype, availability string, snapshotID string, sourcevolID string, tags *map[string]string) (*volumes.Volume, error)

CreateVolume creates a volume of given size

func (*OpenStack) DeleteSnapshot

func (os *OpenStack) DeleteSnapshot(snapID string) error

DeleteSnapshot issues a request to delete the Snapshot with the specified ID from the Cinder backend

func (*OpenStack) DeleteVolume

func (os *OpenStack) DeleteVolume(volumeID string) error

DeleteVolume delete a volume

func (*OpenStack) DetachVolume

func (os *OpenStack) DetachVolume(volumeID string) error

func (*OpenStack) ExpandVolume

func (os *OpenStack) ExpandVolume(volumeID string, status string, newSize int) error

ExpandVolume expands the volume to new size

func (*OpenStack) GetAttachmentDiskPath

func (os *OpenStack) GetAttachmentDiskPath(instanceID, volumeID string) (string, error)

GetAttachmentDiskPath gets device path of attached volume to the compute

func (*OpenStack) GetAvailabilityZone

func (os *OpenStack) GetAvailabilityZone() (string, error)

func (*OpenStack) GetBlockStorageOpts

func (os *OpenStack) GetBlockStorageOpts() BlockStorageOpts

GetBlockStorageOpts returns OpenStack block storage options

func (*OpenStack) GetInitializeConnection

func (os *OpenStack) GetInitializeConnection(volumeID string) (map[string]interface{}, error)

func (*OpenStack) GetMaxVolLimit

func (os *OpenStack) GetMaxVolLimit() int64

GetMaxVolLimit returns max vol limit

func (*OpenStack) GetSnapshotByID

func (os *OpenStack) GetSnapshotByID(snapshotID string) (*snapshots.Snapshot, error)

GetSnapshotByID returns snapshot details by id

func (*OpenStack) GetVolume

func (os *OpenStack) GetVolume(volumeID string) (*volumes.Volume, error)

GetVolume retrieves Volume by its ID.

func (*OpenStack) GetVolumesByName

func (os *OpenStack) GetVolumesByName(n string) ([]volumes.Volume, error)

GetVolumesByName is a wrapper around ListVolumes that creates a Name filter to act as a GetByName Returns a list of Volume references with the specified name

func (*OpenStack) ListSnapshots

func (os *OpenStack) ListSnapshots(filters map[string]string) ([]snapshots.Snapshot, string, error)

ListSnapshots retrieves a list of active snapshots from Cinder for the corresponding Tenant. We also provide the ability to provide limit and offset to enable the consumer to provide accurate pagination. In addition the filters argument provides a mechanism for passing in valid filter strings to the list operation. Valid filter keys are: Name, Status, VolumeID, Limit, Marker (TenantID has no effect)

func (*OpenStack) ListVolumes

func (os *OpenStack) ListVolumes(limit int, startingToken string) ([]volumes.Volume, string, error)

ListVolumes list all the volumes

func (*OpenStack) WaitSnapshotReady

func (os *OpenStack) WaitSnapshotReady(snapshotID string) error

WaitSnapshotReady waits till snapshot is ready

func (*OpenStack) WaitVolumeTargetStatus

func (os *OpenStack) WaitVolumeTargetStatus(volumeID string, tStatus []string) error

WaitVolumeTargetStatus waits for volume to be in target state

Jump to

Keyboard shortcuts

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