KVM test: Refine image_check function
With the accumulated experience running the KVM test to
perform quality control on our KVM branches, we noticed
that qemu-img check might return exit code != 0, but
not all failures mean some data integrity problem happend.
After checking qemu-img check code, we found out that:
Exit code 1: Check error. Problem on the check itself,
most of the time harmless, however there is some risk
of data corruption.
Exit code 2: Data corruption error. This means for sure
that disk corruption happened. Bad, bad.
Exit code 3: Leaked clusters error. This means some
leaked clusters were found on the image, which is not
a data corruption condition, it only means that some
space is going to be lost on that image.
So, refine the logic of the image_check function, executing
qemu-img check and verifying its exit code
Exit code 1: Raise error.TestWarn
Exit code 2: Raise VMImageError
Exit code 3: Raise error.TestWarn
This change, together with the new logic of the KVM
run_tests() utility function, will make it possible
to still fail tests in cases 1) and 3), but letting
the dependencies to be executed.
Changes from v1:
* Print stdout and stderr of the checking program in cases 1) and
2), to help debug eventual problems.
Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
git-svn-id: svn://test.kernel.org/autotest/trunk@5298 592f7852-d20e-0410-864c-8624ca9c26a4