Bug 626870 - [RHEL6]: libvirt snapshot-create failure shows the "failed" snapshot in snapshot-list
Summary: [RHEL6]: libvirt snapshot-create failure shows the "failed" snapshot in snaps...
Keywords:
Status: CLOSED DUPLICATE of bug 733499
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.0
Hardware: All
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Eric Blake
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-08-24 15:23 UTC by Alex Jia
Modified: 2011-08-25 21:56 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-08-25 21:56:28 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Alex Jia 2010-08-24 15:23:19 UTC
Description of problem:
I created a snapshot for a guest ago, and then I upgraded libvirt package, I can't find previous snapshot of the guest, when I created a the same name snapshot for the guest again and upgraded libvirt again, I can't find the 2 snapshot for the guest, but I can find them using 'qemu-img info' and their name is the same.

It seems libvirt hasn't any judgement for whether the guest has ever had a snapshot, if has, I think libvirt should inherit it rather than dropping it.

Version-Release number of selected component (if applicable):
libvirt-0.8.1-22.el6.x86_64
libvirt-0.8.1-23.el6.x86_64
libvirt-0.8.1-24.el6.x86_64

How reproducible:
always

Steps to Reproduce:
1. create a shopshot for guest
2. list snapshot of guest 
3. upgrade libvirt package
4. repeat 2
5. using qemu-img info to check real result
6. repeat 1-5
  
Actual results:
# virsh snapshot-list rhel5u4-qcow2
 Name                 Creation Time             State
---------------------------------------------------

# qemu-img info /var/lib/libvirt/images/rhel5u4-qcow2.img 
image: /var/lib/libvirt/images/rhel5u4-qcow2.img
file format: qcow2
virtual size: 5.9G (6291456000 bytes)
disk size: 4.0G
cluster_size: 65536
Snapshot list:
ID        TAG                 VM SIZE                DATE       VM CLOCK
2         hello-snapshot            0 2010-08-11 10:39:43   00:00:00.000
3         hello-snapshot            0 2010-08-12 16:44:05   00:00:00.000


Expected results:
fix it

Additional info:
I forgot version of kernel.

Comment 2 Chris Lalancette 2010-08-25 14:45:54 UTC
OK, weird.  I'm not able to reproduce this problem at all on my setup.  I did use libvirt-0.8.1-25 and libvirt-0.8.1-27, and I could see my snapshots both before and after the upgrade.  There is also code in the libvirt code base that scans through all of the snapshots and finds the old ones, so this should work.  When you had this problem, did you get any SELinux denials?  Also, if you try with newer libvirt, (use -25 and -27; -26 is broken), does this work for you?

Chris Lalancette

