Re: [libvirt-users] automatically reverting to a snapshot

Peter Krempa
Wed, 26 Jul 2017 16:27:45 -0000

Please configure your mail client to send plain-text version to mailing
lists ...

On Tue, Jul 25, 2017 at 16:08:58 +0100, Dirty Dan wrote:
> How can I automatically revert to a snapshot
after the guest is stopped?<div
dir="auto"> <div
dir="auto">/etc/libvirt/hooks/qemu
#!/bin/sh
name="<span
class="money">$1"
action="<span
class="money">$2"
if [ "$name" =
"name" ]; then
virsh snapshot-revert
"$name" --snapshotname "snapshot1"
fi <div
dir="auto"> I
tried this which resulted in a deadlock, then I saw the warning further down the
page.

The hook documentation explicitly states that no calls to libvirt shoudl
be executed from the hook.

You can start a process in background, which will terminate the hook and
that process should be able to do libvirt calls.