Bug 1121932

Summary: Improve handling of external snapshots where live-merge is not supported
Product: Red Hat Enterprise Linux 6 Reporter: Xu Jin Long <jinxu>
Component: libvirtAssignee: Eric Blake <eblake>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.5CC: bsarathy, chayang, dyuan, eblake, jdenemar, jsuchane, juzhang, michen, mkenneth, qzhang, rbalakri, sherold, shu, shyu, virt-maint, wili, xhao, xuzhang
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-04 16:05:12 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Xu Jin Long 2014-07-22 07:36:43 UTC
Description of problem:

The user creates an external snapshot and can't emerge the snapshots.

Version-Release number of selected component (if applicable):
qemu-kvm-0.12.1.2-2.415.el6.x86_64

How reproducible:
100%

Steps to Reproduce:


1. The user creates a external snapshot.

# virsh snapshot-create-as --domain test test-snap1 --disk-only --diskspec vda,snapshot=external,file=/var/lib/libvirt/images/test-snap1 --atomic


2. Then the user emerges the external snapshots.

# virsh blockcommit --domain test vda --base ./test --top ./test-snap1 --wait --verbose


Actual results:


When the target VM is running, the command's output is as follow:

error: unsupported configuration: online commit not supported with this QEMU binary

When the target VM is shut off, the command's output is as follow:

error: Requested operation is not valid: domain is not running

Expected results:

The external snapshots were emerged successfully.  

Additional info:

Comment 3 Ademar Reis 2014-07-23 14:02:10 UTC
The behavior is expected: live-snapshot merge is a RHEV-only feature, so the error "unsupported configuration: online commit not supported with this QEMU binary" is correct.

The other error, about the VM not being online, is also correct if you consider this is a live-merge.

I see potential for improvement in the second case because virsh could recommend or even fallback to qemu-img commit when in offline mode, but I'm not familiar with the libvirt/virsh commands, so I'll leave this up to libvirt guys to respond.

Comment 4 Peter Krempa 2014-07-23 14:34:32 UTC
(In reply to Ademar Reis from comment #3)

> I see potential for improvement in the second case because virsh could
> recommend or even fallback to qemu-img commit when in offline mode, but I'm
> not familiar with the libvirt/virsh commands, so I'll leave this up to
> libvirt guys to respond.

That would be more of a feature request as that stuff currently isn't implemented upstream. It is possible to implement the feature for offline VM's with qemu-img as you pointed out, but we'd need to do that upstream first.

Regarding the original report, the messages are correct, so there's no bug in that regard, more just a feature request for implementing support for inactive domain block commit.

Comment 5 Jiri Denemark 2014-07-24 20:32:32 UTC
As explained in comments 3 and 4, the error messages are expected. Should we take this BZ as a feature request for implementing for offline merging of external snapshots?

Comment 7 Hao.Xiaolong 2014-08-18 09:20:45 UTC
jinxu@redhat.com already left redhat, I will continue monitor this bug, and take this BZ as a new feature request is good idea. If we could do like this, please go ahead and remove the need info flag for jinxu@redhat.com

Comment 11 Eric Blake 2015-01-20 15:42:18 UTC
There is a workaround of manually using 'qemu-img commit' and then 'virsh edit' to update libvirt's understanding of the domain to use the merged image file.  But properly supporting offline merge is not implemented upstream yet, and may not be a trivial feature to add into libvirt.  In fact, for upstream, libvirt would probably rather use 'qemu -M none' and use qemu's monitor to do a live merge than figure out how to wrap 'qemu-img commit', because with qemu, libvirt can reconnect to the process if libvirtd is restarted in the middle, while qemu-img cannot be reconnected.  But if that is what upstream implements, it won't help the situation when qemu refuses to do live merge.