qemu.tests.usb: Make cmds in usb_hotplug test configurable

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
qemu.tests.cfg: Make usb_hotplug work on win guest

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
Merge pull request #550 from zhouqt/usb

qemu: Make usb_hotplug test work on Win guests
qemu.tests: Add block resize case

Add a case for block resize. Use monitor command to resize the block
device. And check it inside guest. This case support Windows and
Linux, qcow2 and raw, virtio_blk, virtio_scsi and ide with different
parameters.

* indentation fixed

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
virttest.test_setup: Add KSM setup class

This class will setup and clean KSM config in different hosts.
You can use setup_ksm to configure it. There are several params
that can be used for ksm configure:

ksm_pages_to_scan: pages ksmd will scan in one loop
ksm_sleep_ms: million secs ksmd will sleep between two scan
ksm_run: start ksmd or not
ksm_module: if ksm is not compiled into kerenl need this parameter
            tell scripts which module should it load
disable_ksmtuned: if we need idsable ksmtuned during our test

This class also can be used to disable KSM in some special case with
set setup_ksm to yes and ksm_run to 0 or no.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
qemu.tests:Add stress_kernel_compile test case.

Add stress test for multi vms with kernel compile running
inside vm.
1. boot up vms
every VM has 4G vmem, the total vmem of VMs' are
$overcommit times as host's mem.(default overcommit=1.5)
2) Launch kernel compile inside every guest.

Changes from v1:
 - modify the parameter "i" to "vmnum"
 - remove "raise error" when kernel compile failed, just return error
to avoid the long message cause virtlab crash
 - put kernel path to virtlab cfg files
 - change the test failed check to ping test, and judge if the guest
can be reach after kernel compile.

Signed-off-by: Golita Yue <gyue@redhat.com>
Signed-off-by: Yiqiao Pu <ypu@redhat.com>
Acked-by: Amos Kong <akong@redhat.com>

Bin folder has been removed and most file in it have been moved to
client folder.

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

Add new case timedrift_monotonicity.py
and check the guest time monotonicity after migration.
There are two case:
1. Take the guest time during migration and check time.
2. Let guest running long time after migration and
   check the time.

change from v1:
1. delete guest script, add function to get time in test case
2. fix typo

change from v2:
1. add cmd_timeout
2. add parameter for function get_time()

Signed-off-by: Golita Yue <gyue@redhat.com>
Acked-by: Qingtang Zhou <qzhou@redhat.com>
Acked-by: Yiqiao Pu <ypu@redhat.com>
qemu.tests: Add timedrift with cpu online/offline test case.

Add timedrift with cpu online/offline test case.
 Check the guest time after offline the cpu
 Check the guest time after online the cpu

change from v1:
1. fix typo
2. add more error.context for other steps

Signed-off-by: Golita Yue <gyue@redhat.com>
qemu.tests.timedrift_with_stop: Add functions for stopping qemu with signal

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
Acked-by: Feng Yang<fyang@redhat.com>
Acked-by: Yiqiao Pu <ypu@redhat.com>
qemu.tests: add kernel boot options for timedrift

changes from v1:
 - add boot options for remove.

changes from v2:
 - also fix guest kernel cmdline in other timedrift testcases.

changes from v3:
 - add a judgement for boot options, don't run this step if there
   is nothing to be add or remove

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
Signed-off-by: Amos Kong <akong@redhat.com>
Signed-off-by: Yiqiao Pu <ypu@redhat.com>
Acked-by: Feng Yang <fyang@redhat.com>
Acked-by: Suqin Huang<shuang@redhat.com>
qemu.tests: Measure increment of clock drift (100% load)

Add two parameters to let test case timedift.with_load
can be configured. When need run long time testing, can
reset the value "test_duration" & "interval_gettime".

Signed-off-by: Golita Yue <gyue@redhat.com>
qemu.tests: Add new subtest to qemu_img

Signed-off-by: Feng Yang <fyang@redhat.com>
KVM-Test: Boot/shutdown rebased image
Signed-off-by: Suqin Huang <shuang@redhat.com>
KVM Test: check the image after image creation.
KVM test: qemu_img: Pre-allocated metadata qcow2 format support
KVM Test: Raw device support for qemu_img test
KVM test: qemu_img add the qcow2 over LVM checking
Signed-off-by: Jason Wang <jasowang@redhat.com>
KVM Test: Add cluster_size_2048 test case.
Bug fix and add error.context in qemu_img.py script
Fix bug that guest start twice.
Signed-off-by: Feng Yang <fyang@redhat.com>
KVM-Test: qemu_img.py: update case with new autotest api
virt: Update 'guest_name' to 'os_type' in all scripts
Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
KVM-test: Update qemu_img commit test command to support Windows
Signed-off-by: Yiqiao Pu <ypu@redhat.com>
tests: Update nic driver directory in netstress_kill_guest.py

