Move VT-X check to PreCreateCheck

Signed-off-by: David Gageot <david@gageot.net>
This commit is contained in:
David Gageot 2015-11-19 11:04:55 +01:00
parent b586b94b13
commit 79563b1972
1 changed files with 13 additions and 9 deletions

View File

@ -184,7 +184,19 @@ func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
// PreCreateCheck checks that VBoxManage exists and works
func (d *Driver) PreCreateCheck() error {
// Check that VBoxManage exists and works
return d.vbm()
if err := d.vbm(); err != nil {
return err
}
if d.IsVTXDisabled() {
// Let's log a warning to warn the user. When the vm is started, logs
// will be checked for an error anyway.
// We could fail right here but the method to check didn't prove being
// bulletproof.
log.Warn("This computer doesn't have VT-X/AMD-v enabled. Enabling it in the BIOS is mandatory.")
}
return nil
}
// IsVTXDisabledInTheVM checks if VT-X is disabled in the started vm.
@ -218,14 +230,6 @@ func (d *Driver) Create() error {
return err
}
if d.IsVTXDisabled() {
// Let's log a warning to warn the user. When the vm is started, logs
// will be checked for an error anyway.
// We could fail right here but the method to check didn't prove being
// bulletproof.
log.Warn("This computer doesn't have VT-X/AMD-v enabled. Enabling it in the BIOS is mandatory.")
}
log.Infof("Creating VirtualBox VM...")
// import b2d VM if requested