virttest: Close and re-establish serial console every test

In order to not pickle Expect and ShellSession objects,
that will lead to one fd leak average per test, make
sure they are closed and reopened at each test, making
the average fd leak on virt-tests to be effectively 0.

With this we've came a long way since the work of fixing
resource leakage on virt-test started. There are more
places to work on, let's keep on working.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virttest.aexpect: Put shell files on aexpect process dir

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virttest.aexpect: Remove the entire aexpect tmp dir on close()

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virttest.qemu_vm: Bugfix - make seabios file to be deleted on destroy

Turns out we were clearing self.logs even when there was
a previous vm state. This made the seabios file to not
be deleted during vm cleanup. Let's fix this by moving
initialization of the variable to the right block.

With this, now virt-test won't leave tons of /tmp/seabios*
sockets around even when it is done.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virttest.qemu_vm: Better naming and management of vm create lock file

First of all, the lock file wasn't updated since this
test suite was known as kvm-autotest, second, it wasn't
being properly cleaned up at the end of the creation
process, when it should. So let's fix both problems
at once.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virttest.aexpect: Simplify base dir name

The _spawn suffix is reminiscent of an implementation
detail, so it shouldn't be there.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virttest.utils_net: Make db filename a module constant and delete lock

One more step to clean up temporary files virt-test leaves
behind.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virttest.aexpect: Introduce clean_tmp_files utility function

It makes up for cleaner cleanup code in the stand alone
test suite code.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virttest.utils_net: Introduce clean_tmp_files utility function

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virttest.standalone_test: Improve tmp files cleanup code

Make the tmp files cleanup code to run at the beginning
of the test suite execution, and also at the end. The
cleanup code was generalized and cleaned up, using the
new utility functions in aexpect and utils_net.

With this, at the end of a clean virt-test execution,
no tmp files are left behind.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
run: Kill vms and clean tmp files on Ctrl+C handler

Make the cleanup_env method more generic, and add it
to the KeyboardInterrupt handler of virt-test. This
way, users that do kill their virt-test execution
will have all vms and temporary files properly
cleaned.

This way, no temporary files will be around even
on Ctrl + C termination.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virttest.data_dir: Add clean_tmp_files() utility function

Use it in the cleanup environment function as well.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
guest-os: add RHEL6.5

Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
Merge pull request #1160 from autotest/fd-cleanup

virttest: Close and re-establish serial console every test
Merge pull request #1163 from rbbratta/rhel65

guest-os: add RHEL6.5