|
|
|
|
@ -4,6 +4,7 @@ import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"github.com/mitchellh/multistep"
|
|
|
|
|
"github.com/mitchellh/packer/packer"
|
|
|
|
|
"path/filepath"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// This step creates the virtual disks for the VM.
|
|
|
|
|
@ -23,12 +24,14 @@ func (stepCreateDisk) Run(state map[string]interface{}) multistep.StepAction {
|
|
|
|
|
ui := state["ui"].(packer.Ui)
|
|
|
|
|
|
|
|
|
|
ui.Say("Creating virtual machine disk")
|
|
|
|
|
if err := driver.CreateDisk(config.FullDiskPath, fmt.Sprintf("%dM", config.DiskSize)); err != nil {
|
|
|
|
|
full_disk_path := filepath.Join(config.OutputDir, config.DiskName+".vmdk")
|
|
|
|
|
if err := driver.CreateDisk(full_disk_path, fmt.Sprintf("%dM", config.DiskSize)); err != nil {
|
|
|
|
|
err := fmt.Errorf("Error creating disk: %s", err)
|
|
|
|
|
state["error"] = err
|
|
|
|
|
ui.Error(err.Error())
|
|
|
|
|
return multistep.ActionHalt
|
|
|
|
|
}
|
|
|
|
|
state["full_disk_path"] = full_disk_path
|
|
|
|
|
|
|
|
|
|
return multistep.ActionContinue
|
|
|
|
|
}
|
|
|
|
|
|