Exemplo n.º 1
0
func (conn VcConn) GuestStart(guestUser, guestPass, remoteBin, remoteArguments string) error {
	args := []string{"guest.start"}
	args = conn.AppendConnectionString(args)
	args = append(args, fmt.Sprintf("--dc=%s", conn.driver.Datacenter))
	args = append(args, fmt.Sprintf("--l=%s:%s", guestUser, guestPass))
	args = append(args, fmt.Sprintf("--vm=%s", conn.driver.MachineName))
	args = append(args, remoteBin)
	args = append(args, remoteArguments)
	_, stderr, err := govcOutErr(args...)

	if stderr == "" && err == nil {
		return nil
	}
	return errors.NewGuestError("start", conn.driver.MachineName, stderr)
}
Exemplo n.º 2
0
func (conn VcConn) GuestDownload(guestUser, guestPass, remotePath, localPath string) error {
	args := []string{"guest.download"}
	args = conn.AppendConnectionString(args)
	args = append(args, fmt.Sprintf("--dc=%s", conn.driver.Datacenter))
	args = append(args, fmt.Sprintf("--l=%s:%s", guestUser, guestPass))
	args = append(args, fmt.Sprintf("--vm=%s", conn.driver.MachineName))
	args = append(args, remotePath)
	args = append(args, localPath)
	_, stderr, err := govcOutErr(args...)

	if stderr == "" && err == nil {
		return nil
	}
	return errors.NewGuestError("download", conn.driver.MachineName, stderr)
}
Exemplo n.º 3
0
func (conn VcConn) GuestMkdir(guestUser, guestPass, dirName string) error {
	args := []string{"guest.mkdir"}
	args = conn.AppendConnectionString(args)
	args = append(args, fmt.Sprintf("--dc=%s", conn.driver.Datacenter))
	args = append(args, fmt.Sprintf("--l=%s:%s", guestUser, guestPass))
	args = append(args, fmt.Sprintf("--vm=%s", conn.driver.MachineName))
	args = append(args, "-p")
	args = append(args, dirName)
	_, stderr, err := govcOutErr(args...)

	if stderr == "" && err == nil {
		return nil
	}
	return errors.NewGuestError("mkdir", conn.driver.MachineName, stderr)
}