|
|
|
|
@ -11,6 +11,7 @@ import (
|
|
|
|
|
"net"
|
|
|
|
|
"os"
|
|
|
|
|
"path/filepath"
|
|
|
|
|
"strconv"
|
|
|
|
|
"strings"
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
@ -47,12 +48,11 @@ func (d *ESX5Driver) Clone(dst, src string, linked bool) error {
|
|
|
|
|
|
|
|
|
|
func (d *ESX5Driver) CompactDisk(diskPathLocal string) error {
|
|
|
|
|
diskPath := d.datastorePath(diskPathLocal)
|
|
|
|
|
return d.sh("vmkfstools", "--punchzero", diskPath)
|
|
|
|
|
return d.sh("vmkfstools", "--punchzero", strconv.Quote(diskPath))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (d *ESX5Driver) CreateDisk(diskPathLocal string, size string, adapter_type string, typeId string) error {
|
|
|
|
|
diskPath := d.datastorePath(diskPathLocal)
|
|
|
|
|
diskPath = strings.Replace(diskPath, " ", `\ `, -1)
|
|
|
|
|
diskPath := strconv.Quote(d.datastorePath(diskPathLocal))
|
|
|
|
|
return d.sh("vmkfstools", "-c", size, "-d", typeId, "-a", adapter_type, diskPath)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -93,7 +93,7 @@ func (d *ESX5Driver) Register(vmxPathLocal string) error {
|
|
|
|
|
if err := d.upload(vmxPath, vmxPathLocal); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
r, err := d.run(nil, "vim-cmd", "solo/registervm", vmxPath)
|
|
|
|
|
r, err := d.run(nil, "vim-cmd", "solo/registervm", strconv.Quote(vmxPath))
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
@ -114,7 +114,7 @@ func (d *ESX5Driver) Destroy() error {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (d *ESX5Driver) IsDestroyed() (bool, error) {
|
|
|
|
|
err := d.sh("test", "!", "-e", d.outputDir)
|
|
|
|
|
err := d.sh("test", "!", "-e", strconv.Quote(d.outputDir))
|
|
|
|
|
if err != nil {
|
|
|
|
|
return false, err
|
|
|
|
|
}
|
|
|
|
|
@ -143,7 +143,7 @@ func (d *ESX5Driver) UploadISO(localPath string, checksum string, checksumType s
|
|
|
|
|
func (d *ESX5Driver) RemoveCache(localPath string) error {
|
|
|
|
|
finalPath := d.cachePath(localPath)
|
|
|
|
|
log.Printf("Removing remote cache path %s (local %s)", finalPath, localPath)
|
|
|
|
|
return d.sh("rm", "-f", finalPath)
|
|
|
|
|
return d.sh("rm", "-f", strconv.Quote(finalPath))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (d *ESX5Driver) ToolsIsoPath(string) string {
|
|
|
|
|
@ -451,7 +451,7 @@ func (d *ESX5Driver) CommHost(state multistep.StateBag) (string, error) {
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
func (d *ESX5Driver) DirExists() (bool, error) {
|
|
|
|
|
err := d.sh("test", "-e", d.outputDir)
|
|
|
|
|
err := d.sh("test", "-e", strconv.Quote(d.outputDir))
|
|
|
|
|
return err == nil, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -483,11 +483,11 @@ func (d *ESX5Driver) MkdirAll() error {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (d *ESX5Driver) Remove(path string) error {
|
|
|
|
|
return d.sh("rm", path)
|
|
|
|
|
return d.sh("rm", strconv.Quote(path))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (d *ESX5Driver) RemoveAll() error {
|
|
|
|
|
return d.sh("rm", "-rf", d.outputDir)
|
|
|
|
|
return d.sh("rm", "-rf", strconv.Quote(d.outputDir))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (d *ESX5Driver) SetOutputDir(path string) {
|
|
|
|
|
@ -580,7 +580,7 @@ func (d *ESX5Driver) checkGuestIPHackEnabled() error {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (d *ESX5Driver) mkdir(path string) error {
|
|
|
|
|
return d.sh("mkdir", "-p", path)
|
|
|
|
|
return d.sh("mkdir", "-p", strconv.Quote(path))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (d *ESX5Driver) upload(dst, src string) error {
|
|
|
|
|
@ -594,7 +594,7 @@ func (d *ESX5Driver) upload(dst, src string) error {
|
|
|
|
|
|
|
|
|
|
func (d *ESX5Driver) verifyChecksum(ctype string, hash string, file string) bool {
|
|
|
|
|
if ctype == "none" {
|
|
|
|
|
if err := d.sh("stat", file); err != nil {
|
|
|
|
|
if err := d.sh("stat", strconv.Quote(file)); err != nil {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
|