Bug 735498 - libvirt undefine on running guest should allow transition from persistent to transient
Summary: libvirt undefine on running guest should allow transition from persistent to ...
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.2
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Eric Blake
QA Contact: Virtualization Bugs
Depends On: 735495
Blocks: 638510
TreeView+ depends on / blocked
Reported: 2011-09-02 20:05 UTC by Eric Blake
Modified: 2011-12-06 11:28 UTC (History)
7 users (show)

Fixed In Version: libvirt-0.9.4-9.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2011-12-06 11:28:18 UTC

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1513 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2011-12-06 01:23:30 UTC

Description Eric Blake 2011-09-02 20:05:50 UTC
Description of problem:
Libvirt can convert a transient guest to persistent (by defining the xml for a running domain), and the public API for virDomainUndefine claimed that the converse of converting a persistent back to transient was possible (by undefining a running domain).  However, the qemu driver was rejecting this.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. create and start a persistent guest
2. use virDomainUndefine to convert it to persistent
Actual results:
step 2 is rejected by the qemu driver (also, note that bug 735495 also documents that it is rejected by 'virsh undefine'; you'd have to use python, perl, or C bindings to test this to make sure virsh is not in the way)

Expected results:
after step 2, the domain should still be running, but show up as transient

Additional info:

Comment 1 Eric Blake 2011-09-02 20:12:03 UTC
Getting this fixed will help in testing bug 638510 support for live snapshots via the snapshot_blkdev qemu monitor command, since one of the snapshot transitions that must be properly handled is creating an offline snapshot of a persistent guest, starting the guest, converting the guest to transient, then stopping the guest, and seeing if the metadata is properly cleaned up.  It also brings the code into compliance with the API documentation.

See these upstream commits (the second even includes the test described in the original comment)

commit aaa93ab6faa178406d9a472f6002a6985e5ebc72
Author: Osier Yang <jyang@redhat.com>
Date:   Fri Aug 19 21:49:37 2011 +0800

    qemu: Allow to undefine a running domain

commit 5f98c437077e2ee7f7cf8c8d8427966d60c7e539
Author: Eric Blake <eblake@redhat.com>
Date:   Fri Aug 19 08:57:22 2011 -0600

    test: rewrite test to match change in behavior
    Test failure exposed in commit 7d3390f.
    * tests/undefine: Fix to match updated test driver semantics.

Comment 5 yuping zhang 2011-09-07 08:10:58 UTC
Reproduce this issue libvirt-0.9.4-7.el6.x86_64:
# virsh list --all
 Id Name                 State
  2 rhel6             running
# virsh undefine rhel6
error: Failed to undefine domain rhel6
error: Requested operation is not valid: cannot delete active domain

Verified this issue with:


# virsh list --all
 Id Name                 State
  2 rhel6             running

# virsh undefine 2
Domain 2 has been undefined

# virsh shutdown 2
Domain 2 is being shutdown

# virsh list 
 Id Name                 State

So change the status to VERIFIED.

Comment 6 errata-xmlrpc 2011-12-06 11:28:18 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.


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