virttest.virsh: Add wrapper for nodesuspend

Add standard wrapper function in virsh.py for calling virsh command
`nodesuspend`.

Signed-off-by: Hao Liu <hliu@redhat.com>
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>
add support extra_cdrom_ks installation for WinNT6.0 guest

Signed-off-by: Xu Tian <xutian@redhat.com>
update ks to execute finish.bat from root partition

Signed-off-by: Xu Tian <xutian@redhat.com>
Always keep screendumps

screendumps are important, the current
policy of saving it when case error only is
not enough, if a VM network works fine and
case pass, but VM vga malfunction, deleted
them would potential miss bugs

Signed-off-by: Xiaoqing Wei <xwei@redhat.com>
virttest.virsh: Fix API nodedev_list

This commit makes nodedev_list according with other APIs.
(Use virsh optional option name as API keyword argument name)

Signed-off-by: Hao Liu <hliu@redhat.com>
Disable strict host key checking for ssh session

Because of StrictHostKeyChecking=ask is the default setting in ssh config,
If there is no host key for the server, it will show the fingerprint and
ask to confirm, And because of we already set /dev/null as the user host
key database, the ssh connection always waits for the test scripts answers
"yes" for confirmation. So the test scripts will be blocked at this stage.
(unless the option StrictHostKeyChecking has been disabled in command-line
or /etc/ssh/ssh_config or ~/.ssh/config)

Signed-off-by: Lin Ma <lma@suse.com>
Couple of miscellaneous fixes

utils_misc: Need to add parameter for a %s directive in message
            for get_qemu_binary method

utils_test/libvirt: Use 'permissive' not 'Permissive' since the set_status
                    expects the lower case

virsh: Simple typo in comment for net_state_dict() which was copied from
       a similar pool function, but the comment change was missed
virt: Modify return value of virsh.version() function
data_dir: Add target parameter fo get_deps_dir()

With this parameter, get_deps_dir() will only deps folder
which contains target file/folder.

Signed-off-by: Feng Yang <fyang@redhat.com>
virttest.env_process: Record qemu pid in screendump folder name.

Sometimes, Two qemu may share same vm.name. So add qemu pid to
screendump folder name.

Signed-off-by: Feng Yang <fyang@redhat.com>
virttest.qemu_vm: Update clone VM to env in vm.migrate().

Now we do not record cloned VM to env. So we only can catch screendump
for source VM.

Signed-off-by: Feng Yang <fyang@redhat.com>
virttest.env_process: Encode screendump image to video in postprocess()

Now we Encode screendump image to video in postprocess_vm(), but it could only
encode source VM's image to video in migration.
So move the function to postprocess()

Signed-off-by: Feng Yang <fyang@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>
Add acpiphp for hotplug tests for suse products

Signed-off-by: Lin Ma <lma@suse.com>
libvirt_xml: Change wrong parameter 'pathname' to 'path'.

The pathname is not defined here, then we will get an UnboundLocalError
when use it.

	# python virttest/libvirt_xml_unittest.p
	Eg:
	.........................E.....................
	======================================================================
	ERROR: test_no_module (__main__.testLibrarian)
	----------------------------------------------------------------------
	Traceback (most recent call last):
	  File "virttest/libvirt_xml_unittest.py", line 669, in test_no_module
	    badname)
	  File "/usr/lib64/python2.6/unittest.py", line 335, in failUnlessRaises
	    callableObj(*args, **kwargs)
	  File "/add_storage/yds/autotest/client/tests/virt/virttest/libvirt_xml/devices/librarian.py", line 24, in get
	    handler_cl = base.load_xml_module(mod_path, name, DEVICE_TYPES)
	  File "/add_storage/yds/autotest/client/tests/virt/virttest/libvirt_xml/base.py", line 228, in load_xml_module
	    % (name, pathname, str(detail)))
	UnboundLocalError: local variable 'pathname' referenced before assignment

	----------------------------------------------------------------------
	Ran 47 tests in 3.034s

	FAILED (errors=1)

This patch change the pathname to correct 'path';

After this patch applied:

	# python virttest/libvirt_xml_unittest.p
	...............................................
	----------------------------------------------------------------------
	Ran 47 tests in 0.409s

	OK

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
virt: Adapt the utils_misc_unittest to new utils_misc.

Commit f9ec296d (Update utils to support pin multiple threads to one node)
changed the utils_misc.NumaNode, then the unittest of it got a fail:

	# python virttest/utils_misc_unittest.py
	.F.F......WARNING:root:Git repo foo tag is not signed
	WARNING:root:This means we will not verify if the key was made by whomever claims to have made it (dangerous)
	...
	======================================================================
	FAIL: test_free_cpu (__main__.TestNumaNode)
	----------------------------------------------------------------------
	Traceback (most recent call last):
	  File "virttest/utils_misc_unittest.py", line 177, in test_free_cpu
	    self.assertEqual(self.numa_node.dict["0"], "1230")
	AssertionError: ['1230'] != '1230'

	======================================================================
	FAIL: test_pin_cpu (__main__.TestNumaNode)
	----------------------------------------------------------------------
	Traceback (most recent call last):
	  File "virttest/utils_misc_unittest.py", line 150, in test_pin_cpu
	    self.assertEqual(self.numa_node.dict["0"], "1230")
	AssertionError: ['1230'] != '1230'

	----------------------------------------------------------------------
	Ran 13 tests in 0.003s

	FAILED (failures=2)

This patch adapt the unittest to the new data type.

	# python virttest/utils_misc_unittest.py
	..........WARNING:root:Git repo foo tag is not signed
	WARNING:root:This means we will not verify if the key was made by whomever claims to have made it (dangerous)
	...
	----------------------------------------------------------------------
	Ran 13 tests in 0.002s

	OK

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>