Expand description

This crate is probably not what you hoped it was – in fact, it’s probably exactly what you feared. Rather than integrate against VirtualBox’s COM interfaces it will call the command line tools and parse their outputs.

Perhaps not surprisingly, this crate originally began as a bash script and slowly morphed into what it is today.

Examples

Terminate a virtual machine named myvm and revert it to a snapshot named mysnap.

use std::time::Duration;
use vboxhelper::*;

let vm = "myvm".parse::<VmId>().unwrap();
controlvm::kill(&vm).unwrap();

let ten_seconds = Duration::new(10, 0);
wait_for_croak(&vm, Some((ten_seconds, TimeoutAction::Error)));

// revert to a snapshot
let snap = "mysnap".parse::<snapshot::SnapshotId>().unwrap();
snapshot::restore(&vm, Some(snap)).unwrap();

VirtualBox Versions

This crate will generally attempt to track the latest version of VirtualBox.

Environment variables

In some cases vboxhelper will execute external commands with no intention of parsing their output. In these situations vboxhelper will by default consume the child processes’ output. This behavior can be changed by setting the VBOXHELPER_VERBOSE environment variable; setting its value to "1" will cause the library to output to be directed to stdout and stderr respectively.

If the variable VBOXHELPER_LOGS is set to a valid directory vboxhelper may use it to store log files.

Re-exports

pub use err::Error;
pub use vmid::VmId;

Modules

Control the run state of a virtual machine.

Manage virtual machine snapshots.

Abstraction of a virtual machine identifier.

Structs

A structured representation of a virtual machine’s state and configuration.

Enums

Control whether running a VM headless should block until VM terminates or if it should return as soon as the VM has been started in the background.

Control whether a virtual machine is run with a GUI or in Headless mode.

VirtualBox virtual machine states.

Functions

Get the process id of the guest virtual machine.

Get a list of all running virtual machines.

Get structured information about a virtual machine.

Get information about a virtual machine as a map.

Get a list of virtual machines.

Check whether a virtual machine is currently in a certain state.

Wrapper method around get_pid() to retry getting the guest’s PID.

Wait for a virtual machine to self-terminate.

Wait for a virtual machine to enter an expected state.