Added comment on why we need to open /dev/kvm before using it
This commit is contained in:
parent
0f638f9111
commit
bff939b373
|
@ -154,6 +154,10 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
|
||||||
if runtime.GOOS == "windows" {
|
if runtime.GOOS == "windows" {
|
||||||
b.config.Accelerator = "tcg"
|
b.config.Accelerator = "tcg"
|
||||||
} else {
|
} 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 {
|
if fp, err := os.Open("/dev/kvm"); err != nil {
|
||||||
b.config.Accelerator = "tcg"
|
b.config.Accelerator = "tcg"
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue