 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
- Variables
- func EngineInstallURLFlagSet(flags DriverOptions) bool
- func EngineInstallURLSet(url string) bool
- func GetSSHClientFromDriver(d Driver) (ssh.Client, error)
- func MachineInState(d Driver, desiredState state.State) func() bool
- func MustBeRunning(d Driver) error
- func RunSSHCommandFromDriver(d Driver, command string) (string, error)
- func WaitForSSH(d Driver) error
- type BaseDriver
- func (d *BaseDriver) DriverName() string
- func (d *BaseDriver) GetIP() (string, error)
- func (d *BaseDriver) GetMachineName() string
- func (d *BaseDriver) GetSSHKeyPath() string
- func (d *BaseDriver) GetSSHPort() (int, error)
- func (d *BaseDriver) GetSSHUsername() string
- func (d *BaseDriver) PreCreateCheck() error
- func (d *BaseDriver) ResolveStorePath(file string) string
- func (d *BaseDriver) SetSwarmConfigFromFlags(flags DriverOptions)
 
- type CheckDriverOptions
- type Driver
- type DriverNotSupported
- func (d *DriverNotSupported) Create() error
- func (d *DriverNotSupported) DriverName() string
- func (d *DriverNotSupported) GetCreateFlags() []mcnflag.Flag
- func (d *DriverNotSupported) GetSSHHostname() (string, error)
- func (d *DriverNotSupported) GetState() (state.State, error)
- func (d *DriverNotSupported) GetURL() (string, error)
- func (d *DriverNotSupported) Kill() error
- func (d *DriverNotSupported) PreCreateCheck() error
- func (d *DriverNotSupported) Remove() error
- func (d *DriverNotSupported) Restart() error
- func (d *DriverNotSupported) SetConfigFromFlags(flags DriverOptions) error
- func (d *DriverNotSupported) Start() error
- func (d *DriverNotSupported) Stop() error
- func (d *DriverNotSupported) Upgrade() error
 
- type DriverOptions
- type NotSupported
- type SerialDriver
- func (d *SerialDriver) Create() error
- func (d *SerialDriver) DriverName() string
- func (d *SerialDriver) GetCreateFlags() []mcnflag.Flag
- func (d *SerialDriver) GetIP() (string, error)
- func (d *SerialDriver) GetMachineName() string
- func (d *SerialDriver) GetSSHHostname() (string, error)
- func (d *SerialDriver) GetSSHKeyPath() string
- func (d *SerialDriver) GetSSHPort() (int, error)
- func (d *SerialDriver) GetSSHUsername() string
- func (d *SerialDriver) GetState() (state.State, error)
- func (d *SerialDriver) GetURL() (string, error)
- func (d *SerialDriver) Kill() error
- func (d *SerialDriver) MarshalJSON() ([]byte, error)
- func (d *SerialDriver) PreCreateCheck() error
- func (d *SerialDriver) Remove() error
- func (d *SerialDriver) Restart() error
- func (d *SerialDriver) SetConfigFromFlags(opts DriverOptions) error
- func (d *SerialDriver) Start() error
- func (d *SerialDriver) Stop() error
 
Constants ¶
const ( DefaultSSHUser = "root" DefaultSSHPort = 22 DefaultEngineInstallURL = "https://get.docker.com" )
Variables ¶
var ErrHostIsNotRunning = errors.New("Host is not running")
    Functions ¶
func EngineInstallURLFlagSet ¶ added in v0.6.0
func EngineInstallURLFlagSet(flags DriverOptions) bool
func EngineInstallURLSet ¶ added in v0.12.0
func MustBeRunning ¶ added in v0.7.0
MustBeRunning will return an error if the machine is not in a running state.
func RunSSHCommandFromDriver ¶
func WaitForSSH ¶
Types ¶
type BaseDriver ¶
type BaseDriver struct {
	IPAddress      string
	MachineName    string
	SSHUser        string
	SSHPort        int
	SSHKeyPath     string
	StorePath      string
	SwarmMaster    bool
	SwarmHost      string
	SwarmDiscovery string
}
    BaseDriver - Embed this struct into drivers to provide the common set of fields and functions.
