Skip to content

Commit

Permalink
Add disk cach/io tunables
Browse files Browse the repository at this point in the history
Often for test scenarios the reliability of the VM isn't important,
but running faster is, so lets expose a few more I/O tunables.
  • Loading branch information
Daniel Hiltgen committed May 17, 2016
1 parent 8d63cea commit a3882af
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions kvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const (
<readonly/>
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='raw' cache='{{.CacheMode}}' io='{{.IOMode}}' />
<source file='{{.DiskPath}}'/>
<target dev='hda' bus='ide'/>
</disk>
Expand Down Expand Up @@ -85,6 +86,8 @@ type Driver struct {
CaCertPath string
PrivateKeyPath string
DiskPath string
CacheMode string
IOMode string
connectionString string
conn *libvirt.VirConnection
VM *libvirt.VirDomain
Expand Down Expand Up @@ -120,6 +123,16 @@ func (d *Driver) GetCreateFlags() []mcnflag.Flag {
Usage: "The URL of the boot2docker image. Defaults to the latest available version",
Value: "",
},
mcnflag.StringFlag{
Name: "kvm-cache-mode",
Usage: "Disk cache mode: default, none, writethrough, writeback, directsync, or unsafe",
Value: "default",
},
mcnflag.StringFlag{
Name: "kvm-io-mode",
Usage: "Disk IO mode: threads, native",
Value: "threads",
},
/* Not yet implemented
mcnflag.Flag{
Name: "kvm-no-share",
Expand Down Expand Up @@ -168,6 +181,8 @@ func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
d.CPU = flags.Int("kvm-cpu-count")
d.Network = flags.String("kvm-network")
d.Boot2DockerURL = flags.String("kvm-boot2docker-url")
d.CacheMode = flags.String("kvm-cache-mode")
d.IOMode = flags.String("kvm-io-mode")

d.SwarmMaster = flags.Bool("swarm-master")
d.SwarmHost = flags.String("swarm-host")
Expand Down

0 comments on commit a3882af

Please sign in to comment.