Finish initial compaction feature.

This commit is contained in:
Steven Merrill 2013-07-01 22:45:46 -04:00
parent 3b49f7bd20
commit c072a56b40
3 changed files with 5 additions and 7 deletions

View File

@ -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
}

View File

@ -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())

View File

@ -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.