lvsb.tests: add network options test cases for the virt-sandbox cmdline

Signed-off-by: Alex Jia <ajia@redhat.com>
Tests.vol_create_from: Replace pool operations with libvirt_storage module.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
libvirt.tests: Move nfs/iscsi setup&cleanup to utils_test module.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
libvirt.tests: Replace volume operations with libvirt_storage.PoolVolume.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
libvirt.tests: Adjust vol_create_from test.

Functions for preparing pool and volume for test is useful
in other test modules. So move it to utils_test.libvirt.

Then in some failed conditions, it will leave many iscsi
devices on host. We should keep it clean.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
libvirt.tests: Fix virsh.vol_create_from test bug.

When creating logical pool, pool_target should be volume
group's path. But it has been fixed to vg_logical in pre_pool,
so target in configuration should be vg_logical too.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
libvirt-tests: Add test case for migrate-compcache

Test command: migrate-compcache <domain> [--size <number>]

* Run migrate-compcache command and check return code

Signed-off-by: Hao Liu <hliu@redhat.com>
tp-libvirt: Add macvtap interface test

Signed-off-by: Li Yang <liyang.fnst@cn.fujitsu.com>
Add support of enable/disable second video device screenshot

RHEL support multiple video devices screenshot with given screen
number while Fedora upstream did not support it. With this change,
user can config enable/disable multiple_screen in cfg file to
enable/disable tests with screen number as 1. By default in cfg
file multiple_screen is set as 'no'.

RHEL multiple video device screenshot tracking bug:
  https://bugzilla.redhat.com/show_bug.cgi?id=1026966
  https://bugzilla.redhat.com/show_bug.cgi?id=710489

Signed-off-by: Wayne Sun <gsun@redhat.com>
virsh.start: Add tests for starting long-named VM

This fix is a regression test for bug:
https://bugzilla.redhat.com/show_bug.cgi?id=1060557

Signed-off-by: Hao Liu <hliu@redhat.com>
libvirt.tests: Minor changes for vol_create_from test.

1.Change logical pool target to vg_logical to cordinate with source
2.Subtract emulated image size for saving time
3.Debug more clear for created volumes

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
tp-libvirt: Add '--reason' option test for virsh domstate

Signed-off-by: Li Yang <liyang.fnst@cn.fujitsu.com>
find_storage_pool_sources: Handle failures better

If the 'setup_or_cleanup_iscsi()' fails, then we are returned nothing and
continuing is fatal for any of the subsequent callers - so just error
out indicating that we were unable to setup the iscsi device.

Additionally, I had a run on an f19 system where the vg_create() was
failing. That failure caused test failure, but didn't clean up the
iscsi server, so add logic to handle the failure.

Without the try/except - the failure is just an ERROR with ugly
traceback in the debug.log:

ERROR type_specific.io-github-autotest-libvirt.virsh.find_storage_pool_sources.positive_test.local_logical_source -> CmdError: Command <vgcreate virttest_vg_0 /dev/sda> failed, rc=5, Command returned non-zero exit status    [context: Creating volume group 'virttest_vg_0' by using '/dev/sda']
* Command:
    vgcreate virttest_vg_0 /dev/sda
Exit status: 5
...
  Device /dev/sda not found (or ignored by filtering).
  Unable to add physical volume '/dev/sda' to volume group 'virttest_vg_0'.
...
numatune: Check for required utility

The test liberally uses the 'numactl' utility, but does not first
verify that the tool exists resulting in FAIL's rather than SKIP's.
Don't assume control groups active

The test as written assumes control groups are active, thus when attempting
to stop and restart things don't necessarily go 'as expected'.  Furthermore,
the failure path where different results are expected when stopped won't be
a failure resulting in a test FAIL that isn't valid.

Modify the test such that when it's stopping control groups - keep track
of whether they were started before stopping, then in the methods to
{set|get}_numa_parameters() add a check in the expected failure path to
not FAIL the test if cgroups were not stopped.

Adjust the libvirtd restart logic a bit since that restart is only
necessary if control groups were stopped.

Swap order to finally to restore guest state as the libvirtd restart
can fail/except thus we wouldn't have restore the guest leading to
potential other problems.

Signed-off-by: John Ferlan <jferlan@redhat.com>
virsh_find_storage_pool_sources_as: Error checking

If the setup_or_cleanup_iscsi() fails to configure our iscsi device,
just cause the test to fail. It's not getting much further anyway.
libvirt-tests: Enhancement virsh setmaxmem to test --config, --live and --current.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
tp-libvirt: Add '--title' option test for virsh list

Signed-off-by: Li Yang <liyang.fnst@cn.fujitsu.com>
libvirt.tests: Fix the boundary test issue in nwfilter define cases

With libvirt commit 4f20943 in upstream, nwfilter check strict
boundary values when define filter. The RHEL did not include the
commit yet, this will cause different result as run on fedora and
RHEL. For fix this, add boundary error cases in negative cases,
and a new param 'boundary_test_skip' to enable skip the negative
boundary cases in RHEL or other unsupported strict check binaries.
The positive cases also updated with delete all boundary negative
values.

By default in test cfg, 'boundary_test_skip' is set as 'yes', which
will enable skip such negative boundary cases on RHEL, but fedora
will get pass as expected.

Updated use try..finally to make sure cleanup excuted finally.

The issue detail is recorded in:
https://github.com/autotest/tp-libvirt/pull/3/#issuecomment-34099397

Signed-off-by: Wayne Sun <gsun@redhat.com>
libvirt.tests: Add test for vol-clone and vol-wipe

Signed-off-by: Yanbing Du <ydu@redhat.com>