Documentation ¶
Overview ¶
Package openstack snapshots provides an implementation of Cinder Snapshot features cinder functions using Gophercloud.
Index ¶
- Constants
- func AddExtraFlags(fs *pflag.FlagSet)
- func InitOpenStackProvider(cfgFiles []string)
- type BlockStorageOpts
- type Config
- type IOpenStack
- type OpenStack
- func (os *OpenStack) AttachVolume(instanceID, volumeID string) (string, error)
- func (os *OpenStack) CreateSnapshot(name, volID string, tags *map[string]string) (*snapshots.Snapshot, error)
- func (os *OpenStack) CreateVolume(name string, size int, vtype, availability string, snapshotID string, ...) (*volumes.Volume, error)
- func (os *OpenStack) DeleteSnapshot(snapID string) error
- func (os *OpenStack) DeleteVolume(volumeID string) error
- func (os *OpenStack) DetachVolume(instanceID, volumeID string) error
- func (os *OpenStack) ExpandVolume(volumeID string, status string, newSize int) error
- func (os *OpenStack) GetAttachmentDiskPath(instanceID, volumeID string) (string, error)
- func (os *OpenStack) GetBlockStorageOpts() BlockStorageOpts
- func (os *OpenStack) GetInstanceByID(instanceID string) (*servers.Server, error)
- func (os *OpenStack) GetMaxVolLimit() int64
- func (os *OpenStack) GetMetadataOpts() metadata.MetadataOpts
- func (os *OpenStack) GetSnapshotByID(snapshotID string) (*snapshots.Snapshot, error)
- func (os *OpenStack) GetVolume(volumeID string) (*volumes.Volume, error)
- func (os *OpenStack) GetVolumesByName(n string) ([]volumes.Volume, error)
- func (os *OpenStack) ListSnapshots(filters map[string]string) ([]snapshots.Snapshot, string, error)
- func (os *OpenStack) ListVolumes(limit int, startingToken string) ([]volumes.Volume, string, error)
- func (os *OpenStack) WaitDiskAttached(instanceID string, volumeID string) error
- func (os *OpenStack) WaitDiskDetached(instanceID string, volumeID string) error
- func (os *OpenStack) WaitSnapshotReady(snapshotID string) error
- func (os *OpenStack) WaitVolumeTargetStatus(volumeID string, tStatus []string) error
- type OpenStackMock
- func (_m *OpenStackMock) AttachVolume(instanceID string, volumeID string) (string, error)
- func (_m *OpenStackMock) CreateSnapshot(name string, volID string, tags *map[string]string) (*snapshots.Snapshot, error)
- func (_m *OpenStackMock) CreateVolume(name string, size int, vtype string, availability string, snapshotID string, ...) (*volumes.Volume, error)
- func (_m *OpenStackMock) DeleteSnapshot(snapID string) error
- func (_m *OpenStackMock) DeleteVolume(volumeID string) error
- func (_m *OpenStackMock) DetachVolume(instanceID string, volumeID string) error
- func (_m *OpenStackMock) ExpandVolume(volumeID string, status string, size int) error
- func (_m *OpenStackMock) GetAttachmentDiskPath(instanceID string, volumeID string) (string, error)
- func (_m *OpenStackMock) GetAvailabilityZone() (string, error)
- func (_m *OpenStackMock) GetBlockStorageOpts() BlockStorageOpts
- func (_m *OpenStackMock) GetInstanceByID(instanceID string) (*servers.Server, error)
- func (_m *OpenStackMock) GetInstanceID() (string, error)
- func (_m *OpenStackMock) GetMaxVolLimit() int64
- func (_m *OpenStackMock) GetMetadataOpts() metadata.MetadataOpts
- func (_m *OpenStackMock) GetSnapshotByID(snapshotID string) (*snapshots.Snapshot, error)
- func (_m *OpenStackMock) GetVolume(volumeID string) (*volumes.Volume, error)
- func (_m *OpenStackMock) GetVolumesByName(name string) ([]volumes.Volume, error)
- func (_m *OpenStackMock) ListSnapshots(filters map[string]string) ([]snapshots.Snapshot, string, error)
- func (_m *OpenStackMock) ListVolumes(limit int, marker string) ([]volumes.Volume, string, error)
- func (_m *OpenStackMock) WaitDiskAttached(instanceID string, volumeID string) error
- func (_m *OpenStackMock) WaitDiskDetached(instanceID string, volumeID string) error
- func (_m *OpenStackMock) WaitSnapshotReady(snapshotID string) error
- func (_m *OpenStackMock) WaitVolumeTargetStatus(volumeID string, tStatus []string) error
Constants ¶
const ( VolumeAvailableStatus = "available" VolumeInUseStatus = "in-use" )
const (
SnapshotForceCreate = "force-create"
)
Variables ¶
This section is empty.
Functions ¶
func AddExtraFlags ¶ added in v1.16.0
AddExtraFlags is called by the main package to add component specific command line flags
func InitOpenStackProvider ¶
func InitOpenStackProvider(cfgFiles []string)
Types ¶
type BlockStorageOpts ¶ added in v1.15.0
type Config ¶
type Config struct { Global client.AuthOpts Metadata metadata.MetadataOpts BlockStorage BlockStorageOpts }
func GetConfigFromFiles ¶ added in v1.22.0
GetConfigFromFiles retrieves config options from file
type IOpenStack ¶
type IOpenStack interface { CreateVolume(name string, size int, vtype, availability string, snapshotID string, sourcevolID string, tags *map[string]string) (*volumes.Volume, error) DeleteVolume(volumeID string) error AttachVolume(instanceID, volumeID string) (string, error) ListVolumes(limit int, startingToken string) ([]volumes.Volume, string, error) WaitDiskAttached(instanceID string, volumeID string) error DetachVolume(instanceID, volumeID string) error WaitDiskDetached(instanceID string, volumeID string) error WaitVolumeTargetStatus(volumeID string, tStatus []string) error GetAttachmentDiskPath(instanceID, volumeID string) (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 GetInstanceByID(instanceID string) (*servers.Server, error) ExpandVolume(volumeID string, status string, size int) error GetMaxVolLimit() int64 GetMetadataOpts() metadata.MetadataOpts GetBlockStorageOpts() BlockStorageOpts }
var OsInstance IOpenStack = nil
func CreateOpenStackProvider ¶ added in v1.14.0
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 ¶
AttachVolume attaches given cinder volume to the compute
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 ¶
DeleteSnapshot issues a request to delete the Snapshot with the specified ID from the Cinder backend
func (*OpenStack) DeleteVolume ¶
DeleteVolume delete a volume
func (*OpenStack) DetachVolume ¶
DetachVolume detaches given cinder volume from the compute
func (*OpenStack) ExpandVolume ¶ added in v1.16.0
ExpandVolume expands the volume to new size
func (*OpenStack) GetAttachmentDiskPath ¶
GetAttachmentDiskPath gets device path of attached volume to the compute
func (*OpenStack) GetBlockStorageOpts ¶ added in v1.18.0
func (os *OpenStack) GetBlockStorageOpts() BlockStorageOpts
GetBlockStorageOpts returns OpenStack block storage options
func (*OpenStack) GetInstanceByID ¶ added in v1.16.0
GetInstanceByID returns server with specified instanceID
func (*OpenStack) GetMaxVolLimit ¶ added in v1.16.0
GetMaxVolLimit returns max vol limit
func (*OpenStack) GetMetadataOpts ¶ added in v1.18.0
func (os *OpenStack) GetMetadataOpts() metadata.MetadataOpts
GetMetadataOpts returns metadataopts
func (*OpenStack) GetSnapshotByID ¶ added in v1.14.0
GetSnapshotByID returns snapshot details by id
func (*OpenStack) GetVolumesByName ¶
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 ¶
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 ¶ added in v1.14.0
ListVolumes list all the volumes
func (*OpenStack) WaitDiskAttached ¶
WaitDiskAttached waits for attched
func (*OpenStack) WaitDiskDetached ¶
WaitDiskDetached waits for detached
func (*OpenStack) WaitSnapshotReady ¶ added in v1.14.0
WaitSnapshotReady waits till snapshot is ready
type OpenStackMock ¶
OpenStackMock is an autogenerated mock type for the IOpenStack type ORIGINALLY GENERATED BY mockery with hand edits
func (*OpenStackMock) AttachVolume ¶
func (_m *OpenStackMock) AttachVolume(instanceID string, volumeID string) (string, error)
AttachVolume provides a mock function with given fields: instanceID, volumeID
func (*OpenStackMock) CreateSnapshot ¶
func (_m *OpenStackMock) CreateSnapshot(name string, volID string, tags *map[string]string) (*snapshots.Snapshot, error)
CreateSnapshot provides a mock function with given fields: name, volID, tags
func (*OpenStackMock) CreateVolume ¶
func (_m *OpenStackMock) CreateVolume(name string, size int, vtype string, availability string, snapshotID string, sourceVolID string, tags *map[string]string) (*volumes.Volume, error)
CreateVolume provides a mock function with given fields: name, size, vtype, availability, tags
func (*OpenStackMock) DeleteSnapshot ¶
func (_m *OpenStackMock) DeleteSnapshot(snapID string) error
DeleteSnapshot provides a mock function with given fields: snapID
func (*OpenStackMock) DeleteVolume ¶
func (_m *OpenStackMock) DeleteVolume(volumeID string) error
DeleteVolume provides a mock function with given fields: volumeID
func (*OpenStackMock) DetachVolume ¶
func (_m *OpenStackMock) DetachVolume(instanceID string, volumeID string) error
DetachVolume provides a mock function with given fields: instanceID, volumeID
func (*OpenStackMock) ExpandVolume ¶ added in v1.16.0
func (_m *OpenStackMock) ExpandVolume(volumeID string, status string, size int) error
ExpandVolume provides a mock function with given fields: instanceID, volumeID
func (*OpenStackMock) GetAttachmentDiskPath ¶
func (_m *OpenStackMock) GetAttachmentDiskPath(instanceID string, volumeID string) (string, error)
GetAttachmentDiskPath provides a mock function with given fields: instanceID, volumeID
func (*OpenStackMock) GetAvailabilityZone ¶ added in v1.14.0
func (_m *OpenStackMock) GetAvailabilityZone() (string, error)
func (*OpenStackMock) GetBlockStorageOpts ¶ added in v1.18.0
func (_m *OpenStackMock) GetBlockStorageOpts() BlockStorageOpts
GetBlockStorageOpts provides a mock function to return BlockStorageOpts
func (*OpenStackMock) GetInstanceByID ¶ added in v1.16.0
func (_m *OpenStackMock) GetInstanceByID(instanceID string) (*servers.Server, error)
func (*OpenStackMock) GetInstanceID ¶ added in v1.14.0
func (_m *OpenStackMock) GetInstanceID() (string, error)
func (*OpenStackMock) GetMaxVolLimit ¶ added in v1.15.0
func (_m *OpenStackMock) GetMaxVolLimit() int64
func (*OpenStackMock) GetMetadataOpts ¶ added in v1.18.0
func (_m *OpenStackMock) GetMetadataOpts() metadata.MetadataOpts
func (*OpenStackMock) GetSnapshotByID ¶ added in v1.14.0
func (_m *OpenStackMock) GetSnapshotByID(snapshotID string) (*snapshots.Snapshot, error)
func (*OpenStackMock) GetVolume ¶ added in v1.15.0
func (_m *OpenStackMock) GetVolume(volumeID string) (*volumes.Volume, error)
GetVolume provides a mock function with given fields: volumeID
func (*OpenStackMock) GetVolumesByName ¶
func (_m *OpenStackMock) GetVolumesByName(name string) ([]volumes.Volume, error)
GetVolumesByName provides a mock function with given fields: name
func (*OpenStackMock) ListSnapshots ¶
func (_m *OpenStackMock) ListSnapshots(filters map[string]string) ([]snapshots.Snapshot, string, error)
ListSnapshots provides a mock function with given fields: limit, offset, filters
func (*OpenStackMock) ListVolumes ¶ added in v1.14.0
ListVolumes provides a mock function without param
func (*OpenStackMock) WaitDiskAttached ¶
func (_m *OpenStackMock) WaitDiskAttached(instanceID string, volumeID string) error
WaitDiskAttached provides a mock function with given fields: instanceID, volumeID
func (*OpenStackMock) WaitDiskDetached ¶
func (_m *OpenStackMock) WaitDiskDetached(instanceID string, volumeID string) error
WaitDiskDetached provides a mock function with given fields: instanceID, volumeID
func (*OpenStackMock) WaitSnapshotReady ¶ added in v1.14.0
func (_m *OpenStackMock) WaitSnapshotReady(snapshotID string) error
func (*OpenStackMock) WaitVolumeTargetStatus ¶ added in v1.21.0
func (_m *OpenStackMock) WaitVolumeTargetStatus(volumeID string, tStatus []string) error
WaitVolumeTargetStatus provides a mock function with given fields: volumeID, tStatus