vmrun

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2023 License: BSD-3-Clause, MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddSharedFolder

func AddSharedFolder(app, vmx string, shareName, newHostPath string) error

AddSharedFolder add a Host-Guest shared folder.

func CaptureScreen

func CaptureScreen(app, vmx, username, password, dst string) error

CaptureScreen capture the screen of the VM to a local file.

func CopyFileFromGuestToHost

func CopyFileFromGuestToHost(app, vmx, username, password, guestFilepath, hostFilepath string) error

CopyFileFromGuestToHost copy a file from guest OS to host OS.

func CopyFileFromHostToGuest

func CopyFileFromHostToGuest(app, vmx, username, password, hostFilepath, guestFilepath string) error

CopyFileFromHostToGuest copy a file from host OS to guest OS.

func CreateTempfileInGuest

func CreateTempfileInGuest(app, vmx, username, password string) (string, error)

CreateTempfileInGuest create a temporary file in Guest OS.

func DeleteFileInGuest

func DeleteFileInGuest(app, vmx, username, password, filename string) error

DeleteFileInGuest delete a file in Guest OS.

func DeleteSnapshot

func DeleteSnapshot(app, vmx, snapshotName string, deleteChildren bool) error

DeleteSnapshot remove a snapshot from a VM.

func DirectoryExistsInGuest

func DirectoryExistsInGuest(app, vmx string, username, password string, dir string) bool

DirectoryExistsInGuest check if a directory exists in Guest OS.

func DisableSharedFolders

func DisableSharedFolders(app, vmx string, runtime bool) error

DisableSharedFolders disable shared folders in Guest. Stops the guest virtual machine, specified by .vmx file, from sharing folders with its host.

The optional runtime argument means to stop sharing folders only until the virtual machine is powered off. Otherwise, the setting persists at next power on.

func EnableSharedFolders

func EnableSharedFolders(app, vmx string, runtime bool) error

EnableSharedFolders enable shared folders in Guest.

The optional runtime argument means to share folders only until the virtual machine is powered off. Otherwise, the setting persists at next power on.

func FileExistsInGuest

func FileExistsInGuest(app, vmx string, username, password string, filename string) bool

FileExistsInGuest check if a file exists in Guest OS.

func GetGuestIPAddress

func GetGuestIPAddress(app, vmx string, wait bool) (string, error)

GetGuestIPAddress gets the IP address of the guest.

func KillProcessInGuest

func KillProcessInGuest(app, vmx, username, password string, pid int) error

KillProcessInGuest kill a process in Guest OS.

func ListDirectoryInGuest

func ListDirectoryInGuest(app, vmx, username, password, dir string) ([]string, error)

ListDirectoryInGuest list a directory in Guest OS.

func ListSnapshots

func ListSnapshots(app, vmx string) ([]string, int, error)

ListSnapshots list all snapshots in a VM.

func Pause

func Pause(app, vmx string) error

Pause pause a VM.

func ReadVariable

func ReadVariable(app, vmx, username, password string, mode VariableMode, env string) (string, error)

ReadVariable read a variable in the VM state.

func RemoveSharedFolder

func RemoveSharedFolder(app, vmx, shareName string) error

RemoveSharedFolder remove a Host-Guest shared folder.

func RenameFileInGuest

func RenameFileInGuest(app, vmx, username, password, src, dst string) error

RenameFileInGuest rename a file in Guest OS.

func Reset

func Reset(app, vmx string, hard bool) error

Reset reset a VM or Team.

func RevertToSnapshot

func RevertToSnapshot(app, vmx, snapshotName string) error

RevertToSnapshot set VM state to a snapshot.

func RunProgramInGuest

func RunProgramInGuest(app, vmx string, username, password string, config RunInGuestConfig, cmdPath string, cmdArgs ...string) error

RunProgramInGuest run a program in Guest OS.

func RunScriptInGuest

func RunScriptInGuest(app, vmx, username, password string, config RunInGuestConfig, interpreter, script string) error

RunScriptInGuest run a script in Guest OS.

func SetSharedFolderState

func SetSharedFolderState(app, vmx string, shareName, hostPath string, writable bool) error

SetSharedFolderState modify a Host-Guest shared folder.

func Snapshot

func Snapshot(app, vmx, snapshotName string) error

Snapshot create a snapshot of a VM.

func Start

func Start(app, vmx string, gui bool) error

Start start a VM or Team.

func Stop

func Stop(app, vmx string, hard bool) error

Stop stop a VM or Team.

func Suspend

func Suspend(app, vmx string, hard bool) error

Suspend Suspend a VM or Team.

func Unpause

func Unpause(app, vmx string) error

Unpause unpause a VM.

func WriteVariable

func WriteVariable(app, vmx, username, password string, mode VariableMode, env, value string) error

WriteVariable write a variable in the VM state.

Types

type ListProcessesInGuestInfo

type ListProcessesInGuestInfo struct {
	Pid   string
	Owner string
	Cmd   string
}

ListProcessesInGuestInfo represents a result of listprocessesinguest command.

func ListProcessesInGuest

func ListProcessesInGuest(app, vmx, username, password string) ([]ListProcessesInGuestInfo, error)

ListProcessesInGuest List running processes in Guest OS.

type RunInGuestConfig

type RunInGuestConfig int

RunInGuestConfig represents a runProgramInGuest and runScriptInGuest commands flag.

const (
	// NoWait returns a prompt immediately after the program starts in the guest, rather than waiting for it to finish.
	// This option is useful for interactive programs.
	NoWait RunInGuestConfig = 1 << iota
	// ActiveWindow ensures that the Windows GUI is visible, not minimized.
	// It has no effect on Linux.
	ActiveWindow
	// Interactive forces interactive guest login.
	// It is useful for Vista and Windows 7 guests to make the program visible in the console window.
	Interactive
)

func (RunInGuestConfig) String

func (r RunInGuestConfig) String() string

String implements a fmt.Stringer interface.

type VariableMode

type VariableMode int

VariableMode represents a writeVariable or readVariable command mode.

const (
	// RuntimeConfig runtime‐only value that provides a simple way to pass runtime values in and out of the guest.
	RuntimeConfig VariableMode = 1 << iota
	// GuestEnv non‐persistent guest variable.
	GuestEnv
	// GuestVar runtime configuration parameter as stored in the .vmx file, or an environment variable.
	GuestVar
)

func (VariableMode) String

func (v VariableMode) String() string

String implements a fmt.Stringer interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL