Commit c072a56b authored by Steven Merrill's avatar Steven Merrill

Finish initial compaction feature.

parent 3b49f7bd
......@@ -44,13 +44,13 @@ type Fusion5Driver struct {
}
func (d *Fusion5Driver) CompactDisk(diskPath string) error {
cmd := exec.Command(d.vdiskManagerPath(), "-d", diskPath)
if _, _, err := d.runAndLog(cmd); err != nil {
defragCmd := exec.Command(d.vdiskManagerPath(), "-d", diskPath)
if _, _, err := d.runAndLog(defragCmd); err != nil {
return err
}
cmd := exec.Command(d.vdiskManagerPath(), "-k", diskPath)
if _, _, err := d.runAndLog(cmd); err != nil {
shrinkCmd := exec.Command(d.vdiskManagerPath(), "-k", diskPath)
if _, _, err := d.runAndLog(shrinkCmd); err != nil {
return err
}
......
......@@ -4,7 +4,6 @@ import (
"fmt"
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
"path/filepath"
)
// This step compacts the virtual disks for the VM.
......@@ -24,7 +23,7 @@ func (stepCompactDisk) Run(state map[string]interface{}) multistep.StepAction {
ui := state["ui"].(packer.Ui)
ui.Say("Compacting the disk image")
if err := driver.CompactDisk(config.FullDiskPath, fmt.Sprintf("%dM", config.DiskSize)); err != nil {
if err := driver.CompactDisk(config.FullDiskPath); err != nil {
err := fmt.Errorf("Error compacting disk: %s", err)
state["error"] = err
ui.Error(err.Error())
......
......@@ -4,7 +4,6 @@ import (
"fmt"
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
"path/filepath"
)
// This step creates the virtual disks for the VM.
......
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