Hide Forgot
Description of problem: Libvirt is not honoring the VIR_DOMAIN_START_PAUSED flag when resuming a managed save domain. Additionally, when libvirt starts a paused domain, it is failing to issue a VIR_DOMAIN_EVENT_SUSPENDED to reflect the domain state, which may confuse management apps that are using events to track domain transitions. Similar event problems occur when reverting to a snapshot. Version-Release number of selected component (if applicable): libvirt-0.9.4-6.el6 How reproducible: 100% Steps to Reproduce: 1. virsh start dom --paused 2. virsh resume dom 3. virsh managedsave dom 4. virsh start dom --paused 5. virsh pause dom 6. virsh snapshot-create-as dom name 7. virsh destroy dom 8. virsh snapshot-revert dom name Actual results: 1. VIR_DOMAIN_EVENT_STARTED issued, but no VIR_DOMAIN_EVENT_SUSPENDED 2. VIR_DOMAIN_EVENT_RESUMED issued 3. VIR_DOMAIN_EVENT_STOPPED issued 4. VIR_DOMAIN_EVENT_STARTED issued and domain is running 5. VIR_DOMAIN_EVENT_SUSPENDED issued 6. no event, but snapshot remembers it is paused 7. VIR_DOMAIN_EVENT_STOPPED issued 8. VIR_DOMAIN_EVENT_STARTED and VIR_DOMAIN_EVENT_SUSPENDED both issued, but vcpus had a window where they temporarily ran and differ from the state of the snapshot Expected results: 1. both VIR_DOMAIN_EVENT_STARTED and VIR_DOMAIN_EVENT_SUSPENDED issued 2. VIR_DOMAIN_EVENT_RESUMED issued 3. VIR_DOMAIN_EVENT_STOPPED issued 4. VIR_DOMAIN_EVENT_STARTED and VIR_DOMAIN_EVENT_PAUSED issued, domain is paused 5. error, since domain is already paused 6. no event, but snapshot remembers it is paused 7. VIR_DOMAIN_EVENT_STOPPED issued 8. VIR_DOMAIN_EVENT_STARTED and VIR_DOMAIN_EVENT_SUSPENDED both issued, domain is paused and in same state as at the time of the snapshot Additional info:
Getting this fixed is a prereq to bug 638510 support for live snapshots via the snapshot_blkdev qemu monitor command.
One other bug to be fixed in this area of code at the same time: Newer qemu does not allow 'qemu -loadvm name' to revert to an inactive internal snapshot - if there is no accompanying vm state in the snapshot name, the attempt is rejected. To fix that, the revert code needs to use 'qemu-img snapshot -a name'. Fixing this is necessary before bug 674537 can be tested.
Upstream now has several patches, culminating in this commit, that should fix this bug: commit 7dc44eb059fc976e7c88091477a981a4a90bf2f5 Author: Eric Blake <eblake> Date: Sat Aug 27 13:48:19 2011 -0600 snapshot: fine-tune qemu snapshot revert states For a system checkpoint of a running or paused domain, it's fairly easy to honor new flags for altering which state to use after the revert. For an inactive snapshot, the revert has to be done while there is no qemu process, so do back-to-back transitions; this also lets us revert to inactive snapshots even for transient domains. * src/qemu/qemu_driver.c (qemuDomainRevertToSnapshot): Support new flags.
In POST: http://post-office.corp.redhat.com/archives/rhvirt-patches/2011-September/msg00105.html
Tested with libvirt-0.9.4-11.el6.x86_64, move this to VERIFIED. Terminal 1: ============ # virsh start foo --paused Domain foo started # virsh list Id Name State ---------------------------------- 1 win7 running 3 foo paused # virsh resume foo Domain foo resumed # virsh managedsave foo Domain foo state saved by libvirt # virsh start foo --paused Domain foo started # virsh suspend foo Domain foo suspended # virsh snapshot-create-as foo snap1 Domain snapshot snap1 created # virsh destroy foo Domain foo destroyed # virsh snapshot-revert foo snap1 # virsh list Id Name State ---------------------------------- 1 win7 running 4 foo paused Terminal 2: ============ # ./event-test main:345: Registering domain event cbs myDomainEventCallback1 EVENT: Domain foo(2) Started Booted myDomainEventCallback2 EVENT: Domain foo(2) Started Booted myDomainEventCallback1 EVENT: Domain foo(2) Suspended Paused myDomainEventCallback2 EVENT: Domain foo(2) Suspended Paused myDomainEventCallback1 EVENT: Domain foo(2) Resumed Unpaused myDomainEventCallback2 EVENT: Domain foo(2) Resumed Unpaused myDomainEventCallback1 EVENT: Domain foo(-1) Stopped Failed myDomainEventCallback2 EVENT: Domain foo(-1) Stopped Failed myDomainEventCallback1 EVENT: Domain foo(3) Started Restored myDomainEventCallback2 EVENT: Domain foo(3) Started Restored myDomainEventCallback1 EVENT: Domain foo(3) Suspended Paused myDomainEventCallback2 EVENT: Domain foo(3) Suspended Paused myDomainEventCallback1 EVENT: Domain foo(-1) Stopped Destroyed myDomainEventCallback2 EVENT: Domain foo(-1) Stopped Destroyed myDomainEventCallback1 EVENT: Domain foo(4) Started Snapshot myDomainEventCallback2 EVENT: Domain foo(4) Started Snapshot myDomainEventCallback1 EVENT: Domain foo(4) Suspended Snapshot myDomainEventCallback2 EVENT: Domain foo(4) Suspended Snapshot
The fixes for this bug introduced a regression in bug 737010
*** Bug 739486 has been marked as a duplicate of this bug. ***
Patch wasn't quite complete - see bug 740508 for the remaining fix
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