Bug 1358179 - virsh does not always respect -q/--quiet
Summary: virsh does not always respect -q/--quiet
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: TRACKER-bugs-affecting-libguestfs 1358181
TreeView+ depends on / blocked
 
Reported: 2016-07-20 09:09 UTC by Pino Toscano
Modified: 2016-09-12 11:07 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1358181 (view as bug list)
Environment:
Last Closed: 2016-09-12 11:07:21 UTC
Embargoed:


Attachments (Terms of Use)

Description Pino Toscano 2016-07-20 09:09:27 UTC
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 1 Erik Skultety 2016-09-12 11:05:08 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

Comment 2 Erik Skultety 2016-09-12 11:07:21 UTC
The fix was released as part of libvirt-2.2.0.


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