func (*BaseDriver) DriverName ¶
func (d *BaseDriver) DriverName() string
DriverName returns the name of the driver
func (*BaseDriver) GetIP ¶ added in v0.5.1
func (d *BaseDriver) GetIP() (string, error)
GetIP returns the ip
func (*BaseDriver) GetMachineName ¶
func (d *BaseDriver) GetMachineName() string
GetMachineName returns the machine name
func (*BaseDriver) GetSSHKeyPath ¶
func (d *BaseDriver) GetSSHKeyPath() string
GetSSHKeyPath returns the ssh key path
func (*BaseDriver) GetSSHPort ¶
func (d *BaseDriver) GetSSHPort() (int, error)
GetSSHPort returns the ssh port, 22 if not specified
func (*BaseDriver) GetSSHUsername ¶
func (d *BaseDriver) GetSSHUsername() string
GetSSHUsername returns the ssh user name, root if not specified
func (*BaseDriver) PreCreateCheck ¶
func (d *BaseDriver) PreCreateCheck() error
PreCreateCheck is called to enforce pre-creation steps
func (*BaseDriver) ResolveStorePath ¶
func (d *BaseDriver) ResolveStorePath(file string) string
ResolveStorePath returns the store path where the machine is
func (*BaseDriver) SetSwarmConfigFromFlags ¶ added in v0.5.6
func (d *BaseDriver) SetSwarmConfigFromFlags(flags DriverOptions)
SetSwarmConfigFromFlags configures the driver for swarm
type CheckDriverOptions ¶ added in v0.5.1
type CheckDriverOptions struct {
	FlagsValues  map[string]interface{}
	CreateFlags  []mcnflag.Flag
	InvalidFlags []string
}
    CheckDriverOptions implements DriverOptions and is used to validate flag parsing
func (*CheckDriverOptions) Bool ¶ added in v0.5.1
func (o *CheckDriverOptions) Bool(key string) bool
func (*CheckDriverOptions) Int ¶ added in v0.5.1
func (o *CheckDriverOptions) Int(key string) int
func (*CheckDriverOptions) String ¶ added in v0.5.1
func (o *CheckDriverOptions) String(key string) string
func (*CheckDriverOptions) StringSlice ¶ added in v0.5.1
func (o *CheckDriverOptions) StringSlice(key string) []string
type Driver ¶
type Driver interface {
	// Create a host using the driver's config
	Create() error
	// DriverName returns the name of the driver
	DriverName() string
	// GetCreateFlags returns the mcnflag.Flag slice representing the flags
	// that can be set, their descriptions and defaults.
	GetCreateFlags() []mcnflag.Flag
	// GetIP returns an IP or hostname that this host is available at
	// e.g. 1.2.3.4 or docker-host-d60b70a14d3a.cloudapp.net
	GetIP() (string, error)
	// GetMachineName returns the name of the machine
	GetMachineName() string
	// GetSSHHostname returns hostname for use with ssh
	GetSSHHostname() (string, error)
	// GetSSHKeyPath returns key path for use with ssh
	GetSSHKeyPath() string
	// GetSSHPort returns port for use with ssh
	GetSSHPort() (int, error)
	// GetSSHUsername returns username for use with ssh
	GetSSHUsername() string
	// GetURL returns a Docker compatible host URL for connecting to this host
	// e.g. tcp://1.2.3.4:2376
	GetURL() (string, error)
	// GetState returns the state that the host is in (running, stopped, etc)
	GetState() (state.State, error)
	// Kill stops a host forcefully
	Kill() error
	// PreCreateCheck allows for pre-create operations to make sure a driver is ready for creation
	PreCreateCheck() error
	// Remove a host
	Remove() error
	// Restart a host. This may just call Stop(); Start() if the provider does not
	// have any special restart behaviour.
	Restart() error
	// SetConfigFromFlags configures the driver with the object that was returned
	// by RegisterCreateFlags
	SetConfigFromFlags(opts DriverOptions) error
	// Start a host
	Start() error
	// Stop a host gracefully
	Stop() error
}
    Driver defines how a host is created and controlled. Different types of driver represent different ways hosts can be created (e.g. different hypervisors, different cloud providers)
func NewDriverNotSupported ¶ added in v0.5.3
NewDriverNotSupported creates a placeholder Driver that replaces a driver that is not supported on a given platform. eg fusion on linux.
func NewSerialDriver ¶ added in v0.5.1
type DriverNotSupported ¶ added in v0.5.3
type DriverNotSupported struct {
	*BaseDriver
	Name string
}
    func (*DriverNotSupported) Create ¶ added in v0.5.3
