Bug 1358179

Summary: virsh does not always respect -q/--quiet
Product: [Community] Virtualization Tools Reporter: Pino Toscano <ptoscano>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: eskultet, libvirt-maint, rbalakri, rjones
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1358181 (view as bug list) Environment:
Last Closed: 2016-09-12 11:07:21 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:    
Bug Blocks: 910269, 1358181    

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.