qemu: Add base libraries for new block_stream tests

These libraries implement basic block copy and
block stream abstractions that'll be later used
in the new, updated block stream tests.

Signed-off-by: Xu Tian <xutian@redhat.com>
qemu_monitor/qemu_vm: Introduce new block mirror APIs

They'll be needed to support the new block stream
and block mirror tests.

Acked-by: Suqin Huang <shuang@redhat.com>
Signed-off-by: Xu Tian <xutian@redhat.com>
qemu: Refactor and update block stream tests

Introduce new block stream test cases:

refactor block stream cancel, set speed to make
script more readable;

block_stream_simple test include sub-tests:

1) Cancel block stream job aync and sync, AKA
cancel before/after set block job speed event;
2) set limited speed when job start and reset
job speed after job started and query block job
status used in each test of block stream tests,
so no special test for it;

Signed-off-by: Xu Tian <xutian@redhat.com>
virt.util_test: Add a new class for guest suspend test

This 'GuestSuspend' class contains some steps needed by
guest suspend test, it provides 2 methods:
 * guest_suspend_mem()
 * guest_suspend_disk()
They will run a 'standard' suspend testing.

If you want to custom suspend testing, you can just inherit
from this class and implement your own steps.

This class also provides 3 hook points:
 * action_before_suspend()
 * action_during_suspend()
 * action_after_suspend()
You can insert your own test steps in these test points.

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
tests.guest_s4: Update this test with new GuestSuspend class

This patch also add some custom cmd for windows XP/2003.

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
tests: Add a new test case guest_s3

This is another version of guest s3 test, it supports
both linux and windows guest.

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
tests: Remove test linux_s3

This linux_s3 test is replaced by test guest_s3,
so remove it directly.

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
virt.qemu_monitor: add system_wakeup monitor command

qemu adds a new monitor cmd called 'system_wakeup' in commit
9b9df25a474bfee59dd46d033eb4ccc16582aac2

This patch adds a method in kvm_monitor so that we can test
this new monitor cmd with autotest.

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
Acked-by: Feng Yang <fyang@redhat.com>
virt.utils_test: Refactor GuestsuSpend class

* Add __init__() method for this cass.
* Use variable argument list for all members.
* Move actual test steps out of this class, they will
  be put in a new class.
* Update vm's params dict before resume it from disk.
* Add a new member '_check_guest_suspend_log' for checking
  guest's system log.
* Update all private methods to protected methods.

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
Acked-by: Feng Yang <fyang@redhat.com>
virt.tests: Update guest s3/s4 test cases with new GuestSuspend class

This patch update guest_suspend as the comments of code review
for the ACPI feature:
 * Move guest_s3 and guest_s4 into a single script, guest_suspend.
 * Move the actual test steps of suspend testing into a separated
   class called "GuestSuspendBaseTest".
 * Add a "GuestSuspendNegativeTest" class for the negative testing
   of ACPI setting.
 * Update qemu_guest_agent_suspend with the new guest_suspend test.

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
Acked-by: Feng Yang <fyang@redhat.com>
virt.cfg: Update guest_s3/guest_s4 test config

Since guest_s3 and guest_s4 are merged into single script,
Update their config for the new script.

Changes from V1:
 * Add missing 'display = spice' parameters. Since S3 only
   work with spice/qxl driver on windows guest.

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
Acked-by: Feng Yang <fyang@redhat.com>
virt.cfg: Ignore exit status when checking if win guest support s3

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
Acked-by: Feng Yang <fyang@redhat.com>
virt.cfg: Update balloon_check test config for S3/S4 operation

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
Acked-by: Feng Yang <fyang@redhat.com>
tests.clock_getrs: Add sub test support fot this test

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
Acked-by: Feng Yang <fyang@redhat.com>
virt.cfg: guest_suspend: Add sub tests for kvmclock

Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
Acked-by: Feng Yang <fyang@redhat.com>