The systemctrl ststus command does not work on all distirbutions. Add a check to see how to get the status.

Signed-off-by: Ray Spear <ray.spear@hp.com>
contrib/install-autotest-server.sh: Fix py 2.7 bug only if installed

Only try to work around a python 2.7 + selinux bug
if it is installed on the system.

Signed-off-by: Ray Spear <ray.spear@hp.com>
conmux/ivm: use immediate reboot rather than delayed

Delayed reboots use EPOW, which does not always result in a shutdown of
the LPAR. Use the more sever immediate shutdown, to ensure the LPAR goes
down. This matches the HMC code.

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
virt: add two scripts to disable services for perf tests

System services on guest and host take uncertain resource, it effects
the perf results. We can use the below two scripts to disable some
services of host and guest.

rh_stop_serivices.sh is used to stop the running serivices.
rh_off_service.sh is used to off services when host starts up.

We can use them to prepare environment for performance testcases.
Using scripts can split the environment preparation with real testing,
it's easy to maintain.

Those two scripts are prepared for RHEL/Fedora system, it's just an
example. Users can reference those to create their own scripts.

Signed-off-by: Amos Kong <akong@redhat.com>
virt: introduce services_setup()

Introduce services_setup() to setup services in guest/host.

Host reboot is not supported in client tests, you can submit
a job to setup host env, reboot host, then execute real tests.
The best solution is integrating this to kickstart.

example tests.cfg:
.. variances:
..     - prepare_env:
..         only boot
..         stop_services_script = scripts/rh_stop_services.sh
..         off_services_script = scripts/rh_off_services.sh
..     - perf_tests:
..         only ntttcp.guest_guest netperf.exhost_guest

Signed-off-by: Amos Kong <akong@redhat.com>
virt: pinning guest cpus to a numa-node

Currently we only pin guet memory to a numa-node,
taskset is used to pin vcpu thread to pyshical cpu core.
This patch pins guest cpus to a numa-node.

man page of numactl:
 --cpunodebind=nodes, -N nodes
   Only execute command on the CPUs of nodes.  Note that nodes may
   consist of multiple CPUs.  nodes may be specified as noted above.

Signed-off-by: Amos Kong <akong@redhat.com>
Fix wrong reference to image functions

Now that they were moved to virt_utils.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virt.qemu_io: Make QemuIO inherit from object

Constructs like

MyClass():

Without explicit inheritance are not allowed on py 2.4.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
kvm.tests.qemu_io_blkdebug: Fix up use of python > 2.4 construct

Replace it with a larger, more boring, but nevertheless,
working python 2.4 implementation.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
cobbler support: check profile and support arbitrary number of installation attempts

Check if the profile set on the resulting system is identical to the
one requested. If not, give the system another go at installing the
chosen profile. Also, add support for setting the number of installation
attempts.

This is related to github issue #279.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
tko: Improve autotest-db-delete-job

It was pointed out that autotest-db-delete-job was not
a complete solution for issue #123, since:
 * It didn't work if you already had removed the job dirs
 * It assumed a fixed autotest user
 * It didn't remove the jobs from the test view

This patch solves the remaining issues, now the tool
is more complete in usefulness for people wanting to
prune the results of a job.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
tko.autotest-db-delete-job: Try to completely remove job dir

Usually, the job tag looks like [number]-[user]/[machine].
Let's download the parent [number]-[user] parent if possible

As a result, the script won't leave empty job result
directories.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virt: integrate perf tunning to env script

This patch integrate rh_off_services.sh and rh_stop_services.sh to
one script, and ded setup of arp_filter, bridge, runlevel.

Signed-off-by: Amos Kong <akong@redhat.com>
virt: update services_setup()

Signed-off-by: Amos Kong <akong@redhat.com>
virt: use services_setup() in tests

This patch uses services_setup() in reboot/netperf to
setup environment.

We might use disk snapshot in netperf test when boot up
more than one guests, setup would not effect, so
execute a reboot test and setup env at that time.

example tests.cfg:
.. variances:
..     - prepare_env:
..         only reboot
..         rh_perf_envsetup_script = scripts/rh_perf_envsetup.sh
..         rebooted = none
..     - reboot_host:
..         # host needs reboot, client test doesn't support it, you can
..         # submit two jobs, one for env preparation, one for real test)
..     - perf_tests:
..         only netperf.exhost_guest
..         rh_perf_envsetup_script = scripts/rh_perf_envsetup.sh

Signed-off-by: Amos Kong <akong@redhat.com>
cobbler support: fix typo when parsing the configuration file

The last patch had a typo and was fetching the number of attempts
from the 'type' entry in the config file, instead of the obvious
'num_attempts' entry.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
client: Don't create tests/download directory unless needed

job.run_test() may take a url parameter, that usually
is the test name, however it can take an actual url
with a .tar.bz2 test. However, if we're not going to
use this feature, this directory is not needed, and if
needed, the directory will be created by the install
from url code.

Therefore, remove this to better comply with packaging
requirements (people might feel uneasy about autotest
creating directories on python site-packages dir in a
compulsory way). Update the job unittest accordingly.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
client job: Make packages dir configurable

This patch adds pkg_dir option in COMMON section in
global_config.ini that, when set, would be assign to
pkgdir attribute of the base_job class.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
client job: Make state file directory configurable

On a system wide install, it is undesirable that the
control file state files are located in the same directory
as the control files, since that location will be read
only for non root users, for example:

/usr/lib/python2.7/site-packages/autotest/client/tests/sleeptest/control.state

So make this directory configurable, hence allowing autotest
to write job state files there on a system wide install
yet leaving non root users able to run jobs.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Fixing a couple of wrong unittest imports

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