libvirt.tests: Support multiple devices for multifunction test.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
libvirt.tests: Add testcases for single_device of multifunction.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
libvirt.tests: Add testcases for multi_devices in multifunction.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
virttest: Call utils_net.update_mac_ip_address() in vm.create() when mac_changeable set to yes

Sometime we directly call vm.create() to create a VM. mac_changeable could not work
in this situation. As it only used in qemu test so move utils_net.update_mac_ip_address()
to vm.create() function.

If other test need support mac_changeable later, we can call  update_mac_ip_address
in its start() function.

Signed-off-by: Feng Yang <fyang@redhat.com>
virttest: Move nic_script under tap device branch in add_net

nic_script should be parameter for tap devices, so move it to
the right place. And now we can not control guest to use nic_script
or fds with cfg files as tapfds are automatic get by framework functions
only depends on the host env. So update the judgement as if we setup
nic_scritp, will let guest use script, otherwise will try to use fds.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
Add test for snapshot current and parent

Signed-off-by: Kyla Zhang <weizhan@redhat.com>
qemu:Disable balloon_fix_value case in ppc64

ppc64 platform does not support X86 ACPI s3 and s4 cases,
disable it in ppc64 platform

Signed-off-by: Man Li <limansh@cn.ibm.com>
Signed-off-by: Mike Qiu <qiudayu@linux.vnet.ibm.com>
tests.kdump: Add new sub test for multiple guests

define some functions for kdump, maybe other case
can reuse these functions late.

Signed-off-by: Shuping Cui <scui@redhat.com>
virttest.utils_libguestfs: Add functions for file operations.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
utils_test.libguestfs: Add functions for file operations.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
libguestfs.tests: Add test module for libguestfs file operations.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
virttest.utils_misc: Allow null source passed to umount.

Sometimes, we don't know what's source is, but mountpoint
can still be umounted, so allowing to pass null for umount.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
qemu.tests.multi_disk_random_hotplug: Improve the unplug part

This patch changes the handling of unplug. The simplu_unplug has sometimes
problem detecting correctly the unplug status, as it might take seconds
before the disk is removed (monitor returns output, but qemu still
waits for OS repsonse before it removes the device from qtree).

This custom handler waits up to 1s for device to be removed and even
when it's not proved to be removed it removes it from representation.
We can afford this as all devices are again checked later in the test
and the VM state is for the whole period set to dirty.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
qemu.tests.multi_disk_random_hotplug: Improve logging

Add context for easier debugging.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
qemu.tests.multi_disk_random_hotplug: Put images_define in try/catch

The qdev.images_define_by_variables needs to be in the try/except
block in order to work as expected (remove format and try another round)

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
qemu.tests.multi_disk_random_hotplug: raise exception if no disks added

With incorrect configuration it might happen that no disks can be added.
Throw exception instead of simple warning and clean test run.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
libvirt_vm: remove setup_serial_ports() method.

Commit c37a86ca picked out the create_serial_console() from setup_serial_ports(),
and call it in env_process(). But it is not robust enough.

This patch rename the setup_serial_ports() to create_serial_console() to be called
in env_process() and remove the older create_serial_console().

Reported-by: Yanbing Du <ydu@redhat.com>
Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Reviewed-by: Yanbing Du <ydu@redhat.com>
Tested-by: Yanbing Du <ydu@redhat.com>
virt-test: add Fedora 20

Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
virt-libvirt: net_state_dict() use another virsh

This virsh module function becomes a Virsh class method, but
internally it makes other calls to the virsh module directly.
Sometimes this is not what is needed, rather a specific Virsh
class instance should be used (i.e. to run against a remote
system or with special args/dargs).  Added a parameter
with None default to allow this.  Fixed up all references to
this function so they also pass through proper virsh_instance
state.

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: unittest virsh isolation

Many unittests require testing codepaths containing
the virsh module and/or Virsh() class instances.  However
it is necessary to isolate them from eachother AND provide
a check to make sure no "real" system-virsh calls are made.

To make this work easier for other unittests, added a
factory function that returns a mocked Virsh() class instance.
Every closed method on this instance will raise a
bogusVirshFailureException (subclass of
unittest.TestCase.failureException).

Now, unittest tests only need to call this function and
override the resulting instance's methods as needed for
testing.  I also added a unittest to do a basic check of
this new unittest helper function.

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