Bug 729714

Summary: libvirt managedsave incompatible with transient domains
Product: Red Hat Enterprise Linux 6 Reporter: Eric Blake <eblake>
Component: libvirtAssignee: Eric Blake <eblake>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.2CC: dallan, dyuan, mzhan, rwu, veillard, yupzhang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-0.9.4-3.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-06 11:26:05 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Eric Blake 2011-08-10 15:35:01 UTC
Description of problem:
The fix to bug 697742 made it impossible to undefine a domain if managed save state still exists, since otherwise, the existing managedsave data can interfere with a new domain created by the same name.  However, this overlooked one aspect - transient domains cannot be undefined, but cease to exist once the qemu process stops; yet the managedsave process causes the qemu process to stop.  Thus, attempts to use managedsave on a transient domain will create stale state files that can interfere with the creation of new domains.

Version-Release number of selected component (if applicable):
libvirt-0.9.4-2.el6

How reproducible:
found by code inspection, but I suspect it is possible to write a test case with 100% reproduction

Steps to Reproduce (untested, based on steps in bug 697742):
1. create a transient domain "dom"
2. virsh managedsave dom
3. note that 'virsh start dom' won't work, since dom no longer exists
4. define a new persistent domain named dom but with a different uuid
5. virsh start dom
  
Actual results:
since step 2 succeeded, step 5 ends up trying to revive the managedsave associated with the old transient 'dom', instead of booting the new persistent 'dom' from scratch, and fails due to uuid collision.

Expected results:
step 2 should be rejected - managedsave of a transient domain does not make sense

Additional info:
Patch proposed upstream, awaiting feedback on whether rejection is right, or whether the patch should be rewritten to permit managedsave on transient domains by temporarily making the domain persistent.
https://www.redhat.com/archives/libvir-list/2011-August/msg00339.html

Comment 1 Daniel Veillard 2011-08-11 03:06:44 UTC
I ACK'ed the patch upstream as I think that by definition transient domains
are to be managed by the application on top of libvirt. That's a design choice
and I think the API is consistent with this, in that case really it's a missing
check from my POV,

Daniel

Comment 2 Daniel Veillard 2011-08-15 02:43:10 UTC
Commited upstream as 0de75e855b0c37a7ef25370b19cabad34e679ce6

Comment 4 dyuan 2011-08-16 08:02:10 UTC
Reproduce this issue with libvirt-0.9.4-2.el6.

# virsh create dom.xml 
Domain dom-create created from dom.xml

# virsh list --all
 Id Name                 State
----------------------------------
  8 dom-create           running

# virsh managedsave dom-create
Domain dom-create state saved by libvirt

# virsh list --all
 Id Name                 State
----------------------------------

# virsh define dom.xml 
Domain dom-create defined from dom.xml

# virsh start dom-create
error: Failed to start domain dom-create
error: operation failed: cannot restore domain 'dom-create' uuid a89394e5-d6d5-e87b-a270-8246ecbb3a98 from a file which belongs to domain 'dom-create' uuid 4d662f3b-99ff-4b31-60cb-7b7fa1f922be


Verified PASS with libvirt-0.9.4-4.el6.

# virsh create dom.xml 
Domain dom-create created from dom.xml

# virsh list --all
 Id Name                 State
----------------------------------
  8 dom-create           running

# virsh managedsave dom-create
error: Failed to save domain dom-create state
error: Requested operation is not valid: cannot do managed save for transient domain

# virsh list --all
 Id Name                 State
----------------------------------
  8 dom-create           running

Comment 5 errata-xmlrpc 2011-12-06 11:26:05 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.

http://rhn.redhat.com/errata/RHBA-2011-1513.html