run: qemu - Add support to enable vhost

Make it more convenient to enable vhost=on or vhostforce=on
using the test runner. As of now, bridge access still
requires root, so you'd need to run things as root:

sudo ./run -t qemu --nettype bridge --vhost on

or

sudo ./run -t qemu --nettype bridge --vhost force

CC: Richa Marwha <rmarwah@us.ibm.com>
CC: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virt: Cartesian config bug repair.

https://github.com/autotest/virt-test/issues/199

There was too aggressive branch config filtering for achieving
better performance.

Before:
  1) config branch not produce any dict.
  2) save filters which block this branch.
  3) if **one** of filter will be in content next time
     then don't use this branch again.
  =>) wrong filtering

Now:
  1) config branch not produce any dict.
  2) save filters which block this branch.
  3) if **all** of filter will be in content next time
     then don't use this branch again.
  4) else check branch again for new dicts.

Signed-off-by: Jiří Župka <jzupka@redhat.com>
virt: Cartesian config speed and memory optimization.

Memory:
  It uses __slots__  instead of dict in class.
Speed:
  Replaces in most of cases very slow operation Template.substitute
  by faster version.
  These changes reduce time for big config file by 1/4 of time.

Signed-off-by: Jiří Župka <jzupka@redhat.com>
run: --no flag is actually a general flag

There is nothing specific to qemu in the --no flag,
but it was on the qemu group. Let's move it to
the general group.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
qemu/cfg/tests.cfg - Exclude multi host tests

Multi host tests can't be executed on the standalone
runner, so we've got to filter them out. This way
we'll have a lot less results displayed when listing
tests for, say, Fedora.18.x86_64, but the list will
be more accurate.

CC: Jiri Zupka <jzupka@redhat.com>
Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
netperf: introduce an agent to launch client sessions

Currently we use many threads/heavy control sessions to launch many
clients, Autotest takes too much of the host resources.

This patch introduces an agent script, it'll be executed inside the
client system to launch multiple sessions, and Autotest only needs
to use one background thread to control clients.

We can consider to process the raw results in this agent script in
future, if it can help to simplify the case.

Signed-off-by: Amos Kong <akong@redhat.com>
utils_misc: Add a function to normalize the data size

Normalize a data size in one order of magnitude to another (MB to GB,
for example). In this function you can also change the factor as you
need, the default factor is 1024.

changes from v1:
  - rename the function and variables
  - update the method for getting a fraction.
  - Add unittests

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
qemu/cfg/tests-example.cfg: Update examples to use current Fedora

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virt: Make an example for set up params based on the kernel version

This is an example for set up params based on kernel version defined
in a cfg file named host-kernel.cfg. The main function for package
check(package_check) is in the control.kernel-version. Take
this as an example as kernel is a very important part in kvm test
and will decide a set of common parameters using in the cases. You
can also setup yourself host-package.cfg for different type of tests
in the same way.

changes from v1:
  - fix the typo for host_kernel_version_str
  - add one parameter for whether print out the debug messages
changes from v2:
  - typo fix

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
virttest.standalone_test:avoid to division by zero

When run the command ./run -t qemu as default,
all the case may skip. and this will raise an error:
TESTS: 13
(1/13) migrate.default.tcp: SKIP
(2/13) migrate.default.unix: SKIP
(3/13) migrate.default.exec: SKIP
(4/13) migrate.default.fd: SKIP
(5/13) migrate.default.mig_cancel: SKIP
(6/13) migrate.with_set_speed.tcp: SKIP
(7/13) migrate.with_set_speed.unix: SKIP
(8/13) migrate.with_set_speed.exec: SKIP
(9/13) migrate.with_set_speed.fd: SKIP
(10/13) migrate.with_reboot.tcp: SKIP
(11/13) migrate.with_reboot.unix: SKIP
(12/13) migrate.with_reboot.exec: SKIP
(13/13) migrate.with_reboot.fd: SKIP
TOTAL TIME: 9.58 s
Internal error, traceback follows...
Traceback (most recent call last):
  File "/home/Mike/autotest/client/tests/virt/virttest/standalone_test.py", line 872, in run_tests
    _job_report(job_elapsed_time, n_tests, n_tests_skipped, n_tests_failed)
  File "/home/Mike/autotest/client/tests/virt/virttest/standalone_test.py", line 659, in _job_report
    float(n_tests - n_tests_skipped)) * 100)
ZeroDivisionError: float division by zero

So just check if n_tests equals to n_tests_skipped to avoid
this error

Signed-off-by: Mike Qiu <qiudayu@linux.vnet.ibm.com>