Added comment on why we need to open /dev/kvm before using it

This commit is contained in:
Chris Bednarski 2016-05-19 22:53:53 -07:00
parent 0f638f9111
commit bff939b373
1 changed files with 4 additions and 0 deletions

View File

@ -154,6 +154,10 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
if runtime.GOOS == "windows" {
b.config.Accelerator = "tcg"
} else {
// /dev/kvm is a kernel module that may be loaded if kvm is
// installed and the host supports VT-x extensions. To make sure
// this will actually work we need to os.Open() it. If os.Open fails
// the kernel module was not installed or loaded correctly.
if fp, err := os.Open("/dev/kvm"); err != nil {
b.config.Accelerator = "tcg"
} else {