KVM test: Refine image_check function
commitba23e9089c9df0e490894199e0f6f49432be5444
authorlmr <lmr@592f7852-d20e-0410-864c-8624ca9c26a4>
Mon, 11 Apr 2011 01:37:49 +0000 (11 01:37 +0000)
committerlmr <lmr@592f7852-d20e-0410-864c-8624ca9c26a4>
Mon, 11 Apr 2011 01:37:49 +0000 (11 01:37 +0000)
tree05ae1a00ab25c6d1de0c326c9e5c69d0de99a5e9
parentff2dc6c9754853c9f6cbfa9e621823c83802fbfa
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
client/tests/kvm/kvm_vm.py