does the guest have a snapshot ?

Peter Krempa pkrempa at redhat.com
Fri Feb 7 14:43:48 UTC 2020


On Fri, Feb 07, 2020 at 15:25:22 +0100, Lentes, Bernd wrote:
> Hi,
> 
> i'm cuurently a bit confused if a guest does have a valid snapshot or not.
> This is the xml:
>  ...
>    <disk type='file' device='disk'>
>       <driver name='qemu' type='qcow2'/>
>       <source file='/var/lib/libvirt/images/crispor_1604/crispor_1604.sn'/>
>       <backingStore type='file' index='1'>
>         <format type='raw'/>
>         <source file='/var/lib/libvirt/images/crispor_1604/crispor_1604.img'/>
>         <backingStore/>
>       </backingStore>
>       <target dev='vda' bus='virtio'/>
>       <alias name='virtio-disk0'/>
>       <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
>     </disk>
>  ...
> 
> both files are currently in access by the respective qemu process.
> lsof:
> qemu-kvm  19533       root   13u      REG              253,0  29761732608   12091393 /var/lib/libvirt/images/crispor_1604/crispor_1604.sn
> qemu-kvm  19533       root   14r      REG              253,0 111561775513   44793857 /var/lib/libvirt/images/crispor_1604/crispor_1604.img
> 
> Here are both files:
> pc60181:/var/lib/libvirt/images/crispor_1604 # ll
>  ...
> -rw------- 1 root root 111561775513 Oct 22 15:23 crispor_1604.img
> -rw-r--r-- 1 root root  29761732608 Feb  7 15:13 crispor_1604.sn
> 
> crispor_1604.sn has a recent timestamp.
> 
> The snapshot is currently in use:
> virsh # domblklist crispor_1604
> Target     Source
> ------------------------------------------------
> vda        /var/lib/libvirt/images/crispor_1604/crispor_1604.sn
> 
> 
> But virsh does not show any snapshot:
> 
> virsh # snapshot-list crispor_1604
>  Name                 Creation Time             State
> ------------------------------------------------------------
> 

Libvirt is probably lacking the metadata for the snapshot. That is not a
problem though, because since libvirt doesn't support deletion of
external snapshots anyways currently you'd need to use the below
approach anyways.

> So i'm a bit confused. Does it have a valid snapshot or not. How can i find out and how can i get rid of it ?

virsh blockcommit crispor_1604 vda --active --pivot

in the case above. that merges the file='/var/lib/libvirt/images/crispor_1604/crispor_1604.sn'/
into file='/var/lib/libvirt/images/crispor_1604/crispor_1604.img'/ and
finishes the job.

If you have more complex backing chain you might want to use the --top
and --base arguments to control which portion to merge as the command
I've suggested merges everything into the bottom-most image.




More information about the libvirt-users mailing list