diff --git a/builder/virtualbox/driver.go b/builder/virtualbox/driver.go index b6abd3473..5c131da7f 100644 --- a/builder/virtualbox/driver.go +++ b/builder/virtualbox/driver.go @@ -1,9 +1,11 @@ package virtualbox import ( + "bytes" "fmt" "log" "os/exec" + "strings" "time" ) @@ -46,13 +48,18 @@ func (d *VBox42Driver) SuppressMessages() error { } func (d *VBox42Driver) VBoxManage(args ...string) error { + var stdout, stderr bytes.Buffer + log.Printf("Executing VBoxManage: %#v", args) cmd := exec.Command(d.VBoxManagePath, args...) - if err := cmd.Run(); err != nil { - return err - } + cmd.Stdout = &stdout + cmd.Stderr = &stderr + err := cmd.Run() - return nil + log.Printf("stdout: %s", strings.TrimSpace(stdout.String())) + log.Printf("stderr: %s", strings.TrimSpace(stderr.String())) + + return err } func (d *VBox42Driver) Verify() error { diff --git a/builder/virtualbox/step_create_disk.go b/builder/virtualbox/step_create_disk.go index 4e97dbd13..90545fb0a 100644 --- a/builder/virtualbox/step_create_disk.go +++ b/builder/virtualbox/step_create_disk.go @@ -27,7 +27,7 @@ func (s *stepCreateDisk) Run(state map[string]interface{}) multistep.StepAction command := []string{ "createhd", "--filename", path, - "--size", "40", + "--size", "40000", "--format", format, "--variant", "Standard", } @@ -52,7 +52,7 @@ func (s *stepCreateDisk) Run(state map[string]interface{}) multistep.StepAction // Attach the disk to the controller command = []string{ - "storagectl", vmName, + "storageattach", vmName, "--storagectl", controllerName, "--port", "0", "--device", "0",