[libvirt-users] recovering from deleted snapshot

Doug Hughes doug.hughes at keystonenap.com
Thu Jun 22 15:02:41 UTC 2017


I have an automatic process setup. It's still pretty new and obviously
in need of better error handling because now I find myself in a bad state.

I run snapshot-create-as across all my vms, then do zfs replication to
the target backup system, then blockcommit everything.

virsh snapshot-create-as --domain $vm snap --diskspec
$DISK,file=$VMPREFIX/"$vm"-snap.qcow2 --disk-only --atomic --no-metadata
--quiesce

...

 virsh blockcommit $vm $DISK --active --pivot

Normally this works fine, though something went wrong on the 20th.
something happened to make the blockcommit fail, but the -snap file got
deleted (note to self - check return code from blockcommit command!)

So now I'm in a state. The domain i still running. but it's running off
the -snapshot that is in the xml. I googled around for how to recover a
blockcommit from a deleted snapshot, but didn't find anything. (pointers
welcome)

[root at vm1 images]# virsh domblklist serv1r2
Target     Source
------------------------------------------------
vda        /var/lib/libvirt/images/serv1r2-snap.qcow2
fda        -
hdb        /var/lib/libvirt/images/virtio-win-0.1.126.iso

I can see the size increasing on the deleted file in lsof:

qemu-kvm  48994 49033    qemu   97u      REG               0,44    
1855913984       1078 /var/lib/libvirt/images/serv1r2-snap.qcow2 (deleted)
...

qemu-kvm  48994 49033    qemu   97u      REG               0,44    
1856110592       1078 /var/lib/libvirt/images/serv1r2-snap.qcow2 (deleted)

--

so, do I need to rollback the zfs snapshot image or is there some other
way to recover from this snafu?

Thanks.








More information about the libvirt-users mailing list