libguestfs: Add testcases for error_test of guestfs_add.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
libguestfs.test: Fix guestfs_add for new libguestfs version.

In new libguestfs version, all disks will be recognised with /dev/sdx.
But virtio disks of vm will be /dev/vdx in vm.So change gotten
/dev/sdx in guestfish to /dev/vdx if it is necessary.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
virt:Fix a hidden bug in virt_filesystems

Signed-off-by: Li Yang <liyang.fnst@cn.fujitsu.com>
virt:Add a function to get primary disk filesystem type

Signed-off-by: Li Yang <liyang.fnst@cn.fujitsu.com>
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: Make macvtap support hotplug

This patch add support of hotplug/unplug nic with macvtap

Signed-off-by: Yunping Zheng <yunzheng@redhat.com>
tests: Add a case to install hck client in Windows guest

Signed-off-by: Yiqiao Pu <ypu@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>
device_bit_check.cfg: replace scsi_extra_params_hda with blk_extra_params

change the parameter name scsi_extra_params_hda to blk_extra_params.

Signed-off-by: Xiangmin Han <xhan@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>
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>
libvirt: Fix schedinfo cgroup bug

This fix use 'open' instead of 'cat' to access cgroup file to prevent
problem if slash ('\') exist in file path.

If the cgroup path has a 'emulator' sub-directory. We need to trim it to
get the desired cgroup file.

Signed-off-by: Hao Liu <hliu@redhat.com>
tests.nicdriver_unload: Make the guest nic also named eth0

When run nicdriver_unload test, will raise error like:
013-04-16 21:35:55: modprobe virtio_net
2013-04-16 21:35:56: [root@unused ~]#
2013-04-16 21:35:56: echo $?
2013-04-16 21:35:56: 0
2013-04-16 21:35:56: [root@unused ~]#
2013-04-16 21:35:56: ifconfig eth4 up
2013-04-16 21:35:56: eth4: unknown interface: No such device
2013-04-16 21:35:56: [root@unused ~]#
2013-04-16 21:35:56: echo $?
2013-04-16 21:35:56: 255
2013-04-16 21:35:56: [root@unused ~]#
2013-04-16 21:35:56: udev: renamed network interface eth0 to eth4

the root cause of this cause is after the nic driver loaded,
the nic name not changed immediately by udev rules, because
the guest is under heavy working pressure.

This patch modify the guest udev net rules before test,
make guest nic always nemed eth0.

Signed-off-by: Yunping Zheng <yunzheng@redhat.com>
utils_cgroup: fix the regexp in get_cgroup_mountpoint()

The last patch done by me has a bug in the regexp that it also takes
the " cgroup" or " type" from the cgroup mounts. This patch fix the
issue by updating the regexp.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
utils_cgroup: Fix get cgroup mount point

Checking get_all_controller is no longer needed since the controller
must be invalid if it's not in mount table.

get_all_controller in another function is also not needed because it is
followed by a get_cgroup_mountpoint which will raise exception if
controller is invalid.

Unit test is also added for get_cgroup_mountpoint.

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