virt: Regex strings must begin with r

Signed-off-by: Chris Evich <cevich@redhat.com>
virttest.aexpect: Close tail thread fd on thread end

When the aexpect "tail" thread is requested to stop, take the chance
and close the filedescriptor being used by that thread. This makes up
for a big decrease in the number of open fds over the course of a
default virt test set. Before the patch, in 10 migrations tests
executed, the evolution of fds open is:

26 -> 31 -> 36 -> 41 -> 46 -> 51 -> 56 -> 61 -> 66 -> 71

After the patch, the evolution goes:

23 -> 25 -> 27 -> 29 -> 31 -> 33 -> 35 -> 37 -> 39 -> 40

That's quite a nice cleanup.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virttest.qemu_vm: Make the qemu process a Tail object rather than Expect

Checking up the qemu vm code, I noticed that none of the
uses of vm.process actually requires it to be an Expect
object. By using a Tail object, we obtain the same features
we've been using the code for, and we get rid of an extra
expect reader pipe, that ends up accumulating over the course
of the tests.

So make a function aexpect.run_tail(), nearly identical to
aexpect.run_bg(), and make vm.process to be a tail object.
With this change,  we further reduce the open number of open
fds from:

23 -> 25 -> 27 -> 29 -> 31 -> 33 -> 35 -> 37 -> 39 -> 40

to:

22 -> 23 -> 24 -> 25 -> 26 -> 26 -> 28 -> 29 -> 30 -> 31

If you guys can see any disadvantages of simplifying things
here, let me know.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virttest.aexpect: Don't remove inpipe server side

The clients will do that on close() anyway.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virttest.aexpect: Introduce server side logging

Make the aexpect server able to log into a file. As it
is, we don't really have an easy way to tell what's going
on in there.

On later patches, we'll implement better ways to manage
files generated by aexpect, as well as debugging mechanisms.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virttest.aexpect: Change file/log directory structure

Instead of having a flat structure of files

BASE_DIR/[filename]-[aexpect_instance]

Make the aexpect instance the parent dir of the files

BASE_DIR/[aexpect_instance]/filename

That makes it easy to see the number of open aexpect
controlled process at any given point in time, while
keeping information available.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Merge pull request #1098 from autotest/fd-leak

virttest.aexpect: FD leak fixes
virttest.utils_env: Check the whether the key is none before using it.

When get vm objects from Env object, the key of the data maybe None.
if the key is None, will raise error like:
   'NoneType' object has no attribute 'startswith'.

Signed-off-by: Yunping Zheng <yunzheng@redhat.com>
Merge pull request #1109 from humanux/env_issue

virttest.utils_env: Check the whether the key is none before using it.
virt: Fix filesystem type in mtab don't have to be same like fs in mount cmd

example:
   mount -t glusterfs server1:/vol_test /tmp/gmount-dMZ4hf

   cat mtab
     server1:/vol_test /tmp/gmount-dMZ4hf fuse.glusterfs rw,...

Signed-off-by: Jiří Župka <jzupka@redhat.com>
virt: Adds support for filesystem backend to storage.

backend could be glusterfs, nfs, ...
Only gluster fs implemented now.
Necessary for gluster testing.

Signed-off-by: Jiří Župka <jzupka@redhat.com>
virt: gluster split create and get path functionality.

It should be possible get gluster volume path without create
gluster volume.

Signed-off-by: Jiří Župka <jzupka@redhat.com>
virt: Adds support for qcow2 backing file.

Signed-off-by: Jiří Župka <jzupka@redhat.com>
virt: Adds support for check disk in storage with native support (gluster).

Signed-off-by: Jiří Župka <jzupka@redhat.com>
virt: env_preprocess adds support for image backend.

Gluster and iSCSI storage are special because it is supported
native in qemu-kvm different way from other storage backend.

-drive gluster://server1:0/vol_test/f19-64.qcow2
-drive iscsi://<target-ip>[:<port>]/<target-iqn>/<lun>

other backends are firstly connected to system filesystem and
then used through the file path in VM like normal file or
uses other method like p9.

Signed-off-by: Jiří Župka <jzupka@redhat.com>
virt: Change config files to use image_backend config.

Signed-off-by: Jiří Župka <jzupka@redhat.com>
virt: Adds some gluster tests.

Tests:
1) boot_snap_boot.
2) gluster image create test.

Signed-off-by: Jiří Župka <jzupka@redhat.com>