Bug 1124854

Summary: Libvirt should report error when try to revert guest to external system checkpoint snapshot
Product: Red Hat Enterprise Linux 6 Reporter: Shanzhi Yu <shyu>
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.6CC: dyuan, eblake, lhuang, mzhan, pkrempa, rbalakri, xuzhang
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-0.10.2-48.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-07-22 05:46:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1071264, 1101987    
Bug Blocks:    

Description Shanzhi Yu 2014-07-30 13:12:34 UTC
Description of problem:

Succeed reverting to external system checkpoint snapshot

Version-Release number of selected component (if applicable):

# rpm -q libvirt qemu-kvm-rhev
libvirt-0.10.2-41.el6.x86_64
qemu-kvm-rhev-0.12.1.2-2.423.el6.x86_64

How reproducible:

100%

Steps to Reproduce:
1. Prepare an running guest
#qemu-img create -f qcow2 /var/lib/libvirt/images/rhel6.img 5G
Formatting '/var/lib/libvirt/images/rhel6.img', fmt=qcow2 size=5368709120 encryption=off cluster_size=65536

#virsh define  /dev/stdin <<EOF
<domain type='kvm'>
  <name>rhel6</name>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <os>
    <type arch='x86_64' machine='rhel6.5.0'>hvm</type>
    <boot dev='hd'/>
  </os>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/var/lib/libvirt/images/rhel6.img'/>
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </disk>
  </devices>
</domain>
EOF
Domain rhel6 defined from /dev/stdin

# virsh start rhel6
Domain rhel6 started

2. Create external system checkpoint snapshot
# for i in s1 s2 s3;do virsh snapshot-create-as rhel6 $i --diskspec vda,file=/tmp/$i.disk --memspec file=/tmp/$i.mem;done
Domain snapshot s1 created
Domain snapshot s2 created
Domain snapshot s3 created

3. Do snapshot-revert
# virsh domblklist rhel6
Target     Source
------------------------------------------------
vda        /tmp/s3.disk

#pidof qemu-kvm
3519

# virsh snapshot-revert rhel6 s2
error: revert requires force: Target device address type none does not match source pci

# virsh snapshot-revert rhel6 s2  --force

4. Check guest info

# virsh domblklist rhel6
Target     Source
------------------------------------------------
vda        /tmp/s1.disk

# pidof qemu-kvm
3557


Actual results:

qemu guest restart, and succeed reverting to external system checkpoint snapshot

Expected results:

Revert to external snapshot is not supported now, libvirt should forbid this and don't restart guest and post error like:

error: unsupported configuration: revert to external system checkpoint snapshot not supported yet


Additional info:

Comment 1 Eric Blake 2014-07-30 13:19:34 UTC
Too difficult to attempt for RHEL 6.6. To follow progress in RHEL 7, look at bug 907809

Comment 2 Eric Blake 2014-07-30 13:19:58 UTC

*** This bug has been marked as a duplicate of bug 873285 ***

Comment 5 Eric Blake 2014-07-30 17:37:25 UTC
Reopening and re-titling this bug; similar to what was done in RHEL 7, you have exposed a corner case where libvirt is reverting to a snapshot when it should not be.  Fixed upstream:

commit d410e6f19d944ad78bc9257726d613597db00701
Author: Peter Krempa <pkrempa>
Date:   Tue Mar 4 10:06:22 2014 +0100

    qemu: snapshot: Use better check when reverting external snapshots

    https://bugzilla.redhat.com/show_bug.cgi?id=1071264

    Reverting of external snapshots is not supported currently. The check
    that is present doesn't properly check for all aspects that make a
    snapshot external. Use virDomainSnapshotIsExternal() to do the check.

Comment 6 Jiri Denemark 2014-08-08 13:19:34 UTC
*** Bug 1124317 has been marked as a duplicate of this bug. ***

Comment 8 Jaroslav Suchanek 2015-01-20 08:55:40 UTC
*** Bug 1179532 has been marked as a duplicate of this bug. ***

Comment 11 Shanzhi Yu 2015-01-29 05:28:04 UTC
Verify this bug with libvirt-0.10.2-48.el6.x86_64

Steps as below:

1. Prepare a running guest
# virsh list 
 Id    Name                           State
----------------------------------------------------
 2     rhel6.5                        running


2. Create external system checkpoint snapshot
# virsh snapshot-create-as rhel6.5 s1 --memspec file=/tmp/s1.mem 
Domain snapshot s1 created

3. Do revert
# virsh snapshot-revert 2 s1 
error: unsupported configuration: revert to external snapshot not supported yet

4. Create external disk-only snapshot
# virsh snapshot-create-as 2 s2 --disk-only 
Domain snapshot s2 created

5. Do revert
# virsh snapshot-revert 2 s2 
error: unsupported configuration: revert to external snapshot not supported yet

6. Create internal snapshot
# virsh snapshot-create-as  2 s3  
Domain snapshot s3 created

7. Do revert
# virsh snapshot-revert 2 s3

Comment 13 errata-xmlrpc 2015-07-22 05:46:17 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-1252.html