kvm

package module
v0.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2017 License: Apache-2.0 Imports: 20 Imported by: 0

README

docker-machine-kvm

KVM driver for docker-machine

This driver leverages the new plugin architecture being developed for Docker Machine.

Quick start instructions

  • Install libvirt and qemu-kvm on your system (e.g., sudo apt-get install libvirt-bin qemu-kvm)
    • Add yourself to the libvirtd group (may vary by linux distro) so you don't need to sudo
  • Install docker-machine
  • Go to the releases page and download the docker-machine-driver-kvm binary, putting it in your PATH.
  • You can now create virtual machines using this driver with docker-machine create -d kvm myengine0.

Dependencies

This driver leverages libvirt and the libvirt-go library to create and manage KVM based virtual machines. It has been tested with Ubuntu 12.04 through 15.04 and should work on most platforms with KVM/libvirt support. If you run into compatibility problems, please file an issue.

Typically you'll run docker-machine as yourself, so you'll want to follow your distro specific instructions on allowing libvirt access from your account. For most distro's, you accomplish this by adding your account to the libvirtd group.

Capabilities

Images

By default docker-machine-kvm uses a boot2docker.iso as guest os for the kvm hypervisior. It's also possible to use every guest os image that is derived from boot2docker.iso as well. For using another image use the --kvm-boot2docker-url parameter.

Community Members did some tests and it works with rancher/os as guest os too.

Dual Network

  • eth1 - A host private network called docker-machines is automatically created to ensure we always have connectivity to the VMs. The docker-machine ip command will always return this IP address which is only accessible from your local system.
  • eth0 - You can specify any libvirt named network. If you don't specify one, the "default" named network will be used.
    • If you have exotic networking topolgies (openvswitch, etc.), you can use virsh edit mymachinename after creation, modify the first network definition by hand, then reboot the VM for the changes to take effect.
    • Typically this would be your "public" network accessible from external systems
    • To retrieve the IP address of this network, you can run a command like the following:
    docker-machine ssh mymachinename "ip -one -4 addr show dev eth0|cut -f7 -d' '"
    

Driver Parameters

Here are all currently driver parameters listed that you can use.

Parameter Description
--kvm-cpu-count Sets the used CPU Cores for the KVM Machine. Defaults to 1 .
--kvm-disk-size Sets the kvm machine Disk size in MB. Defaults to 20000 .
--kvm-memory Sets the Memory of the kvm machine in MB. Defaults to 1024.
--kvm-network Sets the Network of the kvm machinee which it should connect to. Defaults to default.
--kvm-boot2docker-url Sets the url from which host the image is loaded. By default it's not set.
--kvm-cache-mode Sets the caching mode of the kvm machine. Defaults to default.
--kvm-io-mode-url Sets the disk io mode of the kvm machine. Defaults to threads.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDriver

func NewDriver(hostName, storePath string) drivers.Driver

Types

type Driver

type Driver struct {
	*drivers.BaseDriver

	Memory         int
	DiskSize       int
	CPU            int
	Network        string
	PrivateNetwork string
	ISO            string
	Boot2DockerURL string
	CaCertPath     string
	PrivateKeyPath string
	DiskPath       string
	CacheMode      string
	IOMode         string

	VM *libvirt.Domain
	// contains filtered or unexported fields
}

func (*Driver) Create

func (d *Driver) Create() error

func (*Driver) DriverName

func (d *Driver) DriverName() string

func (*Driver) GetCreateFlags

func (d *Driver) GetCreateFlags() []mcnflag.Flag

func (*Driver) GetIP

func (d *Driver) GetIP() (string, error)

func (*Driver) GetMachineName

func (d *Driver) GetMachineName() string

func (*Driver) GetSSHHostname

func (d *Driver) GetSSHHostname() (string, error)

func (*Driver) GetSSHKeyPath

func (d *Driver) GetSSHKeyPath() string

func (*Driver) GetSSHPort

func (d *Driver) GetSSHPort() (int, error)

func (*Driver) GetSSHUsername

func (d *Driver) GetSSHUsername() string

func (*Driver) GetState

func (d *Driver) GetState() (state.State, error)

func (*Driver) GetURL

func (d *Driver) GetURL() (string, error)

func (*Driver) Kill

func (d *Driver) Kill() error

func (*Driver) PreCreateCheck

func (d *Driver) PreCreateCheck() error

func (*Driver) Remove

func (d *Driver) Remove() error

func (*Driver) Restart

func (d *Driver) Restart() error

func (*Driver) SetConfigFromFlags

func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error

func (*Driver) Start

func (d *Driver) Start() error

func (*Driver) Stop

func (d *Driver) Stop() error

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL