Bug 1175123

Summary: Inactive external snapshot can't work after libvirtd restart
Product: Red Hat Enterprise Linux 7 Reporter: Shanzhi Yu <shyu>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 7.1CC: dyuan, eblake, mzhan, pkrempa, rbalakri, yanyang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-1.2.13-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1175147 (view as bug list) Environment:
Last Closed: 2015-11-19 05:59:11 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:    
Bug Blocks: 1175147    

Description Shanzhi Yu 2014-12-17 08:40:09 UTC
Description of problem:

Inactive external snapshot can't work after libvirtd restart

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

libvirt-1.2.8-10.el7.x86_64

How reproducible:

100%

Steps to Reproduce:
1.Prepare a shut off guest 
# virsh list --inactive 
 Id    Name                           State
----------------------------------------------------
 -     rhel7                          shut off

2.Create external snapshot for shot off guest

# virsh snapshot-create-as rhel7 ss --disk-only 
Domain snapshot ss created

3.Check guest source file

# virsh dumpxml rhel7|grep "source file"
      <source file='/var/lib/libvirt/images/rhel7-qcow2v3.ss'/>

4.Restart libvirt, do check in step 3 again

# systemctl restart  libvirtd.service

# virsh dumpxml rhel7|grep "source file" 
      <source file='/var/lib/libvirt/images/rhel7-qcow2v3.img'/>

Actual results:


Expected results:

source file should point to new snapshot file in step 4

Additional info:

This was first reported by Eric Blake
http://www.redhat.com/archives/libvir-list/2014-December/msg00369.html

Comment 1 Shanzhi Yu 2015-01-15 10:19:57 UTC
Upstream patch:

commit 9f974858dde667bda55fbfbec56aa16d9ced870d
Author: Shanzhi Yu <shyu>
Date:   Sun Dec 7 00:32:18 2014 +0800

    qemu: snapshot: inactive external snapshot can't work after libvirtd restart
    
    When create inactive external snapshot, after update disk definitions,
    virDomainSaveConfig is needed, if not after restart libvirtd the new snapshot
    file definitions in xml will be lost.
    
https://www.redhat.com/archives/libvir-list/2015-January/msg00435.html

Comment 3 Yang Yang 2015-04-29 03:40:14 UTC
Verified on libvirt-1.2.14-1.el7.x86_64

# virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     testvm3                        shut off

# virsh domblklist testvm3
Target     Source
------------------------------------------------
vda        /var/lib/libvirt/images/vm1.qcow2

# virsh snapshot-create-as testvm3 s1 --disk-only
Domain snapshot s1 created

# virsh domblklist testvm3
Target     Source
------------------------------------------------
vda        /var/lib/libvirt/images/vm1.s1

# service libvirtd restart

# virsh domblklist testvm3
Target     Source
------------------------------------------------
vda        /var/lib/libvirt/images/vm1.s1

# virsh snapshot-create-as testvm3 s2 --disk-only --no-metadata
Domain snapshot s2 created

# virsh domblklist testvm3
Target     Source
------------------------------------------------
vda        /var/lib/libvirt/images/vm1.s2

# service libvirtd restart
Redirecting to /bin/systemctl restart  libvirtd.service

# virsh domblklist testvm3
Target     Source
------------------------------------------------
vda        /var/lib/libvirt/images/vm1.s2

Comment 5 Yang Yang 2015-05-18 03:30:17 UTC
According to comment #3, mark it as verified

Comment 7 errata-xmlrpc 2015-11-19 05:59:11 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-2202.html