Commit c1c9204e authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

builder/virtualbox: actually attach the hard drive

parent 7a9499e1
package virtualbox package virtualbox
import ( import (
"bytes"
"fmt" "fmt"
"log" "log"
"os/exec" "os/exec"
"strings"
"time" "time"
) )
...@@ -46,13 +48,18 @@ func (d *VBox42Driver) SuppressMessages() error { ...@@ -46,13 +48,18 @@ func (d *VBox42Driver) SuppressMessages() error {
} }
func (d *VBox42Driver) VBoxManage(args ...string) error { func (d *VBox42Driver) VBoxManage(args ...string) error {
var stdout, stderr bytes.Buffer
log.Printf("Executing VBoxManage: %#v", args) log.Printf("Executing VBoxManage: %#v", args)
cmd := exec.Command(d.VBoxManagePath, args...) cmd := exec.Command(d.VBoxManagePath, args...)
if err := cmd.Run(); err != nil { cmd.Stdout = &stdout
return err 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 { func (d *VBox42Driver) Verify() error {
......
...@@ -27,7 +27,7 @@ func (s *stepCreateDisk) Run(state map[string]interface{}) multistep.StepAction ...@@ -27,7 +27,7 @@ func (s *stepCreateDisk) Run(state map[string]interface{}) multistep.StepAction
command := []string{ command := []string{
"createhd", "createhd",
"--filename", path, "--filename", path,
"--size", "40", "--size", "40000",
"--format", format, "--format", format,
"--variant", "Standard", "--variant", "Standard",
} }
...@@ -52,7 +52,7 @@ func (s *stepCreateDisk) Run(state map[string]interface{}) multistep.StepAction ...@@ -52,7 +52,7 @@ func (s *stepCreateDisk) Run(state map[string]interface{}) multistep.StepAction
// Attach the disk to the controller // Attach the disk to the controller
command = []string{ command = []string{
"storagectl", vmName, "storageattach", vmName,
"--storagectl", controllerName, "--storagectl", controllerName,
"--port", "0", "--port", "0",
"--device", "0", "--device", "0",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment