Bug 876817

Summary: virsh should make it easier to filter snapshots by type
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.4CC: acathrow, dallan, dyasny, dyuan, eblake, mzhan, rwu, whuang, zhpeng
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-0.10.2-10.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 874171 Environment:
Last Closed: 2013-02-21 07:26:38 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 638512, 874171    
Bug Blocks: 881827    

Comment 1 Eric Blake 2012-11-15 03:30:16 UTC
As we add more snapshot capabilities, it becomes more important to have 'virsh snapshot-info' tell details about whether a snapshot is internal or external, and to have 'virsh snapshot-list' gain new filtering flags (such as --external) to quickly see which snapshots have which properties.  This will involve backporting this upstream series:
https://www.redhat.com/archives/libvir-list/2012-November/msg00688.html

Comment 5 Huang Wenlong 2012-11-27 09:35:04 UTC
verify this bug with :
libvirt-0.10.2-10.el6.x86_64
qemu-kvm-rhev-0.12.1.2-2.337.el6.x86_64


1) start qcow2 domain then 
 
[root@intel-q9400-4-7 ~]# virsh snapshot-create-as bug active-internal
Domain snapshot active-internal created
[root@intel-q9400-4-7 ~]# virsh snapshot-create-as bug active-external --memspec /tmp/bug
Domain snapshot active-external created
[root@intel-q9400-4-7 ~]# virsh snapshot-create-as bug active-disk-only --disk-only
Domain snapshot active-disk-only created

2) destroy domain then 
[root@intel-q9400-4-7 ~]# virsh snapshot-create-as bug inactive-disk-only --disk-only
Domain snapshot inactive-disk-only created
[root@intel-q9400-4-7 ~]# virsh snapshot-create-as bug inactive-internal
Domain snapshot inactive-internal created

3) check snapshot-list 


# virsh snapshot-list bug
 Name                 Creation Time             State
------------------------------------------------------------
 active-disk-only     2012-11-27 17:24:11 +0800 disk-snapshot
 active-external      2012-11-27 17:23:59 +0800 running
 active-internal      2012-11-27 17:22:26 +0800 running
 inactive-disk-only   2012-11-27 17:24:57 +0800 shutoff
 inactive-internal    2012-11-27 17:25:06 +0800 shutoff

[root@intel-q9400-4-7 ~]# virsh snapshot-list bug --active 
 Name                 Creation Time             State
------------------------------------------------------------
 active-external      2012-11-27 17:23:59 +0800 running
 active-internal      2012-11-27 17:22:26 +0800 running

[root@intel-q9400-4-7 ~]# virsh snapshot-list bug --inactive 
 Name                 Creation Time             State
------------------------------------------------------------
 inactive-disk-only   2012-11-27 17:24:57 +0800 shutoff
 inactive-internal    2012-11-27 17:25:06 +0800 shutoff

[root@intel-q9400-4-7 ~]# virsh snapshot-list bug --external
 Name                 Creation Time             State
------------------------------------------------------------
 active-disk-only     2012-11-27 17:24:11 +0800 disk-snapshot
 active-external      2012-11-27 17:23:59 +0800 running
 inactive-disk-only   2012-11-27 17:24:57 +0800 shutoff

[root@intel-q9400-4-7 ~]# virsh snapshot-list bug --internal
 Name                 Creation Time             State
------------------------------------------------------------
 active-internal      2012-11-27 17:22:26 +0800 running
 inactive-internal    2012-11-27 17:25:06 +0800 shutoff

[root@intel-q9400-4-7 ~]# virsh snapshot-list bug --disk-only
 Name                 Creation Time             State
------------------------------------------------------------
 active-disk-only     2012-11-27 17:24:11 +0800 disk-snapshot
[root@intel-q9400-4-7 ~]# virsh snapshot-list bug --active --inactive 
 Name                 Creation Time             State
------------------------------------------------------------
 active-external      2012-11-27 17:23:59 +0800 running
 active-internal      2012-11-27 17:22:26 +0800 running
 inactive-disk-only   2012-11-27 17:24:57 +0800 shutoff
 inactive-internal    2012-11-27 17:25:06 +0800 shutoff

[root@intel-q9400-4-7 ~]# virsh snapshot-list bug --active --disk-only
 Name                 Creation Time             State
------------------------------------------------------------
 active-disk-only     2012-11-27 17:24:11 +0800 disk-snapshot
 active-external      2012-11-27 17:23:59 +0800 running
 active-internal      2012-11-27 17:22:26 +0800 running

[root@intel-q9400-4-7 ~]# virsh snapshot-list bug --active --internal
 Name                 Creation Time             State
------------------------------------------------------------
 active-internal      2012-11-27 17:22:26 +0800 running

[root@intel-q9400-4-7 ~]# virsh snapshot-list bug --active --external
 Name                 Creation Time             State
------------------------------------------------------------
 active-external      2012-11-27 17:23:59 +0800 running

[root@intel-q9400-4-7 ~]# virsh snapshot-list bug --inactive --disk-only
 Name                 Creation Time             State
------------------------------------------------------------
 active-disk-only     2012-11-27 17:24:11 +0800 disk-snapshot
 inactive-disk-only   2012-11-27 17:24:57 +0800 shutoff
 inactive-internal    2012-11-27 17:25:06 +0800 shutoff

[root@intel-q9400-4-7 ~]# virsh snapshot-list bug --inactive --internal
 Name                 Creation Time             State
------------------------------------------------------------
 inactive-internal    2012-11-27 17:25:06 +0800 shutoff

[root@intel-q9400-4-7 ~]# virsh snapshot-list bug --inactive --external
 Name                 Creation Time             State
------------------------------------------------------------
 inactive-disk-only   2012-11-27 17:24:57 +0800 shutoff

Comment 6 Huang Wenlong 2012-11-27 09:36:08 UTC
add some cases : 

[root@intel-q9400-4-7 ~]# virsh snapshot-list bug --disk-only --internal
 Name                 Creation Time             State
------------------------------------------------------------

[root@intel-q9400-4-7 ~]# virsh snapshot-list bug --disk-only --external
 Name                 Creation Time             State
------------------------------------------------------------
 active-disk-only     2012-11-27 17:24:11 +0800 disk-snapshot

[root@intel-q9400-4-7 ~]# virsh snapshot-list bug --internal --external
 Name                 Creation Time             State
------------------------------------------------------------
 active-disk-only     2012-11-27 17:24:11 +0800 disk-snapshot
 active-external      2012-11-27 17:23:59 +0800 running
 active-internal      2012-11-27 17:22:26 +0800 running
 inactive-disk-only   2012-11-27 17:24:57 +0800 shutoff
 inactive-internal    2012-11-27 17:25:06 +0800 shutoff

Comment 7 errata-xmlrpc 2013-02-21 07:26:38 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/RHSA-2013-0276.html