libvirt: Add test module for virsh domblkinfo.

Signed-off-by: Li Yang <liyang.fnst@cn.fujitsu.com>
virt: Add virsh function for virsh domblkinfo.

Signed-off-by: Li Yang <liyang.fnst@cn.fujitsu.com>
virt: Add get_disk_source() for virsh domblkinfo.

Signed-off-by: Li Yang <liyang.fnst@cn.fujitsu.com>
libvirt: fix a bug for virsh domblkinfo

Signed-off-by: Li Yang <liyang.fnst@cn.fujitsu.com>
libvirt: Avoid size check if disk format isn't 'raw'.

Signed-off-by: Li Yang <liyang.fnst@cn.fujitsu.com>
Merge pull request #318 from liyangfnst/domblkinfo

Add test for virsh domblkinfo v4
virttest.qemu_storage: FIX Don't overwrite backup image during preprocess

After the test during check_image the backup image was still being
overwritten.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
utils_net : Add the lost api in utils_net

This patch add the lost APIs in utils_net, something wrong happended
when rebase the patch(commit 9efb355).

Signed-off-by: Yunping Zheng <yunzheng@redhat.com>
virttest.qemu_vm: Add get_monitors_by_type() function

This function can be used to get monitors of the given type.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
qemu.tests.qmp_*: Use VM.get_monitory_by_type() function

Use VM.get_monitory_by_type() function to get QMP monitor(s).

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
qemu.tests.qmp_event_notification: Fix config main_monitor

The main monitor name is overriden to hmp1 and causes test failures...

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
qemu.tests.qmp_*: Pylint/style changes

No actual changes.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
Revert "virttest.qemu_vm: Add freq option to usb device"

This reverts commit fadf99e6c0b1bdd86315040b3d3a35a804a550e8.

The freq option was removed in commit:
https://github.com/autotest/autotest/commit/93acc8819c8d912f2f3bf6f4d5d66bc2c99181a4
Thus revert this commit from virt-test.

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
virt.qemu_vm: Get usb device pci address with get_free_pci_addr()

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
virt.qemu_vm: Refactory get_free_usb_port function

This patch rewrites the get_free_usb_port function:
 * Moving it out of make_create_command function.
 * Creating some helper function.

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
virt.qemu_vm: Add support for usb-hub device

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
virt.qemu_vm: Add usb_bus/port parameters for usb device

With these 2 parameters you can assign a specific bus/port
for usb device.

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
qemu.test.cfg: Add usb-hub related test

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
qemu.qemu_img:Fix convert.to_qed and to_raw test cases SKIP

Currently, qemu.convert.to_qed and qemu.convert.to_raw will
be skip, and the log is:

17:37:31 INFO | SKIP qcow2.virtio_blk.smp2.virtio_net.
Fedora.18.x86_64.qemu_img.convert.to_qed -> ParamNotFound:
Mandatory parameter 'compressed' is missing.
Check your cfg files for typos/mistakes

This is because in convert test, it will use params["compressed"]
and params["encrypted"], but for to_qed and to_raw, the two params
does not exist. In old version virttest, it will be OK, as it use
params.get("compressed"), and this will return 'None', the test can
run safely.

But in the new version, it will just SKIP due to no param 'compressed'.

This patch fixes problem with these two cases.

Signed-off-by: Mike Qiu <qiudayu@linux.vnet.ibm.com>
qemu.tests: Add a subtest tsc_drift

Use taskset to set the CPU affinity of tsc read program in both guest and host.
Make the code easy to read and drop the tsc list for both guest and host.
Signed-off-by: Amos Kong <akong@redhat.com>

Use more reasonable varialbe name and optimize the code path.
Signed-off-by: Jason Wang <jasowang@redhat.com>

Convert tsc_drift ratio to absolute value
If tsc_drift ratio is a large negative, case could not raise exception.

Signed-off-by: Amos Kong <akong@redhat.com>

Filter integer from the return value of get_tsc

If the return value of get_tsc() contains other string, it will fail to convert
the return value to float. Use re.findall('(\d+)',o)[0] to filter tsc value.

Signed-off-by: Amos Kong <akong@redhat.com>

tsc_drift: Fix a bug of set CPU affinity

We need set process running on a single processor. There is a misunderstand of
mask and cpulist.
 "taskset 1 command": command will execute on CPU0 or CPU1, not only CPU1
 "taskset -c 1 command": command will only execute on CPU1

Signed-off-by: Amos Kong <akong@redhat.com>
Reported-by: Shuxi Shang <sshang@redhat.com>

Update interface to fit the new framework

Signed-off-by: Feng Yang <fyang@redhat.com>
Signed-off-by: Yiqiao Pu <ypu@redhat.com>