Comment 3 Alex Jia 2010-08-26 09:51:55 UTC
(In reply to comment #2)
> OK, weird.  I'm not able to reproduce this problem at all on my setup.  I did
> use libvirt-0.8.1-25 and libvirt-0.8.1-27, and I could see my snapshots both
> before and after the upgrade.  There is also code in the libvirt code base that
> scans through all of the snapshots and finds the old ones, so this should work.
>  When you had this problem, did you get any SELinux denials?  Also, if you try
> with newer libvirt, (use -25 and -27; -26 is broken), does this work for you?
> 
> Chris Lalancette

Chris, I re-test the bug on a clean host and guest os, sometimes snapshot-create operation is successful, but sometimes is failed, it is a known bug 589076, that probably is a root of the problem, so we had better wait bug 589076 is fixed, and then come back this bug again, or close it firstly, if it exists problem, I will reopen it in the future.

I just tried -25 and -27 version, the following is test result:
# rpm -q libvirt
libvirt-0.8.1-25.el6.x86_64

# qemu-img info /var/lib/libvirt/images/rhel6.img
image: /var/lib/libvirt/images/rhel6.img
file format: qcow2
virtual size: 5.9G (6291456000 bytes)
disk size: 1.3G
cluster_size: 65536

# virsh snapshot-list rhel6-qcow2
 Name                 Creation Time             State
---------------------------------------------------

# cat snapshot.xml
<domainsnapshot>
  <name>snapshot1</name>
  <description>hello snapshot</description>
</domainsnapshot>

# virsh snapshot-create rhel6-qcow2 snapshot.xml
Domain snapshot snapshot1 created from 'snapshot.xml'

Note: snaphost is successfully created for shutoff state guest.

# virsh snapshot-list rhel6-qcow2
 Name                 Creation Time             State
---------------------------------------------------
 snapshot1            2010-08-26 05:10:14 +0800 shutoff

# virsh snapshot-dumpxml rhel6-qcow2 snapshot1
<domainsnapshot>
  <name>snapshot1</name>
  <description>hello snapshot</description>
  <state>shutoff</state>
  <creationTime>1282770614</creationTime>
  <domain>
    <uuid>5f9b34ed-7c33-6206-9d4e-ad9552e890d3</uuid>
  </domain>
</domainsnapshot>

# virsh snapshot-current rhel6-qcow2
<domainsnapshot>
  <name>snapshot1</name>
  <description>hello snapshot</description>
  <state>shutoff</state>
  <creationTime>1282770614</creationTime>
  <domain>
    <uuid>5f9b34ed-7c33-6206-9d4e-ad9552e890d3</uuid>
  </domain>
</domainsnapshot>

# qemu-img info /var/lib/libvirt/images/rhel6.img
image: /var/lib/libvirt/images/rhel6.img
file format: qcow2
virtual size: 5.9G (6291456000 bytes)
disk size: 1.3G
cluster_size: 65536
Snapshot list:
ID        TAG                 VM SIZE                DATE       VM CLOCK
1         snapshot1                 0 2010-08-26 05:10:14   00:00:00.000

Note: snapshot1 really exists

# virsh start rhel6-qcow2
Domain rhel6-qcow2 started

# cat snapshot2.xml
<domainsnapshot>
  <name>snapshot2</name>
  <description>hello snapshot2</description>
</domainsnapshot>

# virsh snapshot-create rhel6-qcow2 snapshot2.xml
error: internal error unable to execute QEMU command 'savevm': The command savevm has not been found

Note: it is a known bug

# virsh snapshot-list rhel6-qcow2
 Name                 Creation Time             State
---------------------------------------------------
 snapshot1            2010-08-26 05:10:14 +0800 shutoff
 snapshot2            2010-08-26 05:13:19 +0800 nostate

Note that: I can find the snapshot2 by virsh snapshot-list

# virsh snapshot-dumpxml rhel6-qcow2 snapshot2
<domainsnapshot>
  <name>snapshot2</name>
  <description>hello snapshot2</description>
  <state>nostate</state>
  <creationTime>1282770799</creationTime>
  <domain>
    <uuid>5f9b34ed-7c33-6206-9d4e-ad9552e890d3</uuid>
  </domain>
</domainsnapshot>

# virsh snapshot-current rhel6-qcow2
<domainsnapshot>
  <name>snapshot1</name>
  <description>hello snapshot</description>
  <state>shutoff</state>
  <creationTime>1282770614</creationTime>
  <domain>
    <uuid>5f9b34ed-7c33-6206-9d4e-ad9552e890d3</uuid>
  </domain>
</domainsnapshot>

Note that, snapshot-current should provide a <snapshotname> option, otherwise, user only can get parent snapshot. 

# qemu-img info /var/lib/libvirt/images/rhel6.img
image: /var/lib/libvirt/images/rhel6.img
file format: qcow2
virtual size: 5.9G (6291456000 bytes)
disk size: 1.3G
cluster_size: 65536
Snapshot list:
ID        TAG                 VM SIZE                DATE       VM CLOCK
1         snapshot1                 0 2010-08-26 05:10:14   00:00:00.000

Note, snapshot2 really don't exist

# virsh shutdown rhel6-qcow2
Domain rhel6-qcow2 is being shutdown

# yum update libvirt* -y
.......

# rpm -q libvirt
libvirt-0.8.1-27.el6.x86_64

# virsh snapshot-list rhel6-qcow2
 Name                 Creation Time             State
---------------------------------------------------
 snapshot1            2010-08-26 05:10:14 +0800 shutoff

Note that, I can't also reproduce the bug.

# qemu-img info /var/lib/libvirt/images/rhel6.img
image: /var/lib/libvirt/images/rhel6.img
file format: qcow2
virtual size: 5.9G (6291456000 bytes)
disk size: 1.3G
cluster_size: 65536
Snapshot list:
ID        TAG                 VM SIZE                DATE       VM CLOCK
1         snapshot1                 0 2010-08-26 05:10:14   00:00:00.000

But I indeed met that kind of case in comment 1, and I can't provide a exact test environment, because of I upgrade qemu-kvm and kernel many times expect for updating libvirt packages, it is pretty hard to reproduce.

Comment 4 Chris Lalancette 2010-08-26 14:38:22 UTC
OK.  Indeed, the fact that virsh snapshot-create fails on a running domain is known, and it tracked elsewhere.  Here, there does seem to be a minor bug in that when snapshot-create fails, it should *never* show up in snapshot-list.  I'll change the title of this bug to track that problem.

Thanks for testing again.

Chris Lalancette

Comment 5 Suzanne Yeghiayan 2011-03-28 21:12:14 UTC
Since RHEL 6.1 External Beta has begun, and this bug remains 
unresolved, it has been rejected as it is not proposed as an 
exception or blocker.

Red Hat invites you to ask your support representative to 
propose this request, if appropriate and relevant, in the 
next release of Red Hat Enterprise Linux.

Comment 7 Eric Blake 2011-08-25 21:56:28 UTC
I found this after already opening a new bug on the same topic.  Since that one is in POST, I'm closing this as a duplicate.

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


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