Documentation ¶
Index ¶
- Variables
- func Commit(ctx context.Context, sess *session.Session, h *Handle, waitTime *int32) error
- func Finalize(ctx context.Context) error
- func Init(ctx context.Context, sess *session.Session, source extraconfig.DataSource, ...) error
- func IsConcurrentAccessError(err error) bool
- func IsNotFoundError(err error) bool
- func NewContainerCache()
- func ReferenceFromHandle(handle interface{}) interface{}
- type ConcurrentAccessError
- type Configuration
- type Container
- func (c *Container) CurrentState() State
- func (c *Container) GetContainerVM() *vm.VirtualMachine
- func (c *Container) Info() *ContainerInfo
- func (c *Container) LogReader(op trace.Operation, tail int, follow bool, since int64) (io.ReadCloser, error)
- func (c *Container) NewHandle(ctx context.Context) *Handle
- func (c *Container) OnEvent(e events.Event)
- func (c *Container) Refresh(op trace.Operation) error
- func (c *Container) RefreshFromHandle(op trace.Operation, h *Handle)
- func (c *Container) ReloadConfig(op trace.Operation) error
- func (c *Container) Remove(op trace.Operation, sess *session.Session) error
- func (c *Container) SetState(op trace.Operation, s State) State
- func (c *Container) Signal(op trace.Operation, num int64) error
- func (c *Container) String() string
- func (c *Container) VMReference() types.ManagedObjectReference
- func (c *Container) WaitForExec(op trace.Operation, id string) error
- func (c *Container) WaitForSession(ctx context.Context, id string) error
- func (c *Container) WaitForState(s State) <-chan struct{}
- type ContainerCreateConfig
- type ContainerInfo
- func (c *ContainerInfo) GetContainerVM() *vm.VirtualMachine
- func (c *ContainerInfo) ReloadConfig(op trace.Operation) error
- func (c *ContainerInfo) State() State
- func (c *ContainerInfo) String() string
- func (c *ContainerInfo) VMReference() types.ManagedObjectReference
- func (c *ContainerInfo) WaitForExec(op trace.Operation, id string) error
- func (c *ContainerInfo) WaitForSession(ctx context.Context, id string) error
- type DevicesInUseError
- type Handle
- func (h *Handle) Close()
- func (h *Handle) Commit(op trace.Operation, sess *session.Session, waitTime *int32) error
- func (c *Handle) GetContainerVM() *vm.VirtualMachine
- func (h *Handle) Reload()
- func (c *Handle) ReloadConfig(op trace.Operation) error
- func (h *Handle) Rename(op trace.Operation, newName string) *Handle
- func (h *Handle) SetTargetState(s State)
- func (c *Handle) State(op trace.Operation) State
- func (h *Handle) String() string
- func (h *Handle) TargetState() State
- func (c *Handle) VMReference() types.ManagedObjectReference
- func (c *Handle) WaitForExec(op trace.Operation, id string) error
- func (c *Handle) WaitForSession(ctx context.Context, id string) error
- type NotFoundError
- type NotYetExistError
- type RemovePowerError
- type Resources
- type State
- type VCHStats
Constants ¶
This section is empty.
Variables ¶
var Containers *containerCache
Containers is an in-memory cache of containerVMs.
Functions ¶
func Init ¶
func Init(ctx context.Context, sess *session.Session, source extraconfig.DataSource, _ extraconfig.DataSink, self types.ManagedObjectReference) error
Init is the main initializaton function for the exec component. sess - active session object used for vmomi access source - source from which to deserialize component configuration sink - unused at this time but provided for symmetry with source self - a reference to the VM in which this logic is running
func IsConcurrentAccessError ¶
func IsNotFoundError ¶
func NewContainerCache ¶
func NewContainerCache()
func ReferenceFromHandle ¶
func ReferenceFromHandle(handle interface{}) interface{}
ReferenceFromHandle returns the reference of the given handle
Types ¶
type ConcurrentAccessError ¶
type ConcurrentAccessError struct {
// contains filtered or unexported fields
}
ConcurrentAccessError is returned when concurrent calls tries to modify same object
func (ConcurrentAccessError) Error ¶
func (r ConcurrentAccessError) Error() string
type Configuration ¶
type Configuration struct { // Turn on debug logging DebugLevel int `vic:"0.1" scope:"read-only" key:"init/diagnostics/debug"` SysLogConfig *executor.SysLogConfig `vic:"0.1" scope:"read-only" key:"init/diagnostics/syslog"` // Port Layer - exec config.Container `vic:"0.1" scope:"read-only" key:"container"` // Resource pool is the working version of the compute resource config ResourcePool *object.ResourcePool // Cluster is the working reference to the cluster the VCH is present in Cluster *object.ComputeResource // SelfReference is a reference to the endpointVM, added for VM group membership SelfReference types.ManagedObjectReference // Parent resource will be a VirtualApp on VC VirtualApp *object.VirtualApp // For now throw the Event Manager here EventManager event.EventManager // Information about the VCH resource pool and about the real host that we want // tol retrieve just once. VCHMhz int64 VCHMemoryLimit int64 HostOS string HostOSVersion string HostProductName string //'VMware vCenter Server' or 'VMare ESXi' // Datastore URLs for image stores - the top layer is [0], the bottom layer is [len-1] ImageStores []url.URL `vic:"0.1" scope:"read-only" key:"storage/image_stores"` // contains filtered or unexported fields }
Configuration is a slice of the VCH config that is relevant to the exec part of the port layer
var Config Configuration
type Container ¶
type Container struct { ContainerInfo // contains filtered or unexported fields }
Container is used for an entry in the container cache - this is a "live" representation of containers in the infrastructure. DANGEROUS USAGE CONSTRAINTS:
None of the containerBase fields should be partially updated - consider them immutable once they're part of a cache entry i.e. Do not make changes in containerBase.ExecConfig - only swap, under lock, the pointer for a completely new ExecConfig. This constraint allows us to avoid deep copying those structs every time a container is inspected
func (*Container) CurrentState ¶
CurrentState returns current state.
func (*Container) GetContainerVM ¶ added in v1.5.0
func (c *Container) GetContainerVM() *vm.VirtualMachine
func (*Container) Info ¶
func (c *Container) Info() *ContainerInfo
Info returns a copy of the public container configuration that is consistent and copied under lock
func (*Container) Refresh ¶
Refresh updates config and runtime info, holding a lock only while swapping the new data for the old
func (*Container) RefreshFromHandle ¶
RefreshFromHandle updates config and runtime info, holding a lock only while swapping the new data for the old
func (*Container) ReloadConfig ¶
func (*Container) VMReference ¶
func (c *Container) VMReference() types.ManagedObjectReference
VMReference will provide the vSphere vm managed object reference
func (*Container) WaitForExec ¶
WaitForExec waits exec'ed task to set started field or timeout
func (*Container) WaitForSession ¶
WaitForSession waits non-exec'ed task to set started field or timeout
func (*Container) WaitForState ¶
WaitForState subscribes a caller to an event returning a channel that will be closed when an expected state is set. If expected state is already set the caller will receive a closed channel immediately.
type ContainerCreateConfig ¶
type ContainerCreateConfig struct { Metadata *executor.ExecutorConfig Resources Resources }
ContainerCreateConfig defines the parameters for Create call
type ContainerInfo ¶
type ContainerInfo struct { MemorySizeMB int32 NumCPU int32 VMUnsharedDisk int64 // contains filtered or unexported fields }
Container is used to return data about a container during inspection calls It is a copy rather than a live reflection and does not require locking
func (*ContainerInfo) GetContainerVM ¶ added in v1.5.0
func (c *ContainerInfo) GetContainerVM() *vm.VirtualMachine
func (*ContainerInfo) ReloadConfig ¶
func (*ContainerInfo) State ¶
func (c *ContainerInfo) State() State
State returns the state at the time the ContainerInfo object was created
func (*ContainerInfo) String ¶
func (c *ContainerInfo) String() string
func (*ContainerInfo) VMReference ¶
func (c *ContainerInfo) VMReference() types.ManagedObjectReference
VMReference will provide the vSphere vm managed object reference
func (*ContainerInfo) WaitForExec ¶
WaitForExec waits exec'ed task to set started field or timeout
type DevicesInUseError ¶
type DevicesInUseError struct {
Devices []string
}
func (DevicesInUseError) Error ¶
func (e DevicesInUseError) Error() string
type Handle ¶
type Handle struct { // The guest used to generate specific device types Guest guest.Guest // desired spec Spec *spec.VirtualMachineConfigSpec // contains filtered or unexported fields }
func Create ¶
func Create(ctx context.Context, vmomiSession *session.Session, config *ContainerCreateConfig) (*Handle, error)
Create returns a new handle that can be Committed to create a new container. At this time the config is *not* deep copied so should not be changed once passed
TODO: either deep copy the configuration, or provide an alternative means of passing the data that avoids the need for the caller to unpack/repack the parameters
func HandleFromInterface ¶
func HandleFromInterface(key interface{}) *Handle
HandleFromInterface returns the Handle
func TestHandle ¶
Added solely to support testing - need a better way to do this
func (*Handle) GetContainerVM ¶ added in v1.5.0
func (c *Handle) GetContainerVM() *vm.VirtualMachine
func (*Handle) ReloadConfig ¶
func (*Handle) Rename ¶
Rename updates the container name in ExecConfig as well as the vSphere display name
func (*Handle) SetTargetState ¶
func (*Handle) State ¶
State returns the state of the containerVM based on data in the handle, with no refresh
func (*Handle) TargetState ¶
func (*Handle) VMReference ¶
func (c *Handle) VMReference() types.ManagedObjectReference
VMReference will provide the vSphere vm managed object reference
func (*Handle) WaitForExec ¶
WaitForExec waits exec'ed task to set started field or timeout
type NotFoundError ¶
type NotFoundError struct {
// contains filtered or unexported fields
}
NotFoundError is returned when a types.ManagedObjectNotFound is returned from a vmomi call
func (NotFoundError) Error ¶
func (r NotFoundError) Error() string
type NotYetExistError ¶
type NotYetExistError struct {
ID string
}
NotYetExistError is returned when a call that requires a VM exist is made
func (NotYetExistError) Error ¶
func (e NotYetExistError) Error() string
type RemovePowerError ¶
type RemovePowerError struct {
// contains filtered or unexported fields
}
RemovePowerError is returned when attempting to remove a containerVM that is powered on
func (RemovePowerError) Error ¶
func (r RemovePowerError) Error() string
type VCHStats ¶
type VCHStats struct { CPULimit int64 // resource pool CPU limit CPUUsage int64 // resource pool CPU usage in MhZ MemoryLimit int64 // resource pool Memory limit MemoryUsage int64 // resource pool Memory Usage }
func GetVCHstats ¶
func GetVCHstats(ctx context.Context, moref ...types.ManagedObjectReference) VCHStats