Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1358181

Summary: virsh does not always respect -q/--quiet
Product: Red Hat Enterprise Linux 7 Reporter: Pino Toscano <ptoscano>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED ERRATA QA Contact: Lili Zhu <lizhu>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.2CC: eskultet, jdenemar, libvirt-maint, pkrempa, ptoscano, rbalakri, xuzhang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-2.5.0-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1358179 Environment:
Last Closed: 2017-08-01 17:11:42 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: 1358179    
Bug Blocks: 910269, 1358142    

Description Pino Toscano 2016-07-20 09:15:53 UTC
+++ This bug was initially created as a clone of Bug #1358179 +++

Description of problem:
-q/--quiet is described to "Avoid extra informational messages."; however, it is not always respected.
For example, I can see the following:

$ virsh -q pool-refresh test
Pool test refreshed
$ virsh -q define some.xml
Domain test defined from some.xml
$ virsh -q pool-destroy test
Pool test destroyed
$ virsh -q undefine test
Domain test has been undefined

(there might be more, but I did not check further.)

Indeed, all these outputs use the internal vshPrint function, which just prints the message regardless of the debug level and the quiet flag.  From a cursory look, vshPrintExtra should instead respect -q.

Version-Release number of selected component (if applicable):
libvirt-client-1.3.3.1-4.fc24.x86_64
... or also with current git/master

Comment 2 Erik Skultety 2016-09-12 11:09:02 UTC
Fixed upstream by:

commit b620bdee14472c811a4f48b665c6f5dac43253d7
Author:     Pino Toscano <ptoscano>
AuthorDate: Wed Aug 24 16:14:23 2016 +0200
Commit:     Michal Privoznik <mprivozn>
CommitDate: Wed Aug 24 17:43:29 2016 +0200

    virsh: respect -q/--quiet more
    
    Turn various vshPrint() informative messages into vshPrintExtra(), so
    they are not printed when requesting the quiet mode; neither XML/info
    outputs nor the results of commands are affected.
    Also change the expected outputs of the virsh-undefine test, since virsh
    is invoked in quiet mode there.
    
    Some informative messages might still be converted (and thus silenced
    when in quiet mode), but this is an improvements nonetheless.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1358179

v2.1.0-rc1-209-gb620bde

Comment 5 Lili Zhu 2017-06-18 17:24:22 UTC
Reproduce the bug with build libvirt-2.0.0-10.el7.x86_64

# virsh -q pool-refresh pool-dir
Pool pool-dir refreshed

# virsh -q list --all
 5     rhel7.4v2                      running
 -     rhel7.4                        shut off
 -     rhel7.4_dump                   shut off

# virsh -q undefine rhel7.4
Domain rhel7.4 has been undefined

# virsh -q define rhel7.4.xml 
Domain rhel7.4 defined from rhel7.4.xml

# virsh -q pool-destroy pool-dir
Pool pool-dir destroyed


Verify the bug with build libvirt-3.2.0-10.el7.x86_64

# virsh -q pool-define dir.xml 
# virsh -q pool-start pool-dir
# virsh -q pool-refresh pool-dir
# virsh -q list --all
 5     rhel7.4v2                      running
 -     full-73                        shut off
 -     q35                            shut off
 -     rhel7.4                        shut off
 -     rhel7.4_dump                   shut off
# virsh -q undefine rhel7.4v2
# virsh -q destroy rhel7.4v2
# virsh -q define rhel7.4v2.xml.dump 
# virsh -q start rhel7.4v2

As the result match the expectation, mark the bug as verified.

Comment 7 errata-xmlrpc 2017-08-01 17:11:42 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.

https://access.redhat.com/errata/RHEA-2017:1846

Comment 8 errata-xmlrpc 2017-08-01 23:53:19 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.

https://access.redhat.com/errata/RHEA-2017:1846