autotest / virt-test

Linux Virtualization Tests
Other
97 stars 139 forks source link

Problem with error handler during Env initialization #122

Closed LaneWolf closed 11 years ago

LaneWolf commented 11 years ago

When autotest does not successfully load env from file during initialization, it try to handle exception by printing last traceback info and reseting to empty state. However, some of the errors does not setup traceback so we raise another exception in exception handler:

AttributeError: 'module' object has no attribute 'last_type'

I'm not able to reproduce this error reliably but it usually occurs to me when I try to run virt-test suite for firstime (no env file present - after fresh install, obsolete env - after update). II'm not able to hit the error twice in a row (after I see this error I'm unable to hit it again).

ldoktor commented 11 years ago

Hi, it might most probably be old version env. This happens when env contains a structure of updated class (eg. when VM class adds some attribute, old one can't be loaded and whole env initialization fails). Fix is to delete env file and rerun the test.

lmr commented 11 years ago

Hey guys, I'm pretty sure I solved this problem with this commit:

commit c66dbed7791750857a754166679c1a7d4c560326
Author: Lucas Meneghel Rodrigues <lmr@redhat.com>
Date:   Mon Nov 26 21:14:30 2012 -0200

    utils_misc: Fix exception handling when restoring env file

    If we had an exception loading the environment, we
    won't have an exception in the trace stack, so an
    error like:

    21:12:18 ERROR| Traceback (most recent call last):
    21:12:18 ERROR|   File "/home/lmr/Code/virt-test.git/virttest/standalone_test.py", line 85, in run_once
    21:12:18 ERROR|     env = utils_misc.Env(env_filename, self.env_version)
    21:12:18 ERROR|   File "/home/lmr/Code/virt-test.git/virttest/utils_misc.py", line 395, in __init__
    21:12:18 ERROR|     traceback.print_last()
    21:12:18 ERROR|   File "/usr/lib64/python2.7/traceback.py", line 250, in print_last
    21:12:18 ERROR|     raise ValueError("no last exception")
    21:12:18 ERROR| ValueError: no last exception
    21:12:18 ERROR|
    21:12:18 ERROR| FAIL -> ValueError: no last exception

    Will be thrown. Instead, let's just error the exception
    thrown as an error message.

    Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>

Now, given that we still stumble sometimes when trying to load the env file, I'm writing patches to clean the env file before each run of the virt tests. Stay tuned :)

ldoktor commented 11 years ago

Hi Lucas, yes this works pretty well. The question is, whether it's sufficient. Usually when you have env corrupted, the /tmp/address_poll is obsolete too. The format is OK, but the information might not be valid. I remember that with lots of guests I ends up with the same mac addresses with an incorrect IP.

The question is, when you ignore corrupted env, shouldn't you also clean the address_poll?

lmr commented 11 years ago

I believe so. I'll leave this open for now so I remember to do it.

lmr commented 11 years ago

Ok, with commit 0190fdfecd7abf772b76fff6387839b04ad01951 we also clear the address_pool. Closing this issue.