| Summary: | libvirt snapshot revert should require force in some risky cases | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 6 | Reporter: | Eric Blake <eblake> |
| Component: | libvirt | Assignee: | Eric Blake <eblake> |
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 6.2 | CC: | acathrow, ajia, dallan, mzhan, nzhang, rwu, weizhan, whuang |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-0.9.4-15.el6 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2011-12-06 11:34:50 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Bug Depends On: | 638510 | ||
| Bug Blocks: | 747120 | ||
|
Description
Eric Blake
2011-09-30 18:59:09 UTC
The upstream thread resulted in further flushing out the actual tests that I performed: Problem 1: https://www.redhat.com/archives/libvir-list/2011-October/msg00089.html Problem 2a: https://www.redhat.com/archives/libvir-list/2011-October/msg00132.html Problem 2b: https://www.redhat.com/archives/libvir-list/2011-October/msg00133.html Meanwhile, the patch is now in POST: http://post-office.corp.redhat.com/archives/rhvirt-patches/2011-October/msg00186.html Eric, I met different test result from you for Problem 2a, and libvirt complaints again in the last step.
The following are some details (ignore some steps):
For Problem 1:
# qemu-img create -f qcow2 /var/lib/libvirt/images/bar.img 10M
Formatting '/var/lib/libvirt/images/bar.img', fmt=qcow2 size=10485760 encryption=off cluster_size=65536
# virsh edit dom (add the second disk)
Domain dom XML configuration edited.
# virsh dumpxml dom
<domain type='qemu'>
......
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/foo.img'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/bar.img'/>
<target dev='vdb' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</disk>
......
</domain>
# virsh snapshot-revert dom snap
# virsh dumpxml dom
<domain type='qemu'>
......
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/foo.img'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</disk>
......
</domain>
Notes, the second disk is gone.
...... (ignore others test steps in here, please Comment 1)
# virsh snapshot-revert dom snap
error: revert requires force: snapshot 'snap' lacks domain 'dom' rollback info
# virsh snapshot-revert dom snap --force
error: internal error Child process (/usr/bin/qemu-img snapshot -a snap /var/lib/libvirt/images/bar.img) status unexpected: exit status 1
# virsh edit dom (remove that second disk)
Domain dom XML configuration edited.
# virsh snapshot-revert dom snap --force
# echo $?
0
# virsh snapshot-list dom
Name Creation Time State
------------------------------------------------------------
snap 2011-10-08 16:01:09 +0800 shutoff
Actual result: works well for me.
For Problem 2a:
# cat > /tmp/dom.xml <<EOF
<domain type='qemu'>
<name>dom</name>
<memory>219200</memory>
<vcpu>1</vcpu>
<os>
<type arch='x86_64'>hvm</type>
<boot dev='cdrom'/>
</os>
<devices>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/foo.img'/>
<target dev='vda' bus='virtio'/>
</disk>
<input type='mouse' bus='ps2'/>
<graphics type='spice' autoport='yes' listen='0.0.0.0'/>
</devices>
</domain>
EOF
# virsh snapshot-revert dom snap
error: revert requires force: Target domain current memory 219200 does not match source 220160
Eric, I met different result from you, so is this a expected result too?
# pidof qemu-kvm
30079 27390
# virsh snapshot-revert dom snap --force
# pidof qemu-kvm
30129 27390
# virsh snapshot-revert dom snap
error: revert requires force: Target domain current memory 219200 does not match source 220160
Notes, libvirt complaints again.
Other sides are fine for me.
Actual result: FAILED.
For Problem 2b:
# virsh list
Id Name State
----------------------------------
6 vr-rhel5u4-x86_64-kvm running
11 dom running
# virsh snapshot-revert dom snap
# virsh list
Id Name State
----------------------------------
6 vr-rhel5u4-x86_64-kvm running
# virsh snapshot-revert dom snap --running
# virsh list
Id Name State
----------------------------------
6 vr-rhel5u4-x86_64-kvm running
12 dom running
# virsh edit dom (add the second disk)
Domain dom XML configuration not changed.
# virsh start dom
Domain dom started
# virsh snapshot-revert dom snap --running
error: revert requires force: must respawn qemu to start inactive snapshot
# virsh snapshot-revert dom snap --running --force
# virsh list
Id Name State
----------------------------------
6 vr-rhel5u4-x86_64-kvm running
14 dom running
# virsh dumpxml dom
<domain type='qemu'>
......
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/foo.img'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</disk>
......
</domain>
Notes, the second disk is gone.
Actual result: works well for me.
(In reply to comment #4) > Eric, I met different test result from you for Problem 2a, and libvirt > complaints again in the last step. > > The following are some details (ignore some steps): > > For Problem 2a: > > # cat > /tmp/dom.xml <<EOF > <domain type='qemu'> > <name>dom</name> > <memory>219200</memory> This is the value you requested, but it doesn't match with qemu minimum granularity. So when qemu is actually started, it is getting rounded up at run time: > # virsh snapshot-revert dom snap > error: revert requires force: Target domain current memory 219200 does not > match source 220160 At this point, if you were to 'virsh dumpxml snap', you'd see the difference in memory. Try repeating the test with dom.xml set to have a memory value that won't get rounded in the first place. > > Eric, I met different result from you, so is this a expected result too? > > # pidof qemu-kvm > 30079 27390 > > # virsh snapshot-revert dom snap --force > > # pidof qemu-kvm > 30129 27390 This confirms that the --force was sufficient to overcome the difference in memory, due to the forced rounding. It might be nice if libvirt were taught to perform the same memory rounding before declaring two domain xml as ABI incompatible (as a new BZ), but it's late enough in the 6.2 cycle that I don't think it is worth trying to do that now. > > # virsh snapshot-revert dom snap > error: revert requires force: Target domain current memory 219200 does not > match source 220160 > > Notes, libvirt complaints again. Yes, this means that the revert is restoring the config value, not the runtime-rounded value, so once again there is a difference between config and runtime, so the --force is still necessary to overcome the fact that rounding must take place. Again, once you fix dom.xml to not need rounding in the first place, I think you will be able to get results more like what I was predicting. (In reply to comment #5) > > # cat > /tmp/dom.xml <<EOF > > <domain type='qemu'> > > <name>dom</name> > > <memory>219200</memory> > > This is the value you requested, but it doesn't match with qemu minimum > granularity. So when qemu is actually started, it is getting rounded up at run Yeah, you're right. > This confirms that the --force was sufficient to overcome the difference in > memory, due to the forced rounding. It might be nice if libvirt were taught to > perform the same memory rounding before declaring two domain xml as ABI > incompatible (as a new BZ), but it's late enough in the 6.2 cycle that I don't > think it is worth trying to do that now. Agree, it's a another issue, I will file a new bug if necessary. > > > > > # virsh snapshot-revert dom snap > > error: revert requires force: Target domain current memory 219200 does not > > match source 220160 > > > > Notes, libvirt complaints again. > > place, I think you will be able to get results more like what I was predicting. Yeah, I get the same result like you: # virsh snapshot-revert dom snap error: revert requires force: Target domain disk count 1 does not match source 2 # pidof qemu-kvm 13699 12186 # virsh snapshot-revert dom snap --force # echo $? 0 # pidof qemu-kvm 13719 12186 And other steps are also fine, so move the bug to VERIFIED status. Version-Release number of selected component: # uname -r 2.6.32-206.el6.x86_64 # rpm -q libvirt libvirt-0.9.4-16.el6.x86_64 # rpm -q qemu-kvm qemu-kvm-0.12.1.2-2.195.el6.x86_64 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. http://rhn.redhat.com/errata/RHBA-2011-1513.html |