virsh.schedinfo_qemu_posix: update the way we get the cgroup path

Now we have a new way how to obtain the correct cgroup path for
specific cgroup controller for a guest.

Let's use the new way also for the "schedinfo_qemu_posix" test.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
staging.utils_cgroup: change the regexp for finding correct cgroup path

The current approach will not properly find the path for "cpu"
controller. I've updated the regexp to match the correct "cpu".

In the "get_cgroup_mountpoint" we are searching the system
cgroup mountpoint from "/proc/mounts" where there could be right
now two types of mounts:

    cgroup on /sys/fs/cgroup/cpuset type cgroup (...)
    cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (...)

The second one makes thinks a little bit harder and we have to check
if the path ends with comma or space.

In the "resolve_task_cgroup_path" the situation is similar. We are
searching the exact path of specified controller for some guest
and there are also two types of records:

    4:cpuacct,cpu:/machine/guest.libvirt-qemu/emulator
    3:cpuset:/machine/guest.libvirt-qemu/emulator

There are thins even harder then the previous case. We need to get
only the 3th part of the record with the path. For the "cpuacct"
we have to consume also the "cpu" and that's why I'm using lookahead
in the regexp instead of the simple match to be able consume always
the remaining controller part until the colon.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
qemu.test: add pktgen stress test

This patch add pktgen stress test for nic test

Signed-off-by: Yunping Zheng <yunzheng@redhat.com>
qemu.test: add netperf stress test

This patch add netperf stress test for nic test

Signed-off-by: Yunping Zheng <yunzheng@redhat.com>
qemu.test: add file copy stress test

This patch add file_copy stress test, you can run multi sessions copy
during test.

Signed-off-by: Yunping Zheng <yunzheng@redhat.com>
qemu.test: add multi queues number change test

This patch add change queues number test for multi queues nic.
also support change queues number test under stress.

Signed-off-by: Yunping Zheng <yunzheng@redhat.com>
qemu.test :add max queues test for mq

Add test config for multi queues max queues

Signed-off-by: Yunping Zheng <yunzheng@redhat.com>
qemu.test: Modify multi queues tests

This patch rewrite multi queues tests, run netperf using netperf_stress
as a sub tests. using utils_netperf run netperf.

Signed-off-by: Yunping Zheng <yunzheng@redhat.com>
virsh_snapshot_create_as: Adjustments from review

A review comment/suggestion from @liyangfnst after pull request #1174
was merged to master was to make the entire test use try/finally type
logic so as to only run the xml_recover from one place...

This change implements that concept.
virsh_snapshot_edit: Resolve test errors

Test was failing because the 're.search()' wasn't stripping off the
newline character from the after_xml, thus not allowing the match check
to determine if the <description> changed. Changed the error processing
to list the 15 or so relevant lines from the snapshot dump xml that
could be different if the re.search() fails.

Remove the extraneous .strip() from the after_xml creation since it's
repeated in the snap_xml_compare() method when doing the comparison
with the pre_xml. Also changed the logic on error path to just print
some different lines rather than printing both whole pre/after xml
and forcing an eyeball comparison for why the test failed.
Merge pull request #1206 from ldoktor/virtio_console

qemu.tests.virtio_console: Update test_hotplug_virtio_pci
PEP8 mass auto fix

Catching up with some problems found w.r.t. coding style

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Merge pull request #1208 from autotest/pep8-fix

PEP8 mass auto fix
Fix a wrong logical judgment in get_target_id()

  * Wrong using 'elif' instead of 'if', then it will never judge if this target using
    the emulated image name.
  * Delete the duplicated judgment when cleanup.

Signed-off-by: Yanbing Du <ydu@redhat.com>
libirt: Add test for virsh find-storage-pool-sources-as

Signed-off-by: Yanbing Du <ydu@redhat.com>
virsh_start: Need to ensure stopped before run

When run after virsh.shutdown, the first virsh.start was failing with
because the domain was already started.  Adjusted the .cfg file to
ensure setting of the 'kill_vm_before_test' in the status_error_no
variant.

Also, changed the error returned from using 'stdout' to 'stderr' so that
"Domain is already active" would be displayed.
virttest.env_process: Remove restart_vm option

The restart_vm option, that will restart a vm at the beginning
of postprocessing, is unnecessary, given that you could
simply shut down all the VMs at the end of each test,
forcing new vms to be started.

So get rid of this option, and replace --restart-vm
in ./run to use kill_vm = yes instead.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Merge pull request #1214 from autotest/restart-vm

virttest.env_process: Remove restart_vm option
virttest: Fix network xml sync with state unchanged

When using original sync of NetworkXML class to restore a backup
network, it is redefined and started, leaving autostart disabled.
This is not the default setting (all true for active/persistent/
autostart) for the network.

In this modification, we set the default behavior of sync to
set all state to true. With the help of an optional "state" dict
parameter, we can restore the network to any state you like, or
in practical, to the state we backed up.

To facilitate this backup & restore process, I also added a helper
function state_dict() to retrieve a active/persistent/autostart
dict for backing up current vm state.

The unittest for these network manipulators is given in a new file
instead of libvirt_xml_unittest.py to separate manipulator tests
from XML base test.

Furthermore, The net_state_dict function use an outdated way to get
the persistent property for the network, which is already changed
by a patch (commit 895913d) in libvirt-0.10.2. The persistent status
can be retrieved from net_list directly. So I add a condition to
ensure it can be backported for older libvirt while avoiding
redundant call of net_autostart when testing on new libvirt.

This backport can be removed if old libvirt no longer maintained.

Signed-off-by: Hao Liu <hliu@redhat.com>
virt-libvirt: VirshPersistent Noise reduction

This class was logging a debug event every time it successfully
reused an aexpect session.  Since aexpect always loggs the command
being run anyway, this extra detail is mostly redundant.  If there's
a problem, an exception will be thrown anyway.

Signed-off-by: Chris Evich <cevich@redhat.com>