Bug 735495 - virsh should have better snapshot support
Summary: virsh should have better snapshot support
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:
Blocks: 638510 735498
TreeView+ depends on / blocked
Reported: 2011-09-02 19:56 UTC by Eric Blake
Modified: 2011-12-06 11:28 UTC (History)
7 users (show)

Fixed In Version: libvirt-0.9.4-8.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2011-12-06 11:28:14 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 19:56:58 UTC
Description of problem:
snapshots are difficult to manipulate in virsh.  Some of the fixes require upstream additions (either new flags to existing commands, or new APIs altogether) which cannot be backported, but for the most part, there are a lot of useful upstream features that belong in RHEL 6 alongside the improved snapshot support for bug 638510.  Also, backporting earlier virsh features will make backporting later virsh features easier, rather than facing conflict resolution when backporting just those later features

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

How reproducible:

Steps to Reproduce:
1. figure out the name of the current snapshot using shell code
2. figure out the name of a snapshot's parent using shell code
3. try to send a multi-word qemu monitor command, such as 'info block'
4. try to undefine an active domain, to see what happens to snapshots
5. etc.
Actual results:
1. Not easy - 'virsh snapshot-current dom' dumps the entire xml, which you then have to parse
2. Not easy - nothing dumps the name of a snapshot's parent except 'virsh snapshot-dumpxml dom name', which you then have to parse
3. Not easy - requires extra shell quoting: virsh qemu-monitor-command dom --hmp 'info block'
4. Not possible - even though the API allows this transition, 'virsh undefine' forbids it without trying the API

Expected results:
1. 'virsh snapshot-current dom --name' is a nice addition
2. 'virsh snapshot-parent dom' is a nice addition, as is 'virsh snapshot-list --parent'
3. 'virsh qemu-monitor-command dom --hmp info block' is a nice addition
4. 'virsh undefine' no longer gets in the way of APIs
5. probably several others - I plan to use this BZ to scrape in all prerequisite virsh patches so that my snapshot series no longer has merge conflicts.

Additional info:

Comment 1 Eric Blake 2011-09-02 19:59:15 UTC
Getting this fixed is a prereq to bug 638510 support for live snapshots via the
snapshot_blkdev qemu monitor command.

It will make testing the various other patches easier, as well as avoiding merge conflicts which makes the code easier to maintain.  It is also well-isolated to virsh, without most patches not even touching libvirtd proper.

Comment 4 Nan Zhang 2011-09-13 10:51:43 UTC
Tested with libvirt-0.9.4-11.el6.x86_64, move this to VERIFIED.

1. # virsh snapshot-current rhel6 --name

2. # virsh snapshot-parent rhel6 s4

3. # virsh qemu-monitor-command rhel6 --hmp info block
drive-virtio-disk0: type=hd removable=0 file=/var/lib/libvirt/images/rhel6.img ro=0 drv=qcow2 encrypted=0

4. # virsh list
 Id Name                 State
  1 rhel6                running

# virsh undefine rhel6
Domain rhel6 has been undefined

# virsh list
 Id Name                 State
  1 rhel6                running

# virsh destroy rhel6
Domain rhel6 destroyed

# virsh list --all
 Id Name                 State

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