The nic driver directory is different for rhel4.9 guest
so make it configurable and update it to correct one.

Signed-off-by: Golita Yue <gyue@redhat.com>
Acked-by: Feng Yang <fyang@redhat.com>
qemu.tests: Add a qemu subtest script multi_vms_nics.py

Mainly test steps:
1. Check if the NIC number in guest matches that specified in config file.
2. Get the ip-mac pair in guest.
3. Gather the ping info by tcpdump.
4. Check if the ip-mac info matches in the tcpdump output.
5. Check if the ping count matches the given number.

Signed-off-by: Bear <byang@redhat.com>
Signed-off-by: Ken Cao <kcao@redhat.com>
Signed-off-by: Yolkfull Chow <yzhou@redhat.com>
Signed-off-by: Feng Yang <fyang@redhat.com>
KVM-test: Multi nic test case improve
Signed-off-by: Yiqiao Pu <ypu@redhat.com>
KVM Test: multi_nics: Fix argument order for scp_between_remotes
Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
KVM Test: Refactor multi_nics.py test script
Rename multi_nics.py to multi_vms_nics.py
Support multi vms and multi nics.
Signed-off-by: Feng Yang <fyang@redhat.com>
qemu: Fix syntax error in multi_nics.py
Signed-off-by: Feng Yang <fyang@redhat.com>
virt.tests: remove autotest.scrashme test

autotest.scrashme test is duplicate with autotest.flail, remove
autotest.scrashme test but no autotest.flail test because flail test's
"syscall_table" newer than scrashme test used;

Old syscalls that won't be tested anymore:

newstat
newfstat
newlstat
ni_syscall (uselib)
sysctl
umount
ni_syscall (create_module)
ni_syscall (get_kernel_syms)
ni_syscall (query_module)
ni_syscall (getpmsg)
ni_syscall (putpmsg)
ni_syscall (afs)
ni_syscall (tux)
ni_syscall (security)
ni_syscall (set_thread_area)
ni_syscall (get_thread_area)
ni_syscall (epoll_ctl_old)
ni_syscall (epoll_wait_old)
clock_retres
ni_syscall (vserver)
fstatat
timerfd
rt_tgsigqueueinfo
perf_counter_open

New syscalls that will be tested:

stat
fstat
lstat
uselib
_sysctl
umount2
create_module
get_kernel_syms
query_module
getpmsg
putpmsg
afs_syscall
tuxcall
security
set_thread_area
get_thread_area
epoll_ctl_old
epoll_wait_old
clock_getres
vserver
newfstatat
timerfd_create

Signed-off-by: Xu Tian <xutian@redhat.com>
qemu.tests: new test monitor_cmds_check

Check some advance commands not include qemu-kvm package

changes from v1:
    1. instead private code with function in framework
    2. fixed typo
    3. calll monitor.verify_supported_cmds driectly to check commands
    unavaliable
changes from v2:
    1. add notes in docstring
    2. instead filter function

Signed-off-by: Xu Tian <xutian@redhat.com>
qemu.tests: Add check SGABIOS info case for seabios.py

This patch add the restart vm function.

Changes from v2:
update some parameter name.

Signed-off-by: Shuping Cui <scui@redhat.com>
Signed-off-by: Yiqiao Pu <ypu@redhat.com>
Acked-by: Feng Yang <fyang@redhat.com>
virt-libvirt: lv_xml_devices add emulator XML support

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Fix vm_xml seclabel implementation details

* added del_seclabel accessor method so we have a complete set.

* get_seclabel() accessor method should raise exception
  for non-existant value instead of returning None value.

* set_seclabel() accessor method should not set unspecified
  imput attribute values.

* set_seclabel() should not perform non-data manipulation actions
  (self.define/undefine) since can introduce hidden side-effects.

* Made libvirt_xml_unittests fail tests for any subject-call
  which uses undefined dummy_virsh commands.

* Extended seclabel unittests for multi-mode access and
  exception checking.

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Implement stub for all XML devices

Accessing any vm_xml.devices member requiring an undefined
device xml module resulted in an extremely unhelpful error:

AttributeError: "type object 'exceptions.NotImplementedError' has no
attribute 'new_from_element'"

This commit adds a stub-class generating metaclass for undefined
devices.  The generated stub-class provides the minimal required
interface for the higher-level vm_xml.VMXMLDevices class.  Each
stub class will raise one-warning upon first use.  This is to notify
and make clear to all uses of these devices, that the interface
will likely change in the future.

Added unittests to verify functionality of stub-class metaclass.  Also
added plenty of docstrings and docstring updates.

Signed-off-by: Chris Evich <cevich@redhat.com>