Documentation ¶
Index ¶
- Constants
- Variables
- func IsCannotFindDevicePath(err error) bool
- func IsLeaseInfoNotReady(err error) bool
- func IsSnapshotNotAvailable(err error) bool
- func IsTryLater(err error) bool
- func NewQingCloudManagerFromConfig(config *qcconfig.Config) (*qingCloudManager, error)
- func NewQingCloudManagerFromFile(filePath string) (*qingCloudManager, error)
- func ReadConfigFromFile(filePath string) (*qcconfig.Config, error)
- type CannotFindDevicePathError
- type CloudManager
- type SnapshotManager
- type UtilManager
- type VolumeManager
Constants ¶
View Source
const ( WaitJobInterval = 10 * time.Second WaitJobTimeout = 180 * time.Second )
View Source
const ( InstanceStatusPending string = "pending" InstanceStatusRunning string = "running" InstanceStatusStopped string = "stopped" InstanceStatusSuspended string = "suspended" InstanceStatusTerminated string = "terminated" InstanceStatusCreased string = "ceased" )
Instance
View Source
const ( SnapshotStatusPending string = "pending" SnapshotStatusAvailable string = "available" SnapshotStatusSuspended string = "suspended" SnapshotStatusDeleted string = "deleted" SnapshotStatusCeased string = "ceased" )
Snapshot https://github.com/yunify/qingcloud-sdk-go/blob/c8f8d40dd4793219c129b7516d6f8ae130bc83c9/service/types.go#L2763 Available status values: pending, available, suspended, deleted, ceased
View Source
const ( SnapshotTransitionStatusCreating string = "creating" SnapshotTransitionStatusSuspending string = "suspending" SnapshotTransitionStatusResuming string = "resuming" SnapshotTransitionStatusDeleting string = "deleting" SnapshotTransitionStatusRecovering string = "recovering" )
https://github.com/yunify/qingcloud-sdk-go/blob/c8f8d40dd4793219c129b7516d6f8ae130bc83c9/service/types.go#L2770 Available transition status values: creating, suspending, resuming, deleting, recovering
View Source
const ( SnapshotFull int = 1 SnapshotIncrement int = 0 )
View Source
const ( DiskStatusPending string = "pending" DiskStatusAvailable string = "available" DiskStatusInuse string = "in-use" DiskStatusSuspended string = "suspended" DiskStatusDeleted string = "deleted" DiskStatusCeased string = "ceased" )
Volume
View Source
const ( ZoneStatusActive = "active" ZoneStatusFaulty = "faulty" ZoneStatusDefunct = "defunct" )
Zone
View Source
const ( EnableDescribeSnapshotVerboseMode = 1 DisableDescribeSnapshotVerboseMode = 0 )
View Source
const ( EnableDescribeInstanceAppCluster = 1 DisableDescribeInstanceAppCluster = 0 )
View Source
const ( EnableDescribeInstanceVerboseMode = 1 DisableDescribeInstanceVerboseMode = 0 )
View Source
const ( ResourceTypeVolume = "volume" ResourceTypeSnapshot = "snapshot" )
Variables ¶
View Source
var DiskReplicaTypeName = map[int]string{
1: "rpp-00000001",
2: "rpp-00000002",
}
Functions ¶
func IsCannotFindDevicePath ¶
func IsLeaseInfoNotReady ¶
func IsSnapshotNotAvailable ¶
func IsTryLater ¶
func NewQingCloudManagerFromFile ¶
NewCloudManagerFromFile Create cloud manager from file
Types ¶
type CannotFindDevicePathError ¶
type CannotFindDevicePathError struct {
// contains filtered or unexported fields
}
func NewCannotFindDevicePathError ¶
func NewCannotFindDevicePathError(vol, ins, zone string) *CannotFindDevicePathError
func (*CannotFindDevicePathError) Error ¶
func (e *CannotFindDevicePathError) Error() string
type CloudManager ¶
type CloudManager interface { SnapshotManager VolumeManager UtilManager }
type SnapshotManager ¶
type SnapshotManager interface { // FindSnapshot gets snapshot information by snapshot ID. // Return: // nil, nil: snapshot does not exist // snapshot info, nil: found snapshot and return snapshot info // nil, error: storage system internal error FindSnapshot(snapId string) (snapInfo *qcservice.Snapshot, err error) // FindSnapshotByName finds and gets snapshot information by its name. // It will filter snapshot in deleted and ceased status and return first discovered item. // Return: // nil, nil: snapshot does not exist // volume, nil: found snapshot and return first discovered snapshot info // nil, error: storage system internal error FindSnapshotByName(snapName string) (snapInfo *qcservice.Snapshot, err error) // CreateSnapshot creates a snapshot of specified volume. // Return: // snapshot id, nil: succeed to create snapshot. // nil, error: failed to create snapshot. CreateSnapshot(snapName string, volId string) (snapId string, err error) // DeleteSnapshot deletes a specified volume. // Return: // nil: succeed to delete snapshot. // error: failed to delete snapshot. DeleteSnapshot(snapId string) (err error) // CreateVolumeFromSnapshot creates volume from snapshot. // Return: // volume id, nil: succeed to create volume // nil, error: failed to create volume CreateVolumeFromSnapshot(volName string, snapId string, zone string) (volId string, err error) }
type UtilManager ¶
type UtilManager interface { // FindInstance finds and gets instance information by instance id. // Return: // nil, nil: instance does not exist // instance info, nil: found instance and return instance info // nil, error: storage system internal error FindInstance(instanceId string) (instanceInfo *qcservice.Instance, err error) // GetZone gets zone through QingCloud config GetZone() (zoneName string) // GetZoneList get accessible zone list GetZoneList() (zoneNameList []string, err error) // FindTags finds and gets tags information FindTag(tagId string) (tagInfo *qcservice.Tag, err error) // IsValidTags checks tags exists. IsValidTags(tagsId []string) bool // AttachTags add a slice of tags on a object AttachTags(tagsId []string, resourceId string, resourceType string) (err error) }
type VolumeManager ¶
type VolumeManager interface { // Volume Management // FindVolume finds and gets volume information by volume ID. // Return: // nil, nil: volume does not exist // volume, nil: found volume and return volume info // nil, error: storage system internal error FindVolume(volId string) (volInfo *qcservice.Volume, err error) // FindVolumeByName finds and gets volume information by its name. // It will filter volume in deleted and ceased status and return first discovered item. // Return: // nil, nil: volume does not exist // volume, nil: found volume and return first discovered volume info // nil, error: storage system internal error FindVolumeByName(volName string) (volInfo *qcservice.Volume, err error) // CreateVolume creates volume with specified name, size, replicas, type and zone and returns volume id. // Return: // volume id, nil: succeed to create volume and return volume id // nil, error: failed to create volume CreateVolume(volName string, requestSize int, replicas int, volType int, zone string, containerConfID string, rg string, placeGroupID string) (volId string, err error) // DeleteVolume deletes volume by id. // Return: // nil: succeed to delete volume // error: failed to delete volume DeleteVolume(volId string) (err error) // AttachVolume attaches volume on specified node. // Return: // nil: succeed to attach volume // error: failed to attach volume AttachVolume(volId string, instanceId string) (err error) // DetachVolume detaches volume from node. // Return: // nil: succeed to detach volume // error: failed to detach volume DetachVolume(volId string, instanceId string) (err error) // ResizeVolume expands volume to specified capacity. // Return: // nil: succeed to expand volume // error: failed to expand volume ResizeVolume(volId string, requestSize int) (err error) // CloneVolume clones a volume // Return: // volume id, nil: succeed to clone volume and return volume id // nil, error: failed to clone volume CloneVolume(volName string, volType int, srcVolId string, zone string) (volId string, err error) }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.