libvirt-test: numatune: Fix some bugs

* VM XML omit numa entry when the placement is auto and mode is strict.
  So we need to set numa_params manually when exception happens.

* Fix typo in cfg file which causes duplicated test name. s/config/live/

* Fix typo. s/KeyError()/KeyError/

* Move restoration of cgroup to finally section to make sure cgroup can
  be restored even when exception happens.

Signed-off-by: Hao Liu <hliu@redhat.com>
virttest: fix login refused when nettype is user

when nettype is 'user' localhost used as hostname by default, and login
windows guest via nc failed; fix it by get hostname/IP address via
socket module;

Signed-off-by: Xu Tian <xutian@redhat.com>
virttest.data_dir: add interface to get deps dir

Signed-off-by: Xu Tian <xutian@redhat.com>
virttest: Make macvtap support hotplug

This patch add support of hotplug/unplug nic with macvtap

Signed-off-by: Yunping Zheng <yunzheng@redhat.com>
virttest:virt_vm: Do not raise VMAddressVerificationError when SR-IOV card used

SR-IOV card may not in same subnet with the card used by host by
default. So arp check cannot work.
At this situation verify_ip_address_ownership will raise
VMAddressVerificationError even IP and mac match.
So do not raise VMAddressVerificationError when SR-IOV used.

Signed-off-by: Feng Yang <fyang@redhat.com>
virttest.test_setup: Update the re used to filter eth name in host.

Signed-off-by: Feng Yang <fyang@redhat.com>
virttest.qemu_vm: Only use B:D.F format as pci_id when add VF/PF to VM

RHEL 6 guest do not support domain name when add VF/PF to VM.

Following command will raise error:
pci-assign,host=<domain>:<bus>:<slot>.<func>

Signed-off-by: Feng Yang <fyang@redhat.com>
virttest.test_setup: Remove commands module.

Python in my local pc will get following error:
>>> import commands
>>> commands.getstatus("lsmod | grep igb")
'ls: cannot access lsmod | grep igb: No such file or directory'
>>>

python version is Python 2.7.5 (default, Aug 20 2013, 06:42:55)

So remove commands module and use utils.system instead.

Signed-off-by: Feng Yang <fyang@redhat.com>
virttest.utils_net: Make update_mac_ip_address works in more linux guest.

ifconfig output is different among linux guest.

In rhel6 guest:
switch    Link encap:Ethernet  HWaddr 00:23:AE:8F:50:B4
          inet addr:10.66.8.107  Bcast:10.66.11.255  Mask:255.255.252.0
          inet6 addr: 1111:2222:3333:4444:5555:6666:7777:8889/64 Scope:Global
          inet6 addr: fe80::223:aeff:fe8f:50b4/64 Scope:Link

In other guest:
switch: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.66.73.190  netmask 255.255.254.0  broadcast 10.66.73.255
        inet6 fe80::4f4:dff:fee8:a4ba  prefixlen 64  scopeid 0x20<link>
        ether 06:f4:0d:e8:a4:ba  txqueuelen 1000  (Ethernet)

So we need update the way used to filter mac and ip from ifconfig output.

Signed-off-by: Feng Yang <fyang@redhat.com>
qemu.tests.sr_iov_hotplug: Make driver parameter configurable.

Signed-off-by: Feng Yang <fyang@redhat.com>
libvirt-test: Fix cpu-stats cgroup problem

* This fix use utils_cgroup to get cgroup path instead of using
  hard-coded path which causes compatibility problem.

* Built in python module is used to get processors' count instead
  of hard-coded command line.

* These tests is still failing because of a bug of return values.

Signed-off-by: Hao Liu <hliu@redhat.com>
qemu.tests.pci_devices: Get firmware time to initialize

Before "info qtree" returns the correct values, firmware initialization
has to finish. 10s should be enough (in case we won't define 1000
devices)

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
qemu.tests.pci_devices: Add virtio_disk testing devices

This patch adds the possibility to use virtio_disks for testing.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
qemu.tests.pci_devices: Add support for uhci test device

Make it possible to use ich9-usb-uhci controller for pci_devices testing

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virttest.qemu_devices: Fix the bug with overwritten bus for virtio disk

The bus property of virtio disks is set by pci_bus and is set during
device insertion via parent_bus.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
qemu.tests.pci_devices: Major config update

Original setups were only for developing the test and some of them
were invalid (impossible for real hw and thus unsupported by kernel).
These setups were checked with pci device developer and they should be
working properly.
qemu.tests.multi_nic_stress: Correct remote netperf folder in guest.

Signed-off-by: Feng Yang <fyang@redhat.com>
qemu.tests: new case for timedrift testing

changes from V1:
    1. fix typo and update doc strings

Signed-off-by: Xu Tian <xutian@redhat.com>
virsh_migrate_multi_vms: SKIP if srcuri and desturi not defined

Issue #1014, SKIP this test if we haven't adjusted the cfg to have
real source and destination URI's
libvirt: Fix memtune cgroup bug

The original code use 'cat' to get the content of a cgroup file. This
will cause problem if the file name contains slash '\' in it. This
fix change it by using 'open' to read.

BTW, This commit also merged some repeat helper functions.

Signed-off-by: Hao Liu <hliu@redhat.com>