Bug 1175603

Summary: libvirt should report error when revert to a internal snapshot when we are in external snapshot checkpoint
Product: Red Hat Enterprise Linux 7 Reporter: Luyao Huang <lhuang>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: dyuan, mzhan, pkrempa, rbalakri, shyu
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-07 09:06:50 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:

Description Luyao Huang 2014-12-18 07:35:25 UTC
description of problem:
libvirt should report error when revert to a internal snapshot when we are in external snapshot

Version-Release number of selected component (if applicable):
libvirt-1.2.8-10.el7.x86_64
qemu-kvm-rhev-2.1.2-17.el7.x86_64

How reproducible:
100%

Steps to Reproduce:

1.prepare a running guest have a qcow2 disk
# virsh dumpxml test3
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/var/lib/libvirt/images/test6.img'/>
      <target dev='hda' bus='ide'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>

2.do internal snapshot
# virsh snapshot-create-as test3 s1

Domain snapshot s1 created

3.edit some thing in guest

4.create a external snapshot:
# virsh snapshot-create-as test3 s2 --disk-only
Domain snapshot s2 created

5.revert to internal snapshot s1:
# virsh snapshot-revert test3 s1

# echo $?
0


Actual results:
no error when do snapshot-revert and nothing changed after revert(even reboot then check)
      
Expected results:
output error when snapshot-revert failed, like this:

the snapshot 's1' does not exist, and was not loaded


Some Information:

After i debug libvirt and qemu, i found :
libvirt:                                qemu-kvm:
qemuDomainRevertToSnapshot
    qemuMonitorTextLoadSnapshot
        qemuMonitorHMPCommand
                                        do_loadvm
                                             load_vmstate
                                                 bdrv_snapshot_find
                                               /*cannot find a snapshot*/
                                             return ret
                                        end     
                                        /*no error output when cannot find */
        /*reply = '' so no error */
        ret = 0

And libvirt try to find a error like this:

    else if (strstr(reply, "Could not find snapshot") != NULL) {
        virReportError(VIR_ERR_OPERATION_INVALID,
                       _("the snapshot '%s' does not exist, and was not loaded"),
                       name);
        goto cleanup;
    }

But with qemu-kvm-rhev seems qemu will never output this reply.
So libvirt return success.

Comment 1 Peter Krempa 2015-02-07 09:06:50 UTC
We are already tracking problems with combining external and internal snapshots. I've improved the summary of the original bug as it was not obvious and I'll close this one as a duplicate.

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