Skip to content

Domain

References a libvirt domain by name and connection URI.

Domains returned by create carry connection metadata used by with.

Methods

dumpxml()

Parses the domain's current libvirt XML.

metadata()

Returns the domain XML's <metadata> subtree, or nil.

state()

Returns the normalized libvirt state as a symbol.

start()

Starts the domain.

destroy()

Force-stops the domain without undefining it.

shutdown()

Requests a graceful shutdown and waits until the domain is shut off.

export_disk destination :compress?

Flattens the shut-off domain's file-backed disk into a standalone qcow2.

send source destination

Copies one local file into the domain with scp.

upload and download move their bytes through the VFS, which buys a chmod: in the same session, byte-level progress, and any path the VFS can reach — at a small fraction of the throughput the SSH connection itself sustains. send and fetch trade all of that away for speed, and are what a multi-hundred-megabyte transfer wants.

fetch source destination

Copies one file out of the domain with scp. The counterpart to send.

upload source destination :chmod? ...options

Copies one local file into the domain. chmod: sets the destination's mode within the same VFS session as the copy, if given.

download source destination ...options

Copies one file from the domain to the local VFS.

undefine()

Undefines the domain and removes a validated managed overlay.

with block ...options

Runs block through the domain's SSH VFS connection.