libvirt and qemu/kvm -snapshot option

Solution 1:

The only way to add command-line switches that libvirt doesn't support yet is to create a wrapper script and change your VM's configuration to use it instead. For example,

# cat >/usr/local/bin/qemu-snapshot <<'END'
#!/bin/sh
exec /usr/bin/qemu "$@" -snapshot
END
# chmod +x /usr/local/bin/qemu-snapshot
# virsh -c qemu:///system edit my_vm
change
    <emulator>/usr/bin/qemu</emulator>
to
    <emulator>/usr/local/bin/qemu-snapshot</emulator>

(It might be /usr/bin/kvm or something like that for you.)

Solution 2:

You just have to send kvm's monitor commit all to make the equivalent of CTRL+a...