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):
... or also with current git/master
Fixed upstream by:
Author: Pino Toscano <email@example.com>
AuthorDate: Wed Aug 24 16:14:23 2016 +0200
Commit: Michal Privoznik <firstname.lastname@example.org>
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.
The fix was released as part of libvirt-2.2.0.