manxmlReviewed July 15, 2026
Safe domain XML editing
Domain XML is the authoritative persistent guest definition. Capture it, validate the proposed file, define it, and confirm that libvirt normalized what you intended. Change procedure virsh edit guest01 is appropriate fo
xmleditdefinevalidate
Domain XML is the authoritative persistent guest definition. Capture it, validate the proposed file, define it, and confirm that libvirt normalized what you intended.
Change procedure
BASH
virsh dumpxml guest01 > /root/guest01.$(date +%F-%H%M).xml
cp -a /root/guest01.xml /root/guest01.xml.bak
vi /root/guest01.xml
virt-xml-validate /root/guest01.xml domain
virsh define /root/guest01.xml
virsh dumpxml guest01virsh edit guest01 is appropriate for small controlled changes. A file-based flow is easier to review, diff, validate, and roll back.
Live versus persistent configuration
The active XML and inactive XML can differ.
BASH
virsh dumpxml guest01 > /root/guest01.live.xml
virsh dumpxml guest01 --inactive > /root/guest01.config.xml
diff -u /root/guest01.config.xml /root/guest01.live.xmlRollback
BASH
virsh define /root/guest01.previous.xmlDefining XML restores persistent configuration. It does not automatically reverse a live-only device operation or repair storage data.