LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

virsh-dumpxml

print a libvirt domain's XML configuration

TLDR

Dump the current domain XML
$ virsh dumpxml [domain]
copy
Dump the inactive config (used on next start)
$ virsh dumpxml --inactive [domain]
copy
Include security-sensitive fields
$ virsh dumpxml --security-info [domain]
copy
Request XML suitable for migration
$ virsh dumpxml --migratable [domain]
copy
Save XML to a file for virsh create / define
$ virsh dumpxml [domain] > [domain.xml]
copy

SYNOPSIS

virsh dumpxml [--inactive] [--security-info] [--update-cpu] [--migratable] [--xpath EXPR] [--wrap] domain

DESCRIPTION

virsh dumpxml writes the guest domain definition as libvirt XML to stdout. That XML is the same format virsh create and virsh define consume. Use --inactive when you want the on-disk definition rather than runtime amendments (PCI addresses, live disks).virsh edit is dumpxml --inactive --security-info, open in $EDITOR, then define.This is a virsh subcommand, not a separate binary.

PARAMETERS

--inactive

Dump the persistent configuration used at next start, not the live running config.
--security-info
Include secrets and other security-sensitive XML.
--update-cpu
Update domain CPU requirements from the host CPU.
--migratable
Produce XML aimed at older libvirt / migration; may enable other flags as needed.
--xpath EXPR
Print only matching nodes.
--wrap
Wrap XPath matches in a common root element.
domain
Name, ID, or UUID.

INSTALL

sudo apt install libvirt-clients
copy
sudo dnf install libvirt-client
copy
sudo apk add libvirt-client
copy
sudo zypper install libvirt-client
copy

CAVEATS

Needs a connection to libvirtd (often root for qemu:///system). Live XML can differ from the next-boot XML. --security-info may print passwords or TPM data; do not share those dumps.

HISTORY

Part of libvirt's virsh (dumpxml exists since early libvirt).

SEE ALSO

RESOURCES

Copied to clipboard
Kai