Bug 1071264 - Report a clueful error when attempting to revert to an external disk snapshot (offline)
Summary: Report a clueful error when attempting to revert to an external disk snapshot...
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: libvirt
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Peter Krempa
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1124854
TreeView+ depends on / blocked
 
Reported: 2014-02-28 12:05 UTC by Kashyap Chamarthy
Modified: 2014-07-30 17:37 UTC (History)
10 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2014-03-04 10:16:37 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
stderr of 'virsh snapshot-revert' with LIBVIRT_DEBUG=1 (64.14 KB, text/plain)
2014-02-28 12:09 UTC, Kashyap Chamarthy
no flags Details

Description Kashyap Chamarthy 2014-02-28 12:05:32 UTC
Description of problem
----------------------

Attempting to revert to an external (offline) disk snapshot throws:

    error: An error occurred, but the cause is unknown

which is not very useful nor does it hint any action the user need to
take.

Relevant error (for complete stderr, refer the attachment) from
LIBVIRT_DEBUG=1 (when attepmted to revert to an external disk snapshot):

    error: 2014-02-28 17:07:04.116+0000: 5951: debug : virEventPollCleanupTimeouts:553 : Found 0 out of 0 timeout slots used, releasing 0
    An error occurred, but the cause is unknown

Version
-------

    $ uname -r; rpm -q libvirt-daemon-kvm qemu 
    3.14.0-0.rc4.git0.1.fc21.x86_64
    libvirt-daemon-kvm-1.2.1-2.fc21.x86_64
    qemu-1.7.0-4.fc21.x86_64


How reproducible: Consistently.


Steps to Reproduce
------------------

1. Ensure the Domain is offline.

2. Create an external disk only snapshot:

    $ virsh snapshot-create-as devstack1  snap1 "f20clean-17FEB2014" \
      --disk-only --diskspec hda,snapshot=external,file=/export/vmimages/overlay1.qcow2 \
      --atomic 

3. List it:

    $ virsh snapshot-list devstack1
     Name                 Creation Time             State
    ------------------------------------------------------------
     snap1                2014-02-17 13:37:24 -0500 shutoff

4. Attempt to revert to 'snap1':

    $ virsh snapshot-revert devstack1 snap1 


Actual results
--------------

Revert fails with a totally unhelpful error:

    $ virsh snapshot-revert devstack1 snap1 
    error: An error occurred, but the cause is unknown


Expected results
----------------

Some useful info, indicating that the admin is trying to perfom an operation
that doesn't work yet.


Additional info
---------------

Disk image backing chain info via `qemu-img`:

    $ qemu-img info --backing-chain /export/vmimages/overlay1.qcow2
    image: /export/vmimages/overlay1.qcow2
    file format: qcow2
    virtual size: 40G (42949672960 bytes)
    disk size: 11G
    cluster_size: 65536
    backing file: /export/vmimages/fedora-20.img
    backing file format: raw
    Format specific information:
        compat: 1.1
        lazy refcounts: false
    
    image: /export/vmimages/fedora-20.img
    file format: raw
    virtual size: 40G (42949672960 bytes)
    disk size: 2.2G

Comment 1 Kashyap Chamarthy 2014-02-28 12:09:00 UTC
Created attachment 869011 [details]
stderr of 'virsh snapshot-revert' with LIBVIRT_DEBUG=1

Comment 2 Peter Krempa 2014-03-03 18:54:00 UTC
Hmmm, the disk only snapshot of an offline domain is apparently not created properly.

Comment 3 Peter Krempa 2014-03-04 10:16:37 UTC
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.

As the bug is filed against rawhide, closing as nextrelease.

Comment 4 Kashyap Chamarthy 2014-03-10 11:24:32 UTC
Thanks for the fix, just re-tested with latest git commit:


Build libvirt from git
----------------------

    $ yum-builddep libvirt -y
    $ git clone git://libvirt.org/libvirt.git && cd libvirt
    $ git log | head -1
    commit ea1eadd6a31f2cce3f62f17619eac04d59b68fde
    $ ./autogen.sh
    $ make -j4
    $ make check
    $ make rpm
    $ yum update *.rpm

Test
----

    $ sudo virsh domblklist ostack-controller
    Target     Source
    ------------------------------------------------
    vda        /var/lib/libvirt/images/ostack-controller.qcow2

    $ sudo virsh snapshot-create-as ostack-controller \
      snap2 "snap-9MAR2014" --disk-only
    Domain snapshot snap2 created
    
    $ sudo virsh domblklist ostack-controller
    Target     Source
    ------------------------------------------------
    vda        /var/lib/libvirt/images/ostack-controller.snap2
    
    $ sudo virsh snapshot-list ostack-controller
     Name                 Creation Time             State
    ------------------------------------------------------------
     snap2                2014-03-10 16:51:06 +0530 shutoff
     snap1-working-controller 2013-12-12 19:58:05 +0530 shutoff
    
    $ sudo virsh snapshot-revert ostack-controller snap2
    error: unsupported configuration: revert to external snapshot not supported yet


Note You need to log in before you can comment on or make changes to this bug.