Bug 856528

Summary: List option --state-shutoff should filter guest properly
Product: Red Hat Enterprise Linux 6 Reporter: Luwen Su <lsu>
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.4CC: acathrow, bili, dyasny, dyuan, mzhan, pkrempa
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-0.10.2-0rc1.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-21 07:23:34 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:

Description Luwen Su 2012-09-12 08:44:05 UTC
Description of problem:
the --state-shutoff option can't list shutoff guest if not combine with --all or --inactive and there is no spical usage in help

Version-Release number of selected component (if applicable):
libvirt-0.10.1-1.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1.
# virsh list --all
 Id    Name                           State
----------------------------------------------------
 1     test                           paused
 11    test-1                         running
 20    test-abi                       running
 -     block                          shut off
 -     test-snap                      shut off

2.
# virsh list --state-shutoff
 Id    Name                           State
----------------------------------------------------


3.
#virsh list --state-shutoff --inactive
 Id    Name                           State
----------------------------------------------------
 -     block                          shut off
 -     test-snap                      shut off
  

Actual results:
Can't list shutoff guest


Expected results:
List shutoff guest without --inactive or --all

Additional info:
In help doc , 
    --state-running  list domains in running state
    --state-paused   list domains in paused state
    --state-shutoff  list domains in shutoff state
    --state-other    list domains in other states
there is no specail requrement for the option.If the result is expected , should add more details into the doc?

Comment 2 Peter Krempa 2012-09-17 09:04:50 UTC
Unfortunately, due to historic reasons, virsh lists only active guests by default. I posted a patch to clarify that some combinations of flags produce no results:

http://www.redhat.com/archives/libvir-list/2012-September/msg01150.html

Comment 3 Peter Krempa 2012-09-17 14:44:21 UTC
Docs fixed upstream:
commit 60b0284f24c3187bfa2225f1715c30b9d6a2eb1c
Author: Peter Krempa <pkrempa>
Date:   Mon Sep 17 10:57:41 2012 +0200

    virsh: Clarify behavior of domain list filtering.
    
    Some combinations of filtering flags produce no result. This patch tries
    to clarify this.

Moving to POST.

Comment 5 EricLee 2012-09-20 08:46:53 UTC
Verifying the bug:

Reproduction:
-------------
Reproduced this issue in env below. 
# rpm -qa libvirt
libvirt-0.10.1-1.el6.x86_64

Steps:
# man virsh
....
           Normally only active domains are listed. To list inactive domains specify --inactive or --all to
           list both active and inactive domains.

           To filter the list of domains present on the hypervisor you may specify one or more of filtering
           flags supported by the list command.  These flags are grouped by function. Specifying one or more
           flags from a group enables the filter group. Supported filtering flags and groups:
....

Result:
Some behavior of domain list filtering is not clear.

Verification:
-------------
Verified in env below with same steps as above.
# rpm -qa libvirt
libvirt-0.10.2-0rc1.el6.x86_64

# man virsh
....
           Normally only active domains are listed. To list inactive domains specify --inactive or --all to
           list both active and inactive domains.

           To further filter the list of domains you may specify one or more of filtering flags supported by
           the list command. These flags are grouped by function.  Specifying one or more flags from a group
           enables the filter group. Note that some combinations of flags may yield no results. Supported
           filtering flags and groups:

....

Result:
There is clearer info of "Note that some combinations of flags may yield no results.".


Conclusion:
-----------
As per above, this bug has been fixed.

Moving to VERIFIED.

Comment 6 errata-xmlrpc 2013-02-21 07:23:34 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