Documentation ¶
Index ¶
- Constants
- Variables
- type CreateVolumeOptions
- type Info
- type LoopServer
- func (s *LoopServer) AddNetworkInterface()
- func (s *LoopServer) AssignStaticIP(ctx context.Context, networkInterfaceID string, staticIP string) error
- func (s *LoopServer) AttachVolume(ctx context.Context, volID string, instanceID string, devName string) error
- func (s *LoopServer) CreateVolume(ctx context.Context, opts *CreateVolumeOptions) (volID string, err error)
- func (s *LoopServer) DeleteVolume(ctx context.Context, volID string) error
- func (s *LoopServer) DetachVolume(ctx context.Context, volID string, instanceID string, devName string) error
- func (s *LoopServer) GetCidrBlock() (cidrPrefix string, cidrIP string, cidrBlock string, cidrIPNet string)
- func (s *LoopServer) GetControlDBDeviceName() string
- func (s *LoopServer) GetFirstDeviceName() string
- func (s *LoopServer) GetInstanceNetworkInterface(ctx context.Context, instanceID string) (netInterface *NetworkInterface, err error)
- func (s *LoopServer) GetNetworkInterfaces(ctx context.Context, cluster string, vpcID string, zone string) (netInterfaces []*NetworkInterface, cidrBlock string, err error)
- func (s *LoopServer) GetNextDeviceName(lastDev string) (devName string, err error)
- func (s *LoopServer) GetVolumeInfo(ctx context.Context, volID string) (info VolumeInfo, err error)
- func (s *LoopServer) GetVolumeState(ctx context.Context, volID string) (state string, err error)
- func (s *LoopServer) UnassignStaticIP(ctx context.Context, networkInterfaceID string, staticIP string) error
- func (s *LoopServer) WaitVolumeAttached(ctx context.Context, volID string) error
- func (s *LoopServer) WaitVolumeCreated(ctx context.Context, volID string) error
- func (s *LoopServer) WaitVolumeDetached(ctx context.Context, volID string) error
- type MemServer
- func (s *MemServer) AssignStaticIP(ctx context.Context, networkInterfaceID string, staticIP string) error
- func (s *MemServer) AttachVolume(ctx context.Context, volID string, instanceID string, devName string) error
- func (s *MemServer) CreateVolume(ctx context.Context, opts *CreateVolumeOptions) (volID string, err error)
- func (s *MemServer) DeleteVolume(ctx context.Context, volID string) error
- func (s *MemServer) DetachVolume(ctx context.Context, volID string, instanceID string, devName string) error
- func (s *MemServer) GetControlDBDeviceName() string
- func (s *MemServer) GetFirstDeviceName() string
- func (s *MemServer) GetInstanceNetworkInterface(ctx context.Context, instanceID string) (netInterface *NetworkInterface, err error)
- func (s *MemServer) GetNetworkInterfaces(ctx context.Context, cluster string, vpcID string, zone string) (netInterfaces []*NetworkInterface, cidrBlock string, err error)
- func (s *MemServer) GetNextDeviceName(lastDev string) (devName string, err error)
- func (s *MemServer) GetVolumeInfo(ctx context.Context, volID string) (info VolumeInfo, err error)
- func (s *MemServer) GetVolumeState(ctx context.Context, volID string) (state string, err error)
- func (s *MemServer) UnassignStaticIP(ctx context.Context, networkInterfaceID string, staticIP string) error
- func (s *MemServer) WaitVolumeAttached(ctx context.Context, volID string) error
- func (s *MemServer) WaitVolumeCreated(ctx context.Context, volID string) error
- func (s *MemServer) WaitVolumeDetached(ctx context.Context, volID string) error
- type MockServerInfo
- func (m *MockServerInfo) GetLocalAvailabilityZone() string
- func (m *MockServerInfo) GetLocalInstanceID() string
- func (m *MockServerInfo) GetLocalRegion() string
- func (m *MockServerInfo) GetLocalRegionAZs() []string
- func (m *MockServerInfo) GetLocalVpcID() string
- func (m *MockServerInfo) GetPrivateIP() string
- type NetworkInterface
- type Server
- type VolumeInfo
Constants ¶
View Source
const ( LoopFileDir = "/tmp/" LoopDevPrefix = "/dev/loop" )
View Source
const ( VolumeStateCreating = "creating" VolumeStateAvailable = "available" VolumeStateInUse = "in-use" VolumeStateDetaching = "detaching" VolumeStateAttaching = "attaching" VolumeStateDeleting = "deleting" VolumeStateDeleted = "deleted" VolumeStateError = "error" )
http://docs.aws.amazon.com/cli/latest/reference/ec2/describe-volumes.html EBS volume has 2 states, The status of the volume (creating | available | in-use | deleting | deleted | error). The attachment state (attaching | attached | detaching | detached). The attachment state would be returned when volume status is in-use. Q: when will the attachment state be detached? After detached, volume status should be available.
Variables ¶
View Source
var ( ErrVolumeIncorrectState = errors.New("IncorrectState") ErrVolumeInUse = errors.New("VolumeInUse") )
Functions ¶
This section is empty.
Types ¶
type CreateVolumeOptions ¶ added in v0.9.1
type CreateVolumeOptions struct { AvailabilityZone string VolumeType string Iops int64 VolumeSizeGB int64 Encrypted bool TagSpecs []common.KeyValuePair }
CreateVolumeOptions includes the creation parameters for the volume.
type Info ¶
type Info interface { GetPrivateIP() string GetLocalAvailabilityZone() string GetLocalRegion() string GetLocalInstanceID() string GetLocalVpcID() string GetLocalRegionAZs() []string }
Info defines the operations for the local server related info
type LoopServer ¶
type LoopServer struct {
// contains filtered or unexported fields
}
func NewLoopServer ¶
func NewLoopServer() *LoopServer
func (*LoopServer) AddNetworkInterface ¶ added in v0.8.1
func (s *LoopServer) AddNetworkInterface()
func (*LoopServer) AssignStaticIP ¶ added in v0.8.1
func (*LoopServer) AttachVolume ¶
func (*LoopServer) CreateVolume ¶
func (s *LoopServer) CreateVolume(ctx context.Context, opts *CreateVolumeOptions) (volID string, err error)
func (*LoopServer) DeleteVolume ¶
func (s *LoopServer) DeleteVolume(ctx context.Context, volID string) error
func (*LoopServer) DetachVolume ¶
func (*LoopServer) GetCidrBlock ¶ added in v0.8.1
func (s *LoopServer) GetCidrBlock() (cidrPrefix string, cidrIP string, cidrBlock string, cidrIPNet string)
func (*LoopServer) GetControlDBDeviceName ¶
func (s *LoopServer) GetControlDBDeviceName() string
func (*LoopServer) GetFirstDeviceName ¶
func (s *LoopServer) GetFirstDeviceName() string
func (*LoopServer) GetInstanceNetworkInterface ¶ added in v0.8.1
func (s *LoopServer) GetInstanceNetworkInterface(ctx context.Context, instanceID string) (netInterface *NetworkInterface, err error)
func (*LoopServer) GetNetworkInterfaces ¶ added in v0.8.1
func (s *LoopServer) GetNetworkInterfaces(ctx context.Context, cluster string, vpcID string, zone string) (netInterfaces []*NetworkInterface, cidrBlock string, err error)
func (*LoopServer) GetNextDeviceName ¶
func (s *LoopServer) GetNextDeviceName(lastDev string) (devName string, err error)
func (*LoopServer) GetVolumeInfo ¶
func (s *LoopServer) GetVolumeInfo(ctx context.Context, volID string) (info VolumeInfo, err error)
func (*LoopServer) GetVolumeState ¶
func (*LoopServer) UnassignStaticIP ¶ added in v0.8.1
func (*LoopServer) WaitVolumeAttached ¶
func (s *LoopServer) WaitVolumeAttached(ctx context.Context, volID string) error
func (*LoopServer) WaitVolumeCreated ¶
func (s *LoopServer) WaitVolumeCreated(ctx context.Context, volID string) error
func (*LoopServer) WaitVolumeDetached ¶
func (s *LoopServer) WaitVolumeDetached(ctx context.Context, volID string) error
type MemServer ¶
type MemServer struct {
// contains filtered or unexported fields
}
func NewMemServer ¶
func NewMemServer() *MemServer
func (*MemServer) AssignStaticIP ¶ added in v0.8.1
func (*MemServer) AttachVolume ¶
func (*MemServer) CreateVolume ¶
func (*MemServer) DeleteVolume ¶
func (*MemServer) DetachVolume ¶
func (*MemServer) GetControlDBDeviceName ¶
func (*MemServer) GetFirstDeviceName ¶
func (*MemServer) GetInstanceNetworkInterface ¶ added in v0.8.1
func (*MemServer) GetNetworkInterfaces ¶ added in v0.8.1
func (*MemServer) GetNextDeviceName ¶
func (*MemServer) GetVolumeInfo ¶
func (*MemServer) GetVolumeState ¶
func (*MemServer) UnassignStaticIP ¶ added in v0.8.1
func (*MemServer) WaitVolumeAttached ¶
func (*MemServer) WaitVolumeCreated ¶
type MockServerInfo ¶
type MockServerInfo struct { }
func NewMockServerInfo ¶
func NewMockServerInfo() *MockServerInfo
func (*MockServerInfo) GetLocalAvailabilityZone ¶
func (m *MockServerInfo) GetLocalAvailabilityZone() string
func (*MockServerInfo) GetLocalInstanceID ¶
func (m *MockServerInfo) GetLocalInstanceID() string
func (*MockServerInfo) GetLocalRegion ¶
func (m *MockServerInfo) GetLocalRegion() string
func (*MockServerInfo) GetLocalRegionAZs ¶
func (m *MockServerInfo) GetLocalRegionAZs() []string
func (*MockServerInfo) GetLocalVpcID ¶
func (m *MockServerInfo) GetLocalVpcID() string
func (*MockServerInfo) GetPrivateIP ¶
func (m *MockServerInfo) GetPrivateIP() string
type NetworkInterface ¶ added in v0.8.1
type Server ¶
type Server interface { AttachVolume(ctx context.Context, volID string, instanceID string, devName string) error WaitVolumeAttached(ctx context.Context, volID string) error GetVolumeState(ctx context.Context, volID string) (state string, err error) GetVolumeInfo(ctx context.Context, volID string) (info VolumeInfo, err error) DetachVolume(ctx context.Context, volID string, instanceID string, devName string) error WaitVolumeDetached(ctx context.Context, volID string) error CreateVolume(ctx context.Context, opts *CreateVolumeOptions) (volID string, err error) WaitVolumeCreated(ctx context.Context, volID string) error DeleteVolume(ctx context.Context, volID string) error GetControlDBDeviceName() string GetFirstDeviceName() string GetNextDeviceName(lastDev string) (devName string, err error) // GetNetworkInterfaces returns the network interfaces in the firecamp cluster, vpc and zone, // and the secondary IPs of the network interfaces. // Every instance in the firecamp cluster will have the specific cluster tag, as we don't want // to get the application servers run on the same vpc and zone. GetNetworkInterfaces(ctx context.Context, cluster string, vpcID string, zone string) (netInterfaces []*NetworkInterface, cidrBlock string, err error) // The firecamp cluster instance has only one network interface. GetInstanceNetworkInterface(ctx context.Context, instanceID string) (netInterface *NetworkInterface, err error) AssignStaticIP(ctx context.Context, networkInterfaceID string, staticIP string) error // UnassignStaticIP unassigns the staticIP from the networkInterface. If the networkInterface does not // own the ip, should return success. UnassignStaticIP(ctx context.Context, networkInterfaceID string, staticIP string) error }
Server defines the volume and device related operations for one host such as EC2
Click to show internal directories.
Click to hide internal directories.