On Tue, Oct 13, 2020 at 06:45:42PM +0300, Nir Soffer wrote:
I think this is the right solution - when virt-something tool fails,
it should log the reason for the failure - the error that caused the
tool to fail. I'm not sure this is easy to do as the failing code
run inside a special VM. Maybe the code running in the VM should log
the output in a machine readable way, so once an error is detected
virt-something can report the error as the reason, without running
in debug mode.
All the virt-* tools that I've written have a non-zero exit code and
print an error message on stderr when they fail. Errors from inside
the appliance are propagated to the library and thence to the tool
correctly.
I think the best thing to do is:
- spool up stdout + stderr from the tool
- if the exit code != 0, save the spooled output for analysis
- if the exit code == 0, discard it (or keep it if you like)
Without LIBGUESTFS_DEBUG/LIBGUESTFS_TRACE stdout + stderr should be
quite minimal for all tools.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/