func (d *DriverNotSupported) Create() error
func (*DriverNotSupported) DriverName ¶ added in v0.5.3
func (d *DriverNotSupported) DriverName() string
func (*DriverNotSupported) GetCreateFlags ¶ added in v0.5.3
func (d *DriverNotSupported) GetCreateFlags() []mcnflag.Flag
func (*DriverNotSupported) GetSSHHostname ¶ added in v0.5.3
func (d *DriverNotSupported) GetSSHHostname() (string, error)
func (*DriverNotSupported) GetState ¶ added in v0.5.3
func (d *DriverNotSupported) GetState() (state.State, error)
func (*DriverNotSupported) GetURL ¶ added in v0.5.3
func (d *DriverNotSupported) GetURL() (string, error)
func (*DriverNotSupported) Kill ¶ added in v0.5.3
func (d *DriverNotSupported) Kill() error
func (*DriverNotSupported) PreCreateCheck ¶ added in v0.5.3
func (d *DriverNotSupported) PreCreateCheck() error
func (*DriverNotSupported) Remove ¶ added in v0.5.3
func (d *DriverNotSupported) Remove() error
func (*DriverNotSupported) Restart ¶ added in v0.5.3
func (d *DriverNotSupported) Restart() error
func (*DriverNotSupported) SetConfigFromFlags ¶ added in v0.5.3
func (d *DriverNotSupported) SetConfigFromFlags(flags DriverOptions) error
func (*DriverNotSupported) Start ¶ added in v0.5.3
func (d *DriverNotSupported) Start() error
func (*DriverNotSupported) Stop ¶ added in v0.5.3
func (d *DriverNotSupported) Stop() error
func (*DriverNotSupported) Upgrade ¶ added in v0.5.3
func (d *DriverNotSupported) Upgrade() error
type DriverOptions ¶
type NotSupported ¶ added in v0.5.3
type NotSupported struct {
	DriverName string
}
    func (NotSupported) Error ¶ added in v0.5.3
func (e NotSupported) Error() string
type SerialDriver ¶ added in v0.5.1
SerialDriver is a wrapper struct which is used to ensure that RPC calls to a driver only occur one at a time. Some providers, e.g. virtualbox, should not run driver operations at the same time as other driver instances of the same type. Otherwise, we scrape up against VirtualBox's own locking mechanisms.
It would be preferable to simply have a lock around, say, the VBoxManage command, but with our current one-server-process-per-machine model it is impossible to dictate this locking on the server side.
func (*SerialDriver) Create ¶ added in v0.5.1
func (d *SerialDriver) Create() error
Create a host using the driver's config
func (*SerialDriver) DriverName ¶ added in v0.5.1
func (d *SerialDriver) DriverName() string
DriverName returns the name of the driver as it is registered
func (*SerialDriver) GetCreateFlags ¶ added in v0.5.1
func (d *SerialDriver) GetCreateFlags() []mcnflag.Flag
GetCreateFlags returns the mcnflag.Flag slice representing the flags that can be set, their descriptions and defaults.
func (*SerialDriver) GetIP ¶ added in v0.5.1
func (d *SerialDriver) GetIP() (string, error)
GetIP returns an IP or hostname that this host is available at e.g. 1.2.3.4 or docker-host-d60b70a14d3a.cloudapp.net
func (*SerialDriver) GetMachineName ¶ added in v0.5.1
func (d *SerialDriver) GetMachineName() string
GetMachineName returns the name of the machine
func (*SerialDriver) GetSSHHostname ¶ added in v0.5.1
func (d *SerialDriver) GetSSHHostname() (string, error)
GetSSHHostname returns hostname for use with ssh
func (*SerialDriver) GetSSHKeyPath ¶ added in v0.5.1
func (d *SerialDriver) GetSSHKeyPath() string
GetSSHKeyPath returns key path for use with ssh
func (*SerialDriver) GetSSHPort ¶ added in v0.5.1
func (d *SerialDriver) GetSSHPort() (int, error)
GetSSHPort returns port for use with ssh
func (*SerialDriver) GetSSHUsername ¶ added in v0.5.1
func (d *SerialDriver) GetSSHUsername() string
GetSSHUsername returns username for use with ssh
func (*SerialDriver) GetState ¶ added in v0.5.1
func (d *SerialDriver) GetState() (state.State, error)
GetState returns the state that the host is in (running, stopped, etc)
func (*SerialDriver) GetURL ¶ added in v0.5.1
func (d *SerialDriver) GetURL() (string, error)
GetURL returns a Docker compatible host URL for connecting to this host e.g. tcp://1.2.3.4:2376
func (*SerialDriver) Kill ¶ added in v0.5.1
func (d *SerialDriver) Kill() error
Kill stops a host forcefully
func (*SerialDriver) MarshalJSON ¶ added in v0.5.2
func (d *SerialDriver) MarshalJSON() ([]byte, error)
func (*SerialDriver) PreCreateCheck ¶ added in v0.5.1
func (d *SerialDriver) PreCreateCheck() error
PreCreateCheck allows for pre-create operations to make sure a driver is ready for creation
func (*SerialDriver) Restart ¶ added in v0.5.1
func (d *SerialDriver) Restart() error
Restart a host. This may just call Stop(); Start() if the provider does not have any special restart behaviour.
func (*SerialDriver) SetConfigFromFlags ¶ added in v0.5.1
func (d *SerialDriver) SetConfigFromFlags(opts DriverOptions) error
SetConfigFromFlags configures the driver with the object that was returned by RegisterCreateFlags
func (*SerialDriver) Stop ¶ added in v0.5.1
func (d *SerialDriver) Stop() error
Stop a host gracefully