virttest.qemu_devices: Support aliases in has_device

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virttest.qemu_vm: Utilize aliases support in add_pcidevice

qemu_devices support aliases so we can just ask for the desired device.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virttest.qemu_vm: add_pcidevice bugfixes

* check params of the desired device_driver instead of pci-assign
* log the fail_params instead of the last used param

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virttest: Make Numa related functions can work on host have disabled node

Now the functions and classes caculate node id by nodes number. And
in a host have disabled node, it may give scripts the disabled node
id. This patch will fix this problem by use available nodes to decide
the node scripts should use.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
utils_misc: Update mount check function and fix a wrong arg in umount

When checking mountpoints, the nfs type displays 'nfs4' if mount
version 4 NFS server, so use a regex to search the mount items.
NFS not mounted is not an error, so change the message to debug
level.

Remove umount step as it doesn't make sense to umount in a mount
function.

In the umount function, the second arg in utils.system() is timeout,
so fix it as well. Also, disable verbose by default for
mount/umount/is_mount functions.

Signed-off-by: Yanbing Du <ydu@redhat.com>
virttest.iscsi: Fix a regex and log level

As the newly updated of iscsi related packages, the output of iscsi
session is different from the past, so update the regex when
searching iscsi device name to adapt the update.

If no iscsi device, it should report error instead of debug msg.

Signed-off-by: Yanbing Du <ydu@redhat.com>
setup_or_cleanup_iscsi: Robust assumptions and pep8 fix

When reviewing jferlan's PR(tp-libvirt#47) to fix vol_create_from case,
i found the problems also exist in setup_or_cleanup_iscsi(), so pick up
the fixes:

When setup iscsi env, the function assumed that the iscsi tools
'tgtadm' and 'iscsiadm' were present on the host which may cause
all sorts of errors and failures. So before running these commands,
make sure the tools exist.

Additionally within iscsi_login, extended testing found that the SCSI
/dev/sdxx device didn't instantaneously appear. Sometimes it took an
extra second or two to appear, so added a loop for get_device_name().

Meanwhile, a pep8 fix to make sure no more combined module imports.

Signed-off-by: Yanbing Du <ydu@redhat.com>
Merge pull request #1477 from will-Do/iscsi_fix

iscsi related issues fixed
virttest.iscsi: Fix unittest for system_output.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
utils_test.libvirt: Add test class for pool&volume.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
utils_test.libvirt: Fix PoolVolumeTest.pre_pool bugs.

1.Support to specify source path for nfs creating.
2.Volume Group path will not exist if there is no any volume in.
  So prepare one here to help creating new volumes in test.
3.Nfs server used for creating pool should not be mounted.
  Otherwise, it will be more like dir type pool.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
libvirt_storage: output more debug info for create_volume.

There will be no enough information if created volume can
not be found.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
utils_test.libvirt: Support specific size for disk volumes.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
Fix libvirtd status check function

If libvirtd not running(stop, corrdump, etc.), service check command
always exit with code 3:
$ service libvirtd status
Redirecting to /bin/systemctl status  libvirtd.service
libvirtd.service - Virtualization daemon
   Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; disabled)
   Active: inactive (dead) since Tue 2014-03-18 17:43:26 CST; 3h 9min ago
  Process: 6034 ExecStart=/usr/sbin/libvirtd $LIBVIRTD_ARGS (code=exited, status=0/SUCCESS)
 Main PID: 6034 (code=exited, status=0/SUCCESS)

$ echo $?
3

And it's wrong to raise LibvirtdActionError, on system which using
systemd, it may looks like:
LibvirtdActionError: Failed to status libvirtd.
Detail: Redirecting to /bin/systemctl status  libvirtd.service

So remove this exception and just output the debug log.

Signed-off-by: Yanbing Du <ydu@redhat.com>
virttest: Add debug option to ssh and dhclient command

Add debug option to ssh and dhclient command to get more information
to figure out if a test failed is caused by netowrk env problem.
Also let dhclient do not run in background to show the infomrmation.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
Merge pull request #1479 from will-Do/mount_fix

utils_misc: Update mount check function
Merge pull request #1492 from yumingfei/poolvolumetest

utils_test.libvirt: Add PoolVolumeTest class.
virttest.utils_test.libvirt: PEP8 Fixes

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Merge pull request #1512 from ypu/net_env_debug

virttest: Add debug option to ssh and dhclient command
Merge pull request #1494 from ldoktor/framework2

virttest.qemu_devices: Support